develooper Front page | perl.beginners | Postings from December 2003

CORE::GLOBAL override question

Thread Next
From:
Jesper Noehr
Date:
December 23, 2003 11:33
Subject:
CORE::GLOBAL override question
Message ID:
opr0ne96jyk39tb9@printf.dk
Hey list!

I'm having a problem with overriding a sub in CORE::GLOBAL.
I need to override exit(), and I'm doing that with:

BEGIN { *CORE::GLOBAL::exit = sub { print "exit: ".shift; } };

..which works for the program itself.

However! When I call exit() in a module used by my program, the module 
actaully calls 'exit()' in its original meaning, and NOT the one I defined 
myself.
How do I get the module to treat exit() the way I defined it?

I don't wanna change code in the module itself.

Thanks in advance!

-- 
Jesper Nøhr - decius <jesper@noehr.org>
Holstebro, Denmark -- http://printf.dk
UNIX Administrator, Software Engineer, Geek.

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About