in reply to Re^4: Overriding 'static' methods of a perl package
in thread Overriding 'static' methods of a perl package
As you keep the exact text of "compilation error" to yourself, I won't be able to help you with that. The most likely reason is that parent.pm is not installed on your machine. You could try the substitute base.pm that is distributed with older versions of Perl.
I can only iterate it again. If you want to use features such as "inheritance", you'll have to use the object syntax everywhere.
Of course, for customizing the behaviour of the One Big Subroutine, it's likely easier to pass it a callback and in its absence to use a default routine:
package Parent; sub name { return 'Parent' }; sub identify { my (%options) = @_; $options{ get_name } ||= \&name; print "Hello " . $options{ get_name }->() . "\n"; }; package Child; sub identify { Parent::identify( get_name => sub { 'Child' }); }; 1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Overriding 'static' methods of a perl package
by Anonymous Monk on Sep 16, 2008 at 16:07 UTC | |
by Fletch (Bishop) on Sep 16, 2008 at 16:16 UTC | |
by Anonymous Monk on Sep 16, 2008 at 17:43 UTC | |
by FunkyMonk (Bishop) on Sep 16, 2008 at 21:44 UTC |