On Sun, 12 Jan 2003, dLux wrote: > # same as $old_date but day of month is 5 > my $new_date = $old_date->clone( day => 5 ); > > I used this in Class::Date, because of the object-semantics of perl: > If an object is referenced from more than one place, then it silently > changes all date objects.
But that might actually be a good thing. I guess it depends on whether we expect people to understand the difference between references and values and how that works with objects, I suppose. I tend to think that when I pass an object to a function/method, or store it in a data structure, that it's the _same_ object at all times. This is in fact correct. Other people, however, may lose track of that, and think it's different, leading to weird surprises when $datetime and $dates[27] _both_ change when $datetime is updated. > I think throwing an object is better. I don't really like parsing > error messages to determine what error is happened. Just think about > internationalization. I think we've agreed on DBI-like flexible behavior (return undef, die, or call a user-defined callback). -dave /*======================= House Absolute Consulting www.houseabsolute.com =======================*/
