Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Testing failures: How to override print to make it fail?

by eyepopslikeamosquito (Archbishop)
on May 05, 2005 at 03:00 UTC ( [id://454223]=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    BEGIN {
        *CORE::GLOBAL::open = sub (*;$$) { return undef };
    }
    open(my $fh, '>', 'f.tmp') or die "error: open";
    print $fh "hello\n" or die "error: print";
    
  2. or download this
    BEGIN {
        *CORE::GLOBAL::print = sub (*;@) { return undef };
    }
    open(my $fh, '>', 'f.tmp') or die "error: open";
    print $fh "hello\n" or die "error: print";
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2024-04-23 17:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found