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

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
[FloydATC]: perl -MCPAN and the cpan command uses
[FloydATC]: I was able to download and install what I needed manually, that's not the issue
[choroba]: So o conf urllist

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2018-01-24 08:18 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (256 votes). Check out past polls.