Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^3: Altering Package Subs and Running In To Problems

by steves (Curate)
on Nov 11, 2004 at 13:12 UTC ( #407022=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Altering Package Subs and Running In To Problems
in thread Altering Package Subs and Running In To Problems

I tested and doing it in INIT works as you'd expect: import is called when the module is used, thereby replacing the function before the base one being replaced is defined. So the base ends up replacing the plug-in. But INIT is called right before execution so it does the job.

Regarding the evilness of this: Playing around like this is one of the ways I learned how Perl works. You will no doubt experience several lightbulbs going on as try different approaches, which is a good thing. Just think about your clients, the interfaces they use, and how much you may be bending standard views of the world before you turn what you play with into production code.


Comment on Re^3: Altering Package Subs and Running In To Problems
Re^4: Altering Package Subs and Running In To Problems
by Bovine (Initiate) on Nov 11, 2004 at 22:48 UTC

    Ah, cool. Thanks!

    Yeah, i understand. Im not really expecting this to become widespread, i just think its an interesting idea.

    Thanks again.

    Correct me if im wrong, but INIT is run once, correct?
    If multiple 'use's to Plugin.pm are made, then do problems arise?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://407022]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (7)
As of 2014-12-21 22:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (108 votes), past polls