On Tue 2003/01/14 13:16:08 CST, Dave Rolsky <[EMAIL PROTECTED]> writes:
> 2. I really want to avoid runtime module loading.  This is because I have
> a mod_perl bias, and with mod_perl, it's much better to load modules at
> compile time (in the parent Apache process) than at runtime, where the
> module ends up being loaded once per child process.  See
> http://perl.apache.org/docs/1.0/guide/performance.html#Preloading_Perl_Module
> s_at_Server_Startup for an explanation of why this is important.

Sounds like a good reason to me (I didn't think of it because most of my 
work is not in mod_perl).

> So given those constraints, here are the potential options on the table,
> _so far_ (I welcome others that fit into the above constraints).
> 
>   use DateTime;
>   use DateTime::Parse::MySQL; # this needs a better name
>   my $dt = DateTime::Parse::MySQL->new_datetime( $mysql_dt );
>   print DateTime::Parse::MySQL->mysql_datetime( $dt );
> 
> or
> 
>   use DateTime;
>   use DateTime::Parse::MySQL;
>   my $dt = DateTime->from_mysql_datetime( $mysql_dt );
>   print $dt->to_mysql_string();

I prefer the second option of these two.  It's more compact and easier to 
read (to me).

I wouldn't mind the first option either if "print $dt->mysql_datetime" 
would work instead of "print DateTime::Parse::MySQL->mysql_datetime($dt)".  
It's just too verbose.


Reply via email to