in reply to use, require, import and use arguments
I tried the following:
package Mod; sub foo { print "Output: @_\n"; } sub import { my ($pkg, %options) = @_; __PACKAGE__->foo(arg => $options{-arg}); } 1;
Result:
> perl -e 'use Mod -arg => "custom";' Output: Mod arg custom
No dying at all.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: use, require, import and use arguments
by djihed (Novice) on Feb 26, 2011 at 12:59 UTC | |
by Anonymous Monk on Feb 26, 2011 at 14:06 UTC | |
by djihed (Novice) on Feb 26, 2011 at 15:16 UTC | |
by Anonymous Monk on Feb 26, 2011 at 15:28 UTC |