Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re: Perl migration hp-ux -> Linux

by pme (Prior)
on Aug 14, 2015 at 09:12 UTC ( #1138546=note: print w/replies, xml ) Need Help??

in reply to Perl migration hp-ux -> Linux

How does it fail? Could you copy/paste the error message?

Replies are listed 'Best First'.
Re^2: Perl migration hp-ux -> Linux
by vccs (Initiate) on Aug 14, 2015 at 09:49 UTC
    Well that's the issue, the perl program just stops there, no core file, nothing to go on. a sample program:
    #! /usr/local/bin/perl use Oraperl; use DBI; use FileHandle; use rf; use IO::Socket; use IO::Handle;; use POSIX qw(setsid); open STDIN, '>/dev/null' or die "Can't read /dev/null: $!"; print "Step 1\n"; #open STDOUT, '>','/dev/null' or die "Can't write to $prout: $!"; open(STDOUT, '>','/dev/null') or die "Can't write to $prout: $!"; print "Step 2\n"; open STDERR, '>/dev/null' or die "Can't write to $prerr: $!"; #SIG{CHLD} = 'IGNORE'; defined(my $pid = fork) or die "Can't fork: $!"; exit if $pid; setsid or die "Can't start a new session: $!"; #$SIG{CHLD} = 'DEFAULT'; #--------------------------- # Get Environment Variables #--------------------------- $logdir = $ENV{out}; $constr = $ENV{CAAO_CSTR}; $user = $ENV{CAAO_USU}; $pass = $ENV{CAAO_PWD}; print"RUN\n";
    It only prints Step 1 But when the line is commented, it prints Step 1 Step 2 RUN

      If you reopen STDOUT to /dev/null, where do you expect the output of print to go?

      This line
      open(STDOUT, '>','/dev/null') or die "Can't write to $prout: $!";
      redirects STDOUT to /dev/null therefore all 'print' is redirected into /dev/null.

      If stepping through the program in Perl debugger doesn't help, try opening STDOUT/STDERR to some log file ("/tmp/$$.log", for example) or writing a __DIE__ signal handler:

      sub { return unless defined $^S; # bail out if it's a parser error open my $log, ">/tmp/crash@{[time]}_$$.log"; print $log @_; }

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1138546]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2020-01-28 08:20 GMT
Find Nodes?
    Voting Booth?