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

Re^2: Perl migration hp-ux -> Linux

by vccs (Initiate)
on Aug 14, 2015 at 09:49 UTC ( [id://1138552]=note: print w/replies, xml ) Need Help??


in reply to Re: Perl migration hp-ux -> Linux
in thread Perl migration hp-ux -> Linux

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

Replies are listed 'Best First'.
Re^3: Perl migration hp-ux -> Linux
by Corion (Patriarch) on Aug 14, 2015 at 10:12 UTC

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

Re^3: Perl migration hp-ux -> Linux
by pme (Monsignor) on Aug 14, 2015 at 10:20 UTC
    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.
Re^3: Perl migration hp-ux -> Linux
by aitap (Curate) on Aug 14, 2015 at 10:20 UTC

    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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (9)
As of 2024-04-18 11:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found