Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

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)'.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://706683]
[stevieb]: debugged my first very low-level C memory issue within a shared library with gdb so I did :D
[stevieb]: problem was in my code, but through the debugger I figured out what was actually happening, and why. Pretty straight forward after a few hours of reading and testing

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2017-06-25 18:29 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (568 votes). Check out past polls.