in reply to Calling arbitrary method from new
Are you looking for something like:
for my $argument ( keys %args ) { $self->$argument( $args{ $argument } ) if exists $hash{ '_' . $argument }; }
As a side note, I prefer to generate accessors at compile-time without using AUTOLOAD when possible. Unless you predeclare all of the methods you're generating with subs or provide your own can(), you've made life more difficult for users of your code.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Calling arbitrary method from new
by mrborisguy (Hermit) on Jun 10, 2005 at 03:41 UTC | |
by tlm (Prior) on Jun 10, 2005 at 03:50 UTC | |
by hv (Prior) on Jun 10, 2005 at 08:21 UTC |