in reply to Re: perl script works at command but job does not work
in thread perl script works at command but job does not work

You mean

system($command, @args) == 0 or die "System call to $command failed: $!"

,right ;-)? ( perldoc -f system )

Update: This was in response to the original content of jonadab's node, which has since been changed. Thanks to blazar for pointing this out.

All dogma is stupid.

Replies are listed 'Best First'.
Re: perl script works at command but job does not work
by jonadab (Parson) on Nov 15, 2006 at 16:32 UTC

    Yes (well, sort of, close enough), thanks for catching that. I don't use system very often (mostly because I want my code to run on different platforms without modification) and had forgotten that its return value is backwards. (I understand why it's backwards, I'd just forgotten to take that into account.)


    Sanity? Oh, yeah, I've got all kinds of sanity. In fact, I've developed whole new kinds of sanity. You can just call me "Mister Sanity". Why, I've got so much sanity it's driving me crazy.
Re^3: perl script works at command but job does not work
by blazar (Canon) on Nov 16, 2006 at 15:00 UTC
    You mean
    system($command, @args) == 0 or die "System call to $command failed: $!"

    Well, I agree that $something && die whatever() is not the same thing as $something == 0 or die whatever(), but they're close enough, and after all the former seems well suited for the current situation.

    Whatever, it could be interesting, and relevant, to inspect $? and the return value itself as well. Of course, it's all in the docs, which explain the whole lot far better than I ever could.

    Update: hadn't noticed jonadab's update. tirwhan, don't worry it's just my fault. The current system is fine enough provided that updates are duly signaled.

      You're totally right of course, but jonadab originally wrote "system($command, @args) or die...", and he changed his node after I wrote my post (and says so here). It's times like these I really wish PM had a "view edit history" feature, because I see no way to resolve this situation in such a way that it's totally clear to future readers ;-). But I'll update my node to try.


      All dogma is stupid.
A reply falls below the community's threshold of quality. You may see it by logging in.