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

This node falls below the community's minimum standard of quality and will not be displayed.
  • Comment on Re^3: perl script works at command but job does not work

Replies are listed 'Best First'.
Re^4: perl script works at command but job does not work
by tirwhan (Abbot) on Nov 15, 2006 at 15:40 UTC

    1. I was replying to jonadabs node here, not you, and pointing out that he was incorrectly checking the return value of system.
    2. I did try to help despite the lack of information in your OP by pointing out that it may be a PATH issue (which does not appear to be the case looking at the code you posted in a reply)
    3. If you go onto a technical online forum and post the equivalent of "I don't know what's going on but I won't give enough information for anyone to find out, please help" and can't take the extremely gentle sarcasm that was returned alongside genuinely helpful comments here, then I posit you have a lot lof learning to do concerning interaction with people.


    All dogma is stupid.
Re^4: perl script works at command but job does not work
by davorg (Chancellor) on Nov 15, 2006 at 15:43 UTC
    I have already tried this command and it failed with a code of 256

    Then maybe you should be looking at the documentation for the command to find out what makes it return a value of 1 (1 because the return value from system needs to be shifted right by 8 bits - as you'll know from reading the documentation).

    --
    <http://dave.org.uk>

    "The first rule of Perl club is you do not talk about Perl club."
    -- Chip Salzenberg

Re: perl script works at command but job does not work
by jonadab (Parson) on Nov 15, 2006 at 16:17 UTC
    We were trying to help. Really.
    I don't need the sarcasm because, as you can see, I am having enough trouble and stress.

    However, we (at least, most of us) can't help you very well with the stress aspect of things. We're a bunch of computer geeks and programmers and so forth, and we can only help really with the more technical issues. I know Perl, but I don't know very much about stress. People have tried to explain to me what stress is, but I don't really understand it.

    I have already tried this command and it failed with a code of 256

    But we didn't know that (until now), because you didn't tell us. And plenty of people, especially those who are new here, don't think to try it. So it was in fact a good suggestion, if not for the fact that, unbeknownst to us, you'd already tried it. We're programmers, not mind readers.

    The unfortunate thing is that your system command contains four commands chained together. I think I understand the reason why it needs to be that way, because you don't want the later commands running if the earlier ones fail, but it doesn't help us isolate which one of the four commands is the one failing. (Is there some other reason, or is it just that?)

    Actually, though, wouldn't it be possible to move the logic that doesn't do the next command unless the previous one succeeds out of the system command itself and into the Perl code? That would let you report an error message on failure that would say _which_ command failed...

    system $changedrive && die "changedrive command ('$changedrive') fa +iled: $!"; system $changedir && die "changedir command ('$changedir') failed: +$!"; system $binenv && die "binenv command ('$binenv') failed: $!"; system $doupdate && die "doupdate command ('$doupdate') failed: $!" +;

    Then we could get down to figuring out _why_ it's failing, once we know _what_, exactly, is failing...


    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.