[Israel.pm] bless and AUTOLOAD

Yuval Yaari yuval at windax.com
Tue Sep 25 12:38:10 PDT 2007


Yona Shlomo wrote:
> Is well in place, but alas, I'm too lazy to implement
> several dozens of functions/methods that are the same except
> for their name... and then change (all of them with no
> mistakes) then when needed...
>   
How about...

<UGLY>
BEGIN {
    no strict 'refs';
    *{__PACKAGE__ . '::' . $_} = sub {}
            for qw/foo bar baz DESTROY/;
}
</UGLY>

HTH :-)

  ~Y



More information about the Perl mailing list