Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^3: String Buffer

by ambrus (Abbot)
on Aug 25, 2008 at 13:07 UTC ( #706683=note: print w/ replies, xml ) Need Help??


in reply to Re^2: String Buffer
in thread String Buffer

In fact, that uses a perlio layer silently.

I've been wishing a perlio layer that allows you to simply open a stream that behaives like any tied handle eg.

use StringBuffer; use PerlIO::Tied; # Note: never close one of the three standard handles. It's almost alw +ays a bad idea. open OLDSTDOUT, ">&=STDOUT"; open STDOUT, ">:tied(StringBuffer)"; # I presume extra arguments to ti +e get passed as extra argument to open print STDOUT "this magically gets put to \$stdout\n"; open STDOUT, ">&=OLDSTDOUT"; print STDOUT "this gets put to the original standard output again\n";

This gets even more useful if you want to use a tied io handle from the command line eg. perl -MPerlIO::Tied -we 'some code' ':tied(SomeModule, arguments)'.


Comment on Re^3: String Buffer
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://706683]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (14)
As of 2014-09-18 13:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (115 votes), past polls