Christian Hansen
Recent Actions
-
Commented on Test2/Test::Builder Update from the QAH
These are fundamental concepts in any R&D, why should we be different?...
-
Commented on Test2/Test::Builder Update from the QAH
1) If it ain't broke, don't fix it! 2) Opt-in not opt-out! 3) Don't punish upstream authors/maintainers for your new fancy framework! Opt-in not Opt-out! -- chansen...
-
Commented on A Date with CPAN, Part 2: Target First, Aim Afterwards
First, I would like to apology for my first message, it came out a lot harsher than I intended! Just because Time::Piece is in core doesn't mean it's stable! Time::Piece has several quirks: Time::Piece->strptime() parses any given string as being...
-
Commented on A Date with CPAN, Part 2: Target First, Aim Afterwards
BTW, there is a reason for ISO 8601 and why Time::Moment implements it ;) -- chansen...
-
Commented on A Date with CPAN, Part 2: Target First, Aim Afterwards
You cannot parse an arbitrary date or date with time without heuristics, you have declared that you intend to use Date::Parse and Time::ParseDate to parse your dates, both of those modules uses heuristics. How do you intend to deal with...
-
Commented on A Date with CPAN, Part 1: State of the Union
Time::Moment doesn't have an explicit method for truncating, but you can truncate to day by calling the method ->at_midnight. You can also truncate to other calendar components by chaining the ->at_midnight call with a ->with_day_of_xxxx method call. Examples: $tm =...
-
Posted Calculating U.S Federal holidays with Time::Moment to Christian Hansen
… -
Posted Simple and efficient formatting of relative date/time using Time::Moment to Christian Hansen
#!/usr/bin/perl use warnings; use Carp qw[]; use Time::Moment 0.19 qw[]; sub YEAR () { 365.2425 } sub MONTH () { YEAR / 12 } sub DAY () { 1 } sub HOUR () { DAY / 24 } sub MINUTE () { HOUR / 60 } sub SECOND () { MINU…
-
Commented on Time::Moment vs DateTime
And the benchmark:...
-
Commented on Time::Moment vs DateTime
Time::Moment only use gettimeofday(2) and localtime(3) to compute the difference. I did consider to add Panda::Date until I reviewed the source code. Your code isn't thread safe and you require 5.18 to compile it, and your naïve implementation of a...
-
Posted Let's talk about Time::Moment and round-trip of strings to Christian Hansen
In my previous blog post I wrote a lot more about Time::Moment, than appeared in the post (could have been my mistake due to a preview and error and a…
-
Commented on Time::Moment vs DateTime
I'm not sure what you are asking, if you think I didn't try to improve the performance of DateTime.pm, you think wrong (look at the changelog or ask Dave Rolsky). Time::Moment can never be "backwards" comparability with DateTime.pm due to...
-
Commented on A bit more about Time::Moment
While it would be technically possible, it would make the API confusing and fragile IMHO. I intend to add a Duration object (Time::Moment::Duration). $duration = $tm1->minus($tm2); $tm2 = $tm1->plus($duration); $tm2 = $tm1->minus($duration); $duration = $tm1 - $tm2; $tm2 = $tm1...
-
Commented on A bit more about Time::Moment
LOL, somewhere this blogpost got choped =(...
-
Posted A bit more about Time::Moment to Christian Hansen
In my previous blog post I mentioned the bottlenecks of DateTime and why I had to develop Time::Moment and it's underlying c library,
-
Commented on Time::Moment vs DateTime
I'm glad you like c-dt, Time::Moment only uses a fraction of the API povided by c-dt. As you might have seen c-dt provides calculation of easter (western/orthodox), efficient business day calculations and weekday calculations and a bit more. c-dt is...
-
Commented on Time::Moment vs DateTime
Thanks, I'll consider adding Class::Date and Panda::Date to the benchmark....
-
Commented on Time::Moment vs DateTime
Time::Moment represents an unambiguous point in time, but it's not fully time zone aware. If you have a local time (a point in time with an offset) you may need to use a time zone if you intend to perform...
-
Posted Time::Moment vs DateTime to Christian Hansen
In December last year released the first version of Time::Moment. I don't foresee any major changes in Time::Moment 0.16 API, so in next release I'll remove the "early preview release" notice in the description. I have been using 0.16 in…
-
Commented on YAPC::Asia Tokyo 2013: Fighting Legacy Code
If my URL::Encode::XS makes a difference you should try Unicode::UTF8 (also my module), it makes a huge difference in my deployments. -- chansen...
-
Commented on Coping with double encoded UTF-8
$UTF8_double_encoded is defined in the first code snippet. The usage of &utf8::is_utf8 is to determine to match Perl's internal representation of wide characters or the octet reprepresentation of UTF-8. -- chansen...
-
Commented on Tut # 7: jQuery, Ajax, xml, Perl, databases and utf8
1) There is no need for using the utf8 pragma unless your literal strings contains UTF-X. 2) Using Encode.pm's utf8 decoder is a bad idea for external/untrusted data since it's a superset of UTF-8 and therefore accepts ill-formed UTF-8 (as...
-
Commented on Date arithmetic can be dangerous
Just because you doesn't know how date arithmetic is done, doesn't meen it's dangerous! Assuming that a day consist of 60*60*24 seconds is ignorant!...
-
Commented on Perl regex escapes by version
Very useful! Thanks to you and Tom! -- chansen...
-
Commented on CPAN modules for generating passwords
Thanks for sharing, very useful post =)...
-
Posted What if sv_utf8_upgrade() used heuristic encoding? to Christian Hansen
Heuristic: decode as native unless is well-formed UTF-X:
sub heuristic_utf8_upgrade { utf8::upgrade($_[0]) unless utf8::decode($_[0]); return !!0; }
Here is some code to play with:
#!/usr/bin/pe…
-
Posted Coping with double encoded UTF-8 to Christian Hansen
A few months ago a client asked if could help them with a "double encoded UTF-8 data problem", they had managed to store several GB of data with "corrupted" UTF-8 (technically it's not corrupt UTF-8 since its well-formed UTF-8). During the process I developed several regexs that I would like to…
-
Commented on XS bits: Which class is this object blessed into?
perldoc.perl.org has anchors for perlapi.pod. sv_derived_from -- chansen...
Comment Threads
-
Aristotle commented on
Test2/Test::Builder Update from the QAH
For TCM to work with Test2, every single module you use to output tests must also use Test2.
This, however, I will call unqualified nonsense. Let me demonstrate to you why:
- Test::More will not be changing at all. Yet it will be able to coöperate with Test2-based modules just fine, by using a Test::Builder whose guts have been swapped for a Test2 wrapper.
- If it were true, that would mean that Test2 could not be released as part of Test::Builder without a simultaneous re-release every single test module on CPAN, ported to Test2. Otherwise CPAN …
-
blog.urth.org commented on
Test2/Test::Builder Update from the QAH
Aristotle said:
Thus the claim that Test modules would have to be written specifically against Test2, in order to be able to work with other Test2-based modules, is simply factually incorrect.
That wasn't what I was trying to claim. Maybe I don't understand what you and Leon wanted to happen.
My point was simply that Test2-using tools will not cooperate with code that uses the existing pre-Test2 Test::Builder. Of course, if Test::Builder is using Test2 under the hood, then tools using Test::Builder do not also have to change (but AFAICT no one is say…
-
Aristotle commented on
Test2/Test::Builder Update from the QAH
Maybe I don't understand what you and Leon wanted to happen.
Yes, sorry, I’ll be publishing a long-form, detailed version of the proposal very soon. I’ve realised the proposal is (either largely or entirely) non-understood – the abridged version I presented on the fly at that table was insufficient. (I had hoped but failed to have it out there sufficiently early before the QAH that people could digest it in detail.)
My point was simply that Test2-using tools will not cooperate with code that uses the existing pre-Test2 Test::Builder.
-
Chad 'Exodist' Granum commented on
Test2/Test::Builder Update from the QAH
One of the initial options discussed as early as last year was this:
Test2 and Test::Builder remain separate. Tools pick one a build with it. To use both together you load a shim such as Test2::Legacy, which replaces Test::Builder with the alternative guts.
This was the alternative being discussed in the Test2 meeting on day 1 of the 2016 hackathon. We decided it was not the right plan. My main reason for opposing this plan is that nothing stops people from updating old modules to use Test2, and also auto-loading the shim to insure they do not break things that depend on them…
-
Christian Damen commented on
Time::Moment vs DateTime
Gonna migrate our PERL5 applications from DateTime => Time::Moment. Thanks for all the efforts.
About blogs.perl.org
blogs.perl.org is a common blogging platform for the Perl community. Written in Perl with a graphic design donated by Six Apart, Ltd.