> On Tue, 7 Sep 2004, Francesco del Vecchio wrote:
>
> > I've got a weird problem using an external program that get the input
> > from "stardard input"
> >
> > I've got to call it (and easily do this with "system('myprogramname')"
> > but I've to feed this program with an XML file that generally is
> > passed via standard input with a "filename | myprogramname" in the
> > shell, but in my case it is in a variable of my perl program
> >
> > How can I do it without write a file on the filesystem?
>
> One way to do this -- probably not a good one -- might be
>
> system("echo $xml | myprogamname")
>
> but if there's anything in the XML that the shell finds interesting,
> this could fail in all kinds of spectacular ways.
>
> Is writing it to a temp file out of the question? It seems like that
> would be a lot more robust, as then you could just do
>
> system("myprogramname < $temp_xml_file")
>
> and you should be much safer from invalid data problems in the shell.
>
>
> --
> Chris Devers
>
Alternatively you should check out the IPC::Open2 and IPC::Open3 (core)
modules to do virtually the same thing only with *a lot* more control.
I believe they will handle exactly what you want.
perldoc IPC::Open2
perldoc IPC::Open3
perldoc perlipc
As last resort you could check out the Expect module. If you are on
Windows, you can try the above, but all bets are off...
HTH,
http://danconia.org
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>