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

CORE::GLOBAL::close - how to override properly

by dk (Chaplain)
on Oct 11, 2010 at 07:19 UTC ( #864545=perlquestion: print w/replies, xml ) Need Help??

dk has asked for the wisdom of the Perl Monks concerning the following question:

Hello,

I cannot figure out how to override close() properly. If I do it as

use strict; use warnings; BEGIN { *CORE::GLOBAL::close = sub { 1 }; }; close STDIN;

then I get the bareword "STDIN" not allowed error. Sure I can call it as close \*STDIN but that beats the purpose of the override itself.

Any ideas? Thanks!

Update: solved, ikegami++!

Replies are listed 'Best First'.
Re: CORE::GLOBAL::close - how to override properly
by ikegami (Patriarch) on Oct 11, 2010 at 07:34 UTC
      Excellent, it works, thank you!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2022-10-07 15:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred way to holiday/vacation is:











    Results (30 votes). Check out past polls.

    Notices?