hackmare has asked for the wisdom of the Perl Monks concerning the following question:
is it possible to re-map a method call to redirect it to another module? I am trying to replace all calls to GD.pm with SVG::GD.pm down the dependency tree by modifying the mail program and not modifying any program that may inherit GD.pm.
The latter provides all the call support for GD.pm but generates SVG (and) implements the GD library.
All this is great, but now I want to use GD::Graph::Bar (for example), and I need to make the change at the main program level only (not within the GD::Graph::Bar namespace). I need the fact that I am using SVG::GD to superscede all calls to the GD module.
GD::Graph::Bar has calls to GD buried deep inside them, and I want to hijack all the GD constructor calls to use the SVG::GD constructor instead. Ingrate that I am, I'm hoping that I can do this from the main namespace so a user can select to use SVG::GD rathern than be forced to use the GD.
(In short, for example, I want to apply s/GD::Image/SVG::GD::Image/g in the source code)
Can this be done? I seem to remember hearing of this being done at one of the yapc's, but don't have the slightest idea where to look. I'm starting to feel way above my head here and would appreciate a nudge in the right direction or towards the right reference.
hackmare.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: hijacking a module constructor
by broquaint (Abbot) on Nov 03, 2003 at 16:43 UTC | |
by hackmare (Pilgrim) on Nov 03, 2003 at 16:54 UTC | |
by Corion (Patriarch) on Nov 03, 2003 at 17:03 UTC | |
by hackmare (Pilgrim) on Nov 03, 2003 at 23:13 UTC | |
by tilly (Archbishop) on Nov 04, 2003 at 03:15 UTC | |
| |
by broquaint (Abbot) on Nov 03, 2003 at 17:16 UTC | |
Re: hijacking a module constructor
by perrin (Chancellor) on Nov 03, 2003 at 16:52 UTC | |
by hackmare (Pilgrim) on Nov 03, 2003 at 17:14 UTC | |
Re: hijacking a module constructor
by hardburn (Abbot) on Nov 03, 2003 at 17:17 UTC | |
by Art_XIV (Hermit) on Nov 03, 2003 at 17:32 UTC | |
Re: hijacking a module constructor
by Art_XIV (Hermit) on Nov 03, 2003 at 17:06 UTC |