user-pic

Christian Hansen

  • About: I blog about Perl.
  • 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...
Subscribe to feed Recent Actions from Christian Hansen

  • lestrrat commented on YAPC::Asia Tokyo 2013: Fighting Legacy Code

    wish things were that simple. our system has unspeakable mess in the encoding layer. I don't know that will be fixed. I can only use stuff like Unicode::UTF8 after all that mess is cleared up.

  • brooklyn.kid51 commented on Time::Moment vs DateTime

    This looks interesting, especially https://github.com/chansen/c-dt.

    And for anyone who goes to that github page and wonders what a "proleptic Gregorian calendar" is, here's a link:

    https://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar

    Thank you very much.
    Jim Keenan

  • Duncan commented on Time::Moment vs DateTime

    Perl badly needs a standard or at least a "de facto" standard for date time handling. DateTime has seemed to be emerging as that standard for some years. Unfortunately this is the third or so article in the last twelve months criticising it and promoting something else.

    Wouldn't it have been great to read that two clever programmers had collaborated and that DateTime version ??? was backward compatable and really flew.

    Then the benefits would have gradually crept into our codebase without me getting into another argument about standard modules.

    The stats quoted for Ti…

  • Duncan commented on Time::Moment vs DateTime

    "without me getting into another argument about standard modules"

    Slightly worried about what I've written there. I'm writing about an argument at $work, not with anyone on this list.

  • gvl commented on A bit more about Time::Moment

    Why no overloading operators other than stringification and comparison? It would be easier to just add two scalars containing a references to a Time::Moment class than use plus_hours or one of those other methods.

Subscribe to feed Responses to Comments from Christian Hansen

About blogs.perl.org

blogs.perl.org is a common blogging platform for the Perl community. Written in Perl and offering the modern features you’ve come to expect in blog platforms, the site is run by Dave Cross and Aaron Crane, with a design donated by Six Apart, Ltd.