http://qs1969.pair.com?node_id=677065

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