thpfft has asked for the wisdom of the Perl Monks concerning the following question:
hello hello. A couple of quick and probably silly questions, if I may, about this:
no strict ('refs'); *{"$class\::_factory"} = sub { return __PACKAGE__->instance; };
1. will __PACKAGE__ do the right thing in subclasses that inherit this code? (That is, subclasses of the package containing this snippet, not of $class).
2. does use of __PACKAGE__ here create a closure? I'm hoping that it's disappeared at compile time rather than being interpolated later...
thank you.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: __PACKAGE__ in anonysub
by blokhead (Monsignor) on Feb 19, 2005 at 19:42 UTC | |
by thpfft (Chaplain) on Feb 19, 2005 at 20:07 UTC | |
by Tanktalus (Canon) on Feb 19, 2005 at 20:27 UTC | |
by thpfft (Chaplain) on Feb 19, 2005 at 20:52 UTC | |
by ikegami (Patriarch) on Feb 19, 2005 at 20:36 UTC | |
by thpfft (Chaplain) on Feb 19, 2005 at 21:05 UTC | |
|
Re: __PACKAGE__ in anonysub
by borisz (Canon) on Feb 20, 2005 at 00:09 UTC |