system call question

Ask a Question related to PERL Miscellaneous, Design and Development.

  1. #1

    Default system call question

    If I call an external program like so:
    system("$bfish") or warn ("$!");
    # Everything is ok

    But when I pass parameters like so:
    system("$bfish","/E","/I:$file","/O:$file.fish","/Q","/P:$bfishpwd") or
    warn("$!");
    # I get the "Warning: Something's wrong ....", but it still works.

    If I use die instead of warn, the program obviously dies.
    So can someone tell me what's going on?

    I get a warning, but it still works.
    Am I passing parameters the wrong way?

    I'm running WinXP pro.

    Thanks.


    J. Smith Guest

  2. Similar Questions and Discussions

    1. Some 'System Calls' was Capturing system call output value
      On Friday, Nov 14, 2003, at 18:39 US/Pacific, Jerry Rocteur wrote: Wiggins is the one who deserves the point, since he was the one with the...
    2. system call
      Hi- Can someone please tell me how do I modify following line so that the result gets stored in the var. $count = system("$command...
    3. Call System level DLL from ASP
      I posted this on 24th of September and did not get any reply. So I am trying it again - If anybody has any links related to any info, that will be...
    4. Net::Server and system call
      Hi, I'm trying to use Perl module "Net::Server" This module is quiet easy to use, it is really fast to implement Nevertheless i've got a problem...
    5. timing out a system call
      Hi folks, I'm writing my first actual useful perl scripts and I've run into the following problem - I'm using the "system" function to run a...
  3. #2

    Default Re: system call question

    J. Smith <noemailplease@defunked.net> wrote:
    > system("$bfish") or warn ("$!");
    ^ ^ ^ ^
    ^ ^ ^ ^

    perldoc -q vars

    What's wrong with always quoting "$vars"?


    system($bfish) or warn($!);


    --
    Tad McClellan SGML consulting
    [email]tadmc@augustmail.com[/email] Perl programming
    Fort Worth, Texas
    Tad McClellan Guest

  4. #3

    Default Re: system call question

    "J. Smith" <noemailplease@defunked.net> wrote in
    news:vm744i46nl3h6b@corp.supernews.com:
    > If I call an external program like so:
    > system("$bfish") or warn ("$!");
    > # Everything is ok
    >
    > But when I pass parameters like so:
    > system("$bfish","/E","/I:$file","/O:$file.fish","/Q","/P:$bfishpwd") or
    > warn("$!");
    > # I get the "Warning: Something's wrong ....", but it still works.
    That means that the external program is returning a non-zero exit status in
    the second case, but not the first. To find out why, you need to determine
    the exit status you're getting (perldoc -f system will tell you how) and
    then find out what the external program means by it.

    Since system() doesn't set $!, the text of the warning you print is going
    to be meaningless and misleading.

    >
    > If I use die instead of warn, the program obviously dies.
    > So can someone tell me what's going on?
    >
    > I get a warning, but it still works.
    > Am I passing parameters the wrong way?
    >
    > I'm running WinXP pro.
    >
    > Thanks.
    >
    >
    Eric Bohlman Guest

  5. #4

    Default Re: system call question

    On Sat, 13 Sep 2003 16:48:05 -0500, J. Smith <noemailplease@defunked.net> wrote:
    > If I call an external program like so:
    > system("$bfish") or warn ("$!");
    > # Everything is ok
    >
    > But when I pass parameters like so:
    > system("$bfish","/E","/I:$file","/O:$file.fish","/Q","/P:$bfishpwd") or
    > warn("$!");
    > # I get the "Warning: Something's wrong ....", but it still works.
    >
    > If I use die instead of warn, the program obviously dies.
    > So can someone tell me what's going on?
    >
    Read "perldoc -f system", paying close attention to system()'s return
    value. And what's with all the useless quotes? Those things don't
    grow on trees ya know!

    John J. Trammell Guest

  6. #5

    Default Re: system call question

    "J. Smith" wrote:
    >
    > If I call an external program like so:
    > system("$bfish") or warn ("$!");
    > # Everything is ok
    >
    > But when I pass parameters like so:
    > system("$bfish","/E","/I:$file","/O:$file.fish","/Q","/P:$bfishpwd") or
    > warn("$!");
    > # I get the "Warning: Something's wrong ....", but it still works.
    >
    > If I use die instead of warn, the program obviously dies.
    > So can someone tell me what's going on?
    >
    > I get a warning, but it still works.
    > Am I passing parameters the wrong way?
    If you read the documentation for the system function you will see that
    it DOES NOT return true on success and false on failure as you seem to
    assume.

    perldoc -f system


    John
    --
    use Perl;
    program
    fulfillment
    John W. Krahn Guest

  7. #6

    Default Re: system call question


    Thank you Eric.
    All is well now. No more warnings.
    Super!!

    "Eric Bohlman" <ebohlman@earthlink.net> wrote in message
    news:Xns93F5B60D2EA48ebohlmanomsdevcom@130.133.1.4 ...
    > "J. Smith" <noemailplease@defunked.net> wrote in
    > news:vm744i46nl3h6b@corp.supernews.com:
    >
    > > If I call an external program like so:
    > > system("$bfish") or warn ("$!");
    > > # Everything is ok
    > >
    > > But when I pass parameters like so:
    > > system("$bfish","/E","/I:$file","/O:$file.fish","/Q","/P:$bfishpwd") or
    > > warn("$!");
    > > # I get the "Warning: Something's wrong ....", but it still works.
    >
    > That means that the external program is returning a non-zero exit status
    in
    > the second case, but not the first. To find out why, you need to
    determine
    > the exit status you're getting (perldoc -f system will tell you how) and
    > then find out what the external program means by it.
    >
    > Since system() doesn't set $!, the text of the warning you print is going
    > to be meaningless and misleading.
    >
    >
    > >
    > > If I use die instead of warn, the program obviously dies.
    > > So can someone tell me what's going on?
    > >
    > > I get a warning, but it still works.
    > > Am I passing parameters the wrong way?
    > >
    > > I'm running WinXP pro.
    > >
    > > Thanks.
    > >
    > >
    >

    J. Smith Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139