Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

wog's scratchpad

by wog (Curate)
on Jun 01, 2004 at 20:55 UTC ( #358592=scratchpad: 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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2015-11-29 06:14 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (747 votes), past polls