<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: wrong result when executing syscall from a PERL program in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/wrong-result-when-executing-syscall-from-a-perl-program/m-p/3259358#M714922</link>
    <description>Here is a fully functional Perl script, ping.pl, that will do the job for you. If it returns 0, all is well. Invoke as ping.pl -u for full usage.&lt;BR /&gt;&lt;BR /&gt;One thing to note using Net::Ping is that if you use the typicalICMP protocol (the same as the ping command) as a non-root user, the call will fail. Only super-user is allowed to use ICMP. For this reason, the ping program is a setuid program. Ordinary users can use the tcp or udp protocols.&lt;BR /&gt;</description>
    <pubDate>Mon, 26 Apr 2004 11:41:23 GMT</pubDate>
    <dc:creator>A. Clay Stephenson</dc:creator>
    <dc:date>2004-04-26T11:41:23Z</dc:date>
    <item>
      <title>wrong result when executing syscall from a PERL program</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/wrong-result-when-executing-syscall-from-a-perl-program/m-p/3259353#M714917</link>
      <description>Hello colleagues.&lt;BR /&gt;I've written a very simple PERL program.&lt;BR /&gt;The PERL program executes a system call, namely "ping host_j -n 1" to check if the host_j is reachable;&lt;BR /&gt;even if the host_j is reachable the system call returns error -1 ... this happens either by system(ping) or by 'ping' ...&lt;BR /&gt;I check the result by testing $?&lt;BR /&gt;&lt;BR /&gt;thanks&lt;BR /&gt;Enrico</description>
      <pubDate>Mon, 26 Apr 2004 11:14:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/wrong-result-when-executing-syscall-from-a-perl-program/m-p/3259353#M714917</guid>
      <dc:creator>Enrico Venturi</dc:creator>
      <dc:date>2004-04-26T11:14:17Z</dc:date>
    </item>
    <item>
      <title>Re: wrong result when executing syscall from a PERL program</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/wrong-result-when-executing-syscall-from-a-perl-program/m-p/3259354#M714918</link>
      <description>Not sure I understand you correctly but try this&lt;BR /&gt;&lt;BR /&gt;`ping host_j -n i`; &lt;BR /&gt;if(($? &amp;gt;&amp;gt; 8) == 1){ # Exit status of command run by back ticks&lt;BR /&gt; print "Oh dear I punged with no result\";&lt;BR /&gt;}&lt;BR /&gt;</description>
      <pubDate>Mon, 26 Apr 2004 11:24:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/wrong-result-when-executing-syscall-from-a-perl-program/m-p/3259354#M714918</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2004-04-26T11:24:00Z</dc:date>
    </item>
    <item>
      <title>Re: wrong result when executing syscall from a PERL program</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/wrong-result-when-executing-syscall-from-a-perl-program/m-p/3259355#M714919</link>
      <description>why not use Net::Ping ?&lt;BR /&gt;&lt;BR /&gt;-1 might also be 255&lt;BR /&gt;&lt;BR /&gt;# man perlvar&lt;BR /&gt;&lt;BR /&gt;--8&amp;lt;---&lt;BR /&gt;       $CHILD_ERROR&lt;BR /&gt;       $?      The status returned by the last pipe close, backï¿½&lt;BR /&gt;               tick (``) command, successful call to wait() or&lt;BR /&gt;               waitpid(), or from the system() operator.  This is&lt;BR /&gt;               just the 16-bit status word returned by the wait()&lt;BR /&gt;               system call (or else is made up to look like it).&lt;BR /&gt;               Thus, the exit value of the subprocess is really&lt;BR /&gt;               ("$? &amp;gt;&amp;gt; 8"), and "$? &amp;amp; 127" gives which signal, if&lt;BR /&gt;               any, the process died from, and "$? &amp;amp; 128" reports&lt;BR /&gt;               whether there was a core dump.  (Mnemonic: similar&lt;BR /&gt;               to sh and ksh.)&lt;BR /&gt;&lt;BR /&gt;               Additionally, if the "h_errno" variable is supï¿½&lt;BR /&gt;               ported in C, its value is returned via $? if any&lt;BR /&gt;               "gethost*()" function fails.&lt;BR /&gt;&lt;BR /&gt;               If you have installed a signal handler for&lt;BR /&gt;               "SIGCHLD", the value of $? will usually be wrong&lt;BR /&gt;               outside that handler.&lt;BR /&gt;&lt;BR /&gt;               Inside an "END" subroutine $? contains the value&lt;BR /&gt;               that is going to be given to "exit()".  You can&lt;BR /&gt;               modify $? in an "END" subroutine to change the&lt;BR /&gt;               exit status of your program.  For example:&lt;BR /&gt;&lt;BR /&gt;                   END {&lt;BR /&gt;                       $? = 1 if $? == 255;  # die would make it 255&lt;BR /&gt;                   }&lt;BR /&gt;&lt;BR /&gt;               Under VMS, the pragma "use vmsish 'status'" makes&lt;BR /&gt;               $? reflect the actual VMS exit status, instead of&lt;BR /&gt;               the default emulation of POSIX status; see "$?" in&lt;BR /&gt;               perlvms for details.&lt;BR /&gt;--&amp;gt;8---&lt;BR /&gt;&lt;BR /&gt;Attached is a small script that shows fine use of ping to scan the LAN for on-line machines in the segment of the host that's calling it&lt;BR /&gt;&lt;BR /&gt;Enjoy, Have FUN! H.</description>
      <pubDate>Mon, 26 Apr 2004 11:26:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/wrong-result-when-executing-syscall-from-a-perl-program/m-p/3259355#M714919</guid>
      <dc:creator>H.Merijn Brand (procura</dc:creator>
      <dc:date>2004-04-26T11:26:22Z</dc:date>
    </item>
    <item>
      <title>Re: wrong result when executing syscall from a PERL program</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/wrong-result-when-executing-syscall-from-a-perl-program/m-p/3259356#M714920</link>
      <description>Nothing more complicated than:&lt;BR /&gt;&lt;BR /&gt;my $rslt = system("ping host_j - n 1");&lt;BR /&gt;print "Result = ",$rslt,"\n";&lt;BR /&gt;&lt;BR /&gt;should be required but this is a less-than-reliable method. Abount the only thing that you will know is whether or not the hostname can be resolved; this really tells you nothing about actually reaching the remote host because for almost all cases, ping will return 0.&lt;BR /&gt;&lt;BR /&gt;I would use the Net::Ping module so that you can get much more meaning results.&lt;BR /&gt;</description>
      <pubDate>Mon, 26 Apr 2004 11:30:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/wrong-result-when-executing-syscall-from-a-perl-program/m-p/3259356#M714920</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2004-04-26T11:30:13Z</dc:date>
    </item>
    <item>
      <title>Re: wrong result when executing syscall from a PERL program</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/wrong-result-when-executing-syscall-from-a-perl-program/m-p/3259357#M714921</link>
      <description>Nothing more complicated than:&lt;BR /&gt;&lt;BR /&gt;my $rslt = system("ping host_j - n 1");&lt;BR /&gt;print "Result = ",$rslt,"\n";&lt;BR /&gt;&lt;BR /&gt;should be required but this is a less-than-reliable method. About the only thing that you will know is whether or not the hostname can be resolved; this really tells you nothing about actually reaching the remote host because for almost all cases, ping will return 0.&lt;BR /&gt;&lt;BR /&gt;I would use the Net::Ping module so that you can get much more meaning results.&lt;BR /&gt;</description>
      <pubDate>Mon, 26 Apr 2004 11:30:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/wrong-result-when-executing-syscall-from-a-perl-program/m-p/3259357#M714921</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2004-04-26T11:30:15Z</dc:date>
    </item>
    <item>
      <title>Re: wrong result when executing syscall from a PERL program</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/wrong-result-when-executing-syscall-from-a-perl-program/m-p/3259358#M714922</link>
      <description>Here is a fully functional Perl script, ping.pl, that will do the job for you. If it returns 0, all is well. Invoke as ping.pl -u for full usage.&lt;BR /&gt;&lt;BR /&gt;One thing to note using Net::Ping is that if you use the typicalICMP protocol (the same as the ping command) as a non-root user, the call will fail. Only super-user is allowed to use ICMP. For this reason, the ping program is a setuid program. Ordinary users can use the tcp or udp protocols.&lt;BR /&gt;</description>
      <pubDate>Mon, 26 Apr 2004 11:41:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/wrong-result-when-executing-syscall-from-a-perl-program/m-p/3259358#M714922</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2004-04-26T11:41:23Z</dc:date>
    </item>
    <item>
      <title>Re: wrong result when executing syscall from a PERL program</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/wrong-result-when-executing-syscall-from-a-perl-program/m-p/3259359#M714923</link>
      <description>Oops, I'm an idiot. Here's the script:&lt;BR /&gt;&lt;BR /&gt;No points please.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 26 Apr 2004 11:42:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/wrong-result-when-executing-syscall-from-a-perl-program/m-p/3259359#M714923</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2004-04-26T11:42:24Z</dc:date>
    </item>
  </channel>
</rss>

