<quote from="David Wheeler">
    The problem with that is that then the particular $sth would have to 
    have the necessary column bound explicitly:
    
      $sth->bind_param($param_num, $bind_value,
                       { type => DATE_TIME });
    
    While that'd do-able, it's annoying. I'd rather see if there wasn't a 
    way to make this transparent to DBI. I'm not sure there's an easy 
    answer, though, and I'm probably just getting way too far ahead of 
    myself. ;-)
</quote>

I imagined the following stringification method:

use overload '""'    => "as_string";

sub as_string {
    my ($self) = @_;
    my ($package) = caller;
    no strict refs;
    return $package->FORMAT_DATETIME($self)
        if $package->can("FORMAT_DATETIME");
    ...
}

The author of a module just have to write a date-stringification method
of his package (obviously using strftime).

Szabó, Balázs (dLux)
--
                               ==  Make love, not war ==

Reply via email to