in reply to Re: Stumped on an OO Problem
in thread Stumped on an OO Problem
No... this breaks inheritance, because you're trying to use @permitted in a different scope than where it was defined. @permitted is scoped lexically to the file in which it was defined, so you can't try to use it in your generic parent class, which is, presumably, where pack would be defined.> But now you have also the @permitted > array, which would allow you to write pack as follows, > giving you control over the order in > which the elements are packed: > > > sub pack { > my $self=shift; > my $record=join(':', @{$self}{@permitted}); > return $record; > }
A solution would be to take a reference to the array and store it in your object, as we're already doing with %fields.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: RE: Re: Stumped on an OO Problem
by ZZamboni (Curate) on Jun 27, 2000 at 23:11 UTC |