Changeset 1207

Show
Ignore:
Timestamp:
08/03/06 12:25:08
Author:
miyagawa
Message:

support $date->format( DateTime?::Format instance )

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plagger/lib/Plagger/Date.pm

    r688 r1207  
    6666sub format { 
    6767    my($self, $format) = @_; 
    68     my $module = "DateTime::Format::$format"; 
    69     $module->require or die $@; 
     68 
     69    my $module; 
     70    if (ref $format) { 
     71        $module = $format; 
     72    } else { 
     73        $module = "DateTime::Format::$format"; 
     74        $module->require or die $@; 
     75    } 
    7076 
    7177    $module->format_datetime($self);