Changeset 1833

Show
Ignore:
Timestamp:
11/19/06 11:28:30
Author:
miyagawa
Message:

Support DateTime?::Format::Japanese in parse_dwim, hence in EFT scripts.
Fixes #442

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plagger/Makefile.PL

    r1807 r1833  
    7070        recommends('HTML::FormatText'), 
    7171    ], 
     72    'Parse Japanese datetime format' => [ 
     73        -default => 0, 
     74        recommends('DateTime::Format::Japanese'), 
     75    ], 
    7276); 
    7377 
  • trunk/plagger/lib/Plagger/Date.pm

    r1749 r1833  
    2727sub parse_dwim { 
    2828    my($class, $str) = @_; 
     29 
     30    # check if it's Japanese 
     31    if ($str =~ /^(\x{5E73}\x{6210}|\x{662D}\x{548C}|\x{5927}\x{6B63}|\x{660E}\x{6CBB})/) { 
     32        eval { require DateTime::Format::Japanese }; 
     33        if ($@) { 
     34            Plagger->context->log(warn => "requires DateTime::Format::Japanese to parse '$str'"); 
     35            return; 
     36        } 
     37        return $class->parse( 'Japanese', encode_utf8($str) ); 
     38    } 
    2939 
    3040    require Date::Parse;