On Tue, 7 Sep 2004, West, William M wrote:

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.

#try this: system("echo \'$xml\' | myprogamname") ^^^^^^^^ \---- i haven't tried it, but it should keep the shell from interpolating the xml data

But what happens if the XML has an embedded apostrophe ?

    $ echo '<show>Monty Python's Flying Circus</show>'
    >
    ^C

Or some other magical character ?

    $ echo '<homer>D'oh!</homer>'
    -bash: !: event not found
    $

D'oh!

There's all kinds of edge cases that would have to be dealt with here. I really think that putting the XML directly into a command line is doomed to failure; putting it in a temp file should be much more robust.



--
Chris Devers

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to