in reply to Storing Info with Accessors
You could then just call something like my $value = $object->get_items_in_order(); and avoid a begin block and the overhead of eval'ing altogether. With some minor modifications, the Autoload could deal with your array reference problems I think (unless I misunderstood).sub AUTOLOAD { my ($self,$newval) = @_; if ($AUTOLOAD =~ /.*::get_(\w+)/){ return $self->{$1}; }elsif($AUTOLOAD =~ /.*::set_(\w+)/){ $self->{$1} = $newval; }else{ croak "$AUTOLOAD is not a method"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Storing Info with Accessors
by graq (Curate) on Aug 02, 2001 at 12:37 UTC |