in reply to Perl migration hp-ux -> Linux

See perlport, use File::Spec->devnull
  • Comment on Re: Perl migration hp-ux -> Linux ( perlport, File::Spec->devnull )

Replies are listed 'Best First'.
Re^2: Perl migration hp-ux -> Linux ( perlport, File::Spec->devnull )
by vccs (Initiate) on Aug 14, 2015 at 11:03 UTC
    I changed the code to
    use DBI; use FileHandle; use rf; use File::Spec; use IO::Socket; use POSIX qw(setsid); sub get_msg_id_and_type; sub REAP { 1 until (-1 == waitpid(-1, WNOHANG)); $SIG{CHLD} = \&REAP; } $SIG{CHLD} = \&REAP; #$devnull = File::Spec->devnull(); open STDIN, '>/dev/null' || die "Can't read /dev/null: $!"; #open STDOUT, '>/dev/null' || die "Can't write to $prout: $!"; open STDOUT, File::Spec->devnull() || die "Can't write to $prout: $ +!"; open STDERR, '>>/dev/null' || die "Can't write to $prerr: $!"; defined(my $pid = fork) || die "Can't fork: $!"; exit if $pid;
    and it works. Is it because the /dev/null behaviour is different on HP-UX and LINUX?
      Another contributory factor might be that you are opening STDIN for output instead of input i.e. more normal would be:
      open STDIN, '/dev/null' || die "Can't read /dev/null: $!";

      One world, one people