On Thu, 4 Aug 2005, Eugene van der Pijll wrote:

> Roderick A. Anderson schreef:
> > Short story usng the truncate method on a datetime object that was created
> > with a format destroys/removes the format -- forever.
> 
> That's a bug. DT::truncate() copies the locale and the timezone, but
> should also copy the formatter.
> 
> > Then while writng
> > this message I found that when I try to create a copy ( well probably not
> > as the results show otherwise ) that it is an alias/reference?
> 
> Yes. All objects in Perl are references; copying of objects by simple
> assignment is always shallow.
                       ^^^^^^^
That's my knowledge level some times.  But I'm getting better. :-)
Actually now that you mention this I remember reading it but haven't had
to _clone/copy_ objects so never got the chance to make this mistake.

> > my $dt2 = $dt;
> 
> Try
> 
>     my $dt2 = $dt->clone;

Thanks.

On another note I was reading another thread in the archives and noted
->strftime ( which must have slipped right by me in the docs ) and this
does what I need with a single DT object.  A filename prefix, and a _real_ 
date and time.


Thanks for the pointers,
Rod
-- 
    "Open Source Software - You usually get more than you pay for..."
     "Build A Brighter Lamp :: Linux Apache {middleware} PostgreSQL"


Reply via email to