in reply to passing subroutine args as a hash: why not?
Nit: you don't need the prototype; Perl does the right thing for you automatically.
I like hashes in constructors where I may have to set defaults. They're also nice when you don't want to remember the positions of arguments:
my $alias = Mail::SimpleList::Alias->new( Expires => '7d', Auto_add => 0, Closed => 1, ); # and in Mail::SimpleList::Alias sub new { my $class = shift; bless { Owner => '', Auto_add => 1, Expires => 0, Closed => 0, @_; }, $class; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: passing subroutine args as a hash: why not?
by Willard B. Trophy (Hermit) on Jun 05, 2003 at 18:51 UTC | |
by sauoq (Abbot) on Jun 05, 2003 at 19:44 UTC | |
by Willard B. Trophy (Hermit) on Jun 05, 2003 at 21:49 UTC | |
by sauoq (Abbot) on Jun 05, 2003 at 23:09 UTC | |
by chromatic (Archbishop) on Jun 05, 2003 at 19:58 UTC |