shemp has asked for the wisdom of the Perl Monks concerning the following question:
Where method X() handles most of some functionality, but i want children to be able to override part of the behaviour with _Private_X(). But the base class often doesnt need a _Private_X().sub X { my $self = shift @_; ... $self->_Private_X(); ... }
Either way does the job, today im leaning towards the can() way of doing things.sub X { my $self = shift @_; ... if ( $self->can('_Private_X') ) { $self->_Private_X(); } ... }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: overridden method - best way
by dragonchild (Archbishop) on May 25, 2004 at 17:26 UTC | |
|
Re: overridden method - best way
by adrianh (Chancellor) on May 25, 2004 at 18:57 UTC | |
|
Re: overridden method - best way
by geekgrrl (Pilgrim) on May 25, 2004 at 17:45 UTC | |
by adrianh (Chancellor) on May 25, 2004 at 23:56 UTC | |
by geekgrrl (Pilgrim) on May 26, 2004 at 18:39 UTC | |
by adrianh (Chancellor) on May 27, 2004 at 12:36 UTC | |
|
Re: overridden method - best way
by jaa (Friar) on May 25, 2004 at 17:50 UTC | |
by jaa (Friar) on May 25, 2004 at 18:02 UTC | |
|
Re: overridden method - best way
by dcvr69 (Beadle) on May 25, 2004 at 21:14 UTC |