Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: using Exporter to overwrite a core function

by Zaxo (Archbishop)
on Apr 10, 2005 at 08:20 UTC ( #446361=note: print w/ replies, xml ) Need Help??


in reply to using Exporter to overwrite a core function

Or you could do it the old-fashoned way:

BEGIN { *CORE::GLOBAL::sysread = sub (*\$$;$) { # whatever }; }
The prototype is probably desirable in this case; it comes from perl -e'print prototype "CORE::sysread"'.

If you want to limit the damage, you can localize the effect to a dynamic scope:

{ local *CORE::GLOBAL::sysread = \&mysysread; # do things that call builtin sysread } # no more replacement from here on

After Compline,
Zaxo


Comment on Re: using Exporter to overwrite a core function
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2015-07-07 02:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (86 votes), past polls