Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Hi all,

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.

In reply to hijacking a module constructor by hackmare

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2024-04-25 08:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found