Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
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 chanting in the Monastery: (2)
As of 2022-09-26 05:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer my indexes to start at:




    Results (117 votes). Check out past polls.

    Notices?