Hi -

I would like to pass a string scalar to an involked process
as STDIN; I can do this with IO::File and IO::Socket
classes, but not IO::String. A snippitt (sp?):

    my $fh = new IO::File;
    $fh->open("< something") or die "cannont open post.request";
    open SAVEIN, '<&STDIN';
    open (STDIN,'<&' . $fh->fileno) or die "cannot dup \$fh: $!\n";

    my $output = `perl some-script 2>&1`;
    print "output:\n$output\n";
    print "status: $?\n";

    open STDIN, '<&SAVEIN';
    close $fh;

'some-script' is able to read from STDIN (with the dup - the file
'something') in this case. Peachy.

I get 'cannot dup: Invalid Argument' when trying IO::String as the
source. It seems 'fileno' returns undef for IO::Srting (there is a
note in the docs that fileno for IO::String returns undef for Perl
< 5.6 - I'm using 5.8.0.)

I'm not limiting myself to IO::String - any method of assigning to
STDIN to a string scalar would be OK - I dearly want to avoid the
overhead of doing something silly like writing to a temp file.

Any help or ideas out there?

Aloha => Beau.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to