ormy $e = Example::Module->new(@list);
Both are supported by the snippet code! Even works if ->new is inherited, and doesn't disturb any other class methods.my $e = Example::Module(@list);
package Example::Module; ... sub Example::Module { return "Example::Module" unless @_; Example::Module::->new(@_); # extra colons are necessary } ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Create a constructor named the same as your package name!
by DrHyde (Prior) on Jul 01, 2004 at 13:03 UTC | |
by merlyn (Sage) on Jul 01, 2004 at 14:15 UTC | |
|
Re: Create a constructor named the same as your package name!
by Solo (Deacon) on Jul 01, 2004 at 13:41 UTC | |
by jryan (Vicar) on Jul 01, 2004 at 16:15 UTC | |
by merlyn (Sage) on Jul 01, 2004 at 16:19 UTC | |
by antirice (Priest) on Jul 03, 2004 at 06:16 UTC |