Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Scratch Pad Viewer

( #108949=superdoc: print w/replies, xml ) Need Help??

wog's home node

for japhy:

=-> cat my($plaintext,$html); $plaintext = ">> foo"; pipe(READ, WRITE); print "about to open\n"; open WRITE, "| cat"; print WRITE $plaintext; print "\njust wrote\n"; close WRITE; print "\nclosed\n"; { local $/; $html = <READ>; } close READ; print "\njust read\n"; print "\$html: $html\n" =-> perl about to open just wrote >> foo closed just read $html:

#!/usr/bin/perl -w use strict; BEGIN { package Date::Year1984; use vars qw(@ISA); require Tie::Handle; @ISA = qw(Tie::StdHandle); sub samecase { my($what,$pat) = @_; $what = lc $what; for my $i (0..length($pat)-1) { substr($what,$i,1) = uc substr($what,$i,1) if substr($pat,$i,1) eq uc substr($pat,$i,1); } return $what; } sub filter { s/\b4\b/5/g, s/\b(four)\b/samecase("five",$1)/ieg for @_; } sub WRITE { my @x = @_; filter($x[1]); Tie::StdHandle::WRITE(@x); } tie *STDOUT, 'Date::Year1984', '>&STDOUT'; tie *STDERR, 'Date::Year1984', '>&STDERR'; $SIG{__DIE__} = sub { local @_ = @_; &filter; die(@_); }; $SIG{__WARN__}= sub { local @_ = @_; &filter; warn(@_) }; } # end of BEGIN{} package main; print "2 + 2 = 4.\n"; warn "2 + 2 = 4 not 5!\n"; die "saying two and two makes FOUR! (I love Big Brother!)\n";

No comment.

Search Results
Log In?

What's my password?
Create A New User
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2018-07-21 02:16 GMT
Find Nodes?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

    Results (443 votes). Check out past polls.