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

Re: Re: Problem with tie *STDIN, 'IO::Scalar', \$text;

by Rudif (Hermit)
on Apr 29, 2001 at 19:04 UTC ( #76473=note: print w/replies, xml ) Need Help??

in reply to Re: Problem with tie *STDIN, 'IO::Scalar', \$text;
in thread Problem with tie *STDIN, 'IO::Scalar', \$text;

Hi chromatic

At some other time I will probably follow your advice and learn how to subclass Tie::Handle to solve some specific problem.

At this stage I am raising what to me looks like a general perl programming question:

Some popular perl modules export subroutines that read text from specified input file(s), defaulting to STDIN, transform the text, and deliver the result to a specified output file, defaulting to STDOUT. This is fine in many applications.

Two subroutines that behave like this, and that I'm interested in right now are
Pod::Html::pod2html Pod::Select::podselect

However, I want to call these subroutines in a context where the input text or output text, or both, are in my script's scalar variables. This lets me do some other processing before calling one of these subroutines, and some more after the call.

I would like to know if other monks have had this of requirement or wish.

While I can easily solve my problems by using temporary files, out of curiosity I started looking for a more perlish solution. Following stephen's advice, I was able to redirect podselect STDOUT into a IO::Scalar tied to a scalar variable (see the first snippet in my post above). However, my attempt to use a similar redirection on STDIN to pod2html failed. I will try to dig deeper to try to understand why does it work when it works, and why not when not.


Log In?

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2020-10-01 02:18 GMT
Find Nodes?
    Voting Booth?
    If at first I donít succeed, I Ö

    Results (172 votes). Check out past polls.