Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

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

by eyepopslikeamosquito (Canon)
on May 05, 2005 at 03:00 UTC ( #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
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? | Other CB clients
Other Users?
Others lurking in the Monastery: (13)
As of 2014-12-18 22:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (66 votes), past polls