in reply to Re^3: Sharing and over-riding package functions
in thread Sharing and over-riding package functions
That's basically the same code I started with. The only real difference between your example and mine is that in Functions::Alternate I chose not imported the functions I was replacing to avoid redefine warnings, where as you chose to import all functions and quiet the redefine warnings. I must admit though, your slant avoids having to manually keep track of what functions have been replaced, which is a nice touch.
But if you read down to my reply to rir you'll find that this approach fails when functions call functions within the same package
Consider this:sub func1 { print "goodbye"; func2(); }
If func1 isn't also replaced, it will execute Functions::Base::func2() when it's called, not the Functions::Alternate::func2() we're trying to replace. I never realized this when I started the post.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Sharing and over-riding package functions
by kennethk (Abbot) on Dec 12, 2008 at 04:16 UTC |