On Tue, 14 Jan 2003, Matthew Simon Cavalletto wrote:

> Using strftime as an example, this suggests the following code:
>
>    package DateTime;
>
>    sub strftime { (shift)->format_string('strtime', @_) }
>
>    sub format_string {
>      my ($dt, $type, @fmt) = @_;
>      my $package = "DateTime::Format::$type";
>      $package->rdsec_to_string( $dt->as_rd_sec(), @fmt );
>    }
>
>    sub as_rd_sec {
>      my $dt = shift;
>      return( $dt->{ratadie}, $dt->{julsec} );
>    }
>
>    package DateTime::Format::strtime;
>
>    sub rdsec_to_string {
>      my ($class, $rd, $sec, $fmt) = @_;
>      # ... strftime logic...
>      return $string;
>    }

Just for the record.  Formatters (however they're implemented) are going
to get the DateTime object, not its internal representation.  That's kind
of the point of objects, ya know ;)


-dave

/*=======================
House Absolute Consulting
www.houseabsolute.com
=======================*/

Reply via email to