punkish has asked for the wisdom of the Perl Monks concerning the following question:
Scenario:
I install Foo:Bar from CPAN (perl -MCPAN -eshell, etc.). I write my code --
my $baz = Foo::Bar->new(); $baz->do_magic;
Then I discover that $baz->do_magic does about 90% of what I want. So, I want to modify it, but I don't want to tinker with the Foo::Bar code. I do the following in my package.
package My::Package; .. lots of code .. package Foo::Bar; # my version of do_magic sub do_magic { } # end of my tinkering with Foo::Bar 1;
Question: Is this the right way? Perl does complain and tell me that do_magic has been redefined, but yeah, that's what I did. If this is not a good way, what is the better way?
--
when small people start casting long shadows, it is time to go to bed
when small people start casting long shadows, it is time to go to bed
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: The correct way to redefine a routine
by Fletch (Bishop) on Mar 28, 2008 at 17:49 UTC | |
Re: The correct way to redefine a routine
by pc88mxer (Vicar) on Mar 28, 2008 at 17:51 UTC | |
Re: The correct way to redefine a routine
by Narveson (Chaplain) on Mar 28, 2008 at 18:04 UTC | |
Re: The correct way to redefine a routine
by dragonchild (Archbishop) on Mar 28, 2008 at 19:48 UTC | |
Re: The correct way to redefine a routine
by Anonymous Monk on Mar 29, 2008 at 06:14 UTC | |
Re: The correct way to redefine a routine
by jsegal (Friar) on Apr 02, 2008 at 22:27 UTC |
Back to
Seekers of Perl Wisdom