Loading ...
Sorry, an error occurred while loading the content.

RE: [PBML] Problem with return code

Expand Messages
  • GARCIA Lionel
    The return code must be logically shifted: $? 8 $? The status returned by the last pipe close, backtick (``) command, successful call to wait() or perl
    Message 1 of 1 , Sep 26, 2003
    • 0 Attachment
      The return code must be logically shifted: $? >> 8

      $? The status returned by the last pipe close, backtick
      (``) command, successful call to wait() or



      perl v5.8.0 Last change: 2002-07-22 11






      User Contributed Perl Documentation PERLVAR(1)



      waitpid(), or from the system() operator. This is
      just the 16-bit status word returned by the wait()
      system call (or else is made up to look like it).
      Thus, the exit value of the subprocess is really
      ("$? >> 8"), and "$? & 127" gives which signal, if
      any, the process died from, and "$? & 128" reports
      whether there was a core dump. (Mnemonic: similar
      to sh and ksh.)

      Additionally, if the "h_errno" variable is supported
      in C, its value is returned via $? if any
      "gethost*()" function fails.

      If you have installed a signal handler for
      "SIGCHLD", the value of $? will usually be wrong
      outside that handler.

      Inside an "END" subroutine $? contains the value
      that is going to be given to "exit()". You can
      modify $? in an "END" subroutine to change the exit
      status of your program. For example:

      END {
      $? = 1 if $? == 255; # die would make it 255
      }

      Under VMS, the pragma "use vmsish 'status'" makes $?
      reflect the actual VMS exit status, instead of the
      default emulation of POSIX status; see "$?" in
      perlvms for details.

      Also see "Error Indicators".

      > -----Message d'origine-----
      > De : pascalinebestry
      > [mailto:pascaline.bestry@...]
      > Envoyé : vendredi 26 septembre 2003 14:58
      > À : perl-beginner@yahoogroups.com
      > Objet : [PBML] Problem with return code
      >
      >
      > Hello,
      >
      > I have a .bat program with a part in perl.
      >
      > The problem is that I want to retreive an error message from the part
      > in perl to create a file KO or OK in result
      >
      > #!perl
      >
      > perl code
      >
      > __END__
      > :endofperl
      >
      > if not %RETURNCODE% == 0 goto FIN_KO;
      > This line is not working!!!
      >
      > call %PERLDIR%\writeRetour.bat I013prequery0e D
      > goto FIN
      >
      > :FIN_KO
      > call %PERLDIR%\writeRetour.bat I013prequery0e E
      >
      > :FIN
      >
      > Has someone got an idea ???
      >
      > Thanks
      >
      > Pascaline Bestry
      >
      >
      >
      >
      > ------------------------ Yahoo! Groups Sponsor
      > ---------------------~-->
      > Upgrade to 128-Bit SSL Security!
      > http://us.click.yahoo.com/p7cEmB/s7qGAA/yigFAA/ndFolB/TM
      > --------------------------------------------------------------
      > -------~->
      >
      > Unsubscribing info is here:
      > http://help.yahoo.com/help/us/groups/groups-32.html
      >
      > Your use of Yahoo! Groups is subject to
      > http://docs.yahoo.com/info/terms/
      >
      >
      >
      > This mail has originated outside your organization,
      > either from an external partner or the Global Internet.
      > Keep this in mind if you answer this message.
      >


      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.