|
NAMEself::init - Invoke package init methods at compile time VERSIONVersion 0.01 SYNOPSIS # At compile time
use self::init
\-x => qw( y z ), # same as BEGIN { CLASS->x('y','z'); }
;
# At runtime
self::init
\-a => qw(a b),
\-b => (),
\-c => qw( c c ),
;
# Same as
CLASS->a('a','v');
CLASS->b();
CLASS->c('c','c');
# With bad arguments (scalarrefs, containing string, beginning from -)
self::init
[ a => \'-arg1', \'-arg2' ],
[ b => 'arg3', 'arg4' ],
;
# ! Warning!
# Mixed syntax is not allowed
self::init
\-a => qw(arg1 arg2),
[ b => \'-arg1', \'-arg2' ],
;
# will be invoked as
CLASS->a('arg1','arg2', [ 'b', \'-arg1', \'-arg2' ] );
# So be aware
DESCRIPTIONThis module is just a helper to avoid repetiotion of ugly __PACKAGE__->method(); INTERFACE
AUTHORMons Anderson, <mons@cpan.org> BUGSNone known COPYRIGHT & LICENSECopyright 2009 Mons Anderson. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
|