Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: overwrite builtin functions ( system, chdir )

by ktross (Deacon)
on Apr 04, 2005 at 13:16 UTC ( [id://444657]=note: print w/replies, xml ) Need Help??


in reply to overwrite builtin functions ( system, chdir )

Would something like this do?
use subs 'system','chdir','glob'; glob; chdir; system; sub system {print "system\n"} sub chdir { print "chdir\n" } sub glob { print "glob\n" }

__OUTPUT__

glob
chdir
system

Replies are listed 'Best First'.
Re^2: overwrite builtin functions ( system, chdir )
by borisz (Canon) on Apr 04, 2005 at 13:33 UTC
    Hi,
    No, that is not enough, I like to overwrite the functions global regardless of the namespace.
    So that this work:
    *CORE::GLOBAL::system = sub { print "system\n" }; *CORE::GLOBAL::chdir = sub { print "chdir\n" }; *CORE::GLOBAL::glob = sub { print "glob\n" }; package xyz; glob; chdir; system
    Boris

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (8)
As of 2024-04-16 07:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found