Beefy Boxes and Bandwidth Generously Provided by pair Networks Ovid
No such thing as a small change
 
PerlMonks  

Re: Re: system & shell metacharacters

by snax (Hermit)
on Jul 22, 2003 at 20:46 UTC ( [id://276980]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re: system & shell metacharacters
in thread system & shell metacharacters

I'm with you. I'd use something like
open BAR, '|bar.pl' || die qq(Useful msg: $!); print BAR $xmldata;
and let bar.pl read from STDIN. No shell at all. OP might want a glance at perlipc.

Replies are listed 'Best First'.
Re: Re: Re: system & shell metacharacters
by bunnyman (Hermit) on Jul 23, 2003 at 11:58 UTC
    open BAR, '|bar.pl' || die qq(Useful msg: $!);

    ... is wrong, because it is interpreted as:

    open BAR, ('|bar.pl' || die qq(Useful msg: $!));

    ... so remember to use "or die" rather than "|| die".

      Really? Ya learn something new every day :) I have a great number of scripts to modify, it would seem....
        Using || die is fine as long as parens are used.
        open(FOO, $file) || die "Couldn't open $file - $!\n";

        When no parens are present, you should use or die instead.

        Personally, I always use parens everywhere so my code is littered with || dies.

        -- vek --

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://276980]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.