[Omaha.pm] Class::Date - change once set

Jay Hannah jay at jays.net
Tue Oct 25 19:54:49 PDT 2005


On Oct 24, 2005, at 3:25 PM, Kenneth Thompson wrote:
> sub stuff {
>     my ($d1, $d2) = @_;
>     if ($d2 > $d1) {
> #      $d1 = $d2;   # <---- I want to overwrite the existing $d1 here
>        foreach my $idx (0 .. 9) {
>          $d1->[$idx] = $d2->[$idx];
>        }
>     }
> }

Yikes! Break encapsulation and jack the object's internals? I'll be 
doomed if the internal implementation of Class::Date ever changes...

j




More information about the Omaha-pm mailing list