"Use of uninitialized value at /develop/release/cmsidev/dev/cr/cds/comms/x2p/pd2x line 130, chunk 1 (#2) (W) An undefined value was used as if it were already defined. It was interpreted as a "" or a 0, but maybe it was a mistake. To suppress this warning assign an initial value to your variables." #### #!/usr/bin/perl -w BEGIN { $CHANGEVAR = $ENV{CRROOTWSDIR}; if ($CHANGEVAR =~ /^([-\/\w.]+)$/) { $MAINPATH = $1; } else { die "Invalid path, please check setenv"; } $LIB = "$MAINPATH/cr/cds/comms/x2p"; } use lib "$LIB"; my $runpath = "$ENV{CRROOTWSDIR}/cr/cds/comms/x2p"; use diagnostics; use strict; use sigtrap; use IO::Select; use IO::Socket::INET; use X2PCONF; $SIG{CHLD} = 'IGNORE'; ### Kill zombie processes immediately. $SIG{PIPE} = 'IGNORE'; ### Ignore RST (reset flag) if there's an error writing to socket. $| = 1; ### Enable Autoflushing of I/O. { my $sock = new IO::Socket::INET ( LocalAddr => $X2PCONF::cdsd_host, LocalPort => $X2PCONF::pd2x_port, Proto => 'tcp', Listen => 5, Reuse => 1, ); die "Could not create socket\n" unless $sock; my $sock_new; my $buffer; CONNECTION: while ($sock_new = $sock->accept()) { if ((my $chldpid = fork ()) != 0) { close ($sock_new); next CONNECTION; } my $buf = ' '; while (defined ($buf = <$sock_new>)) { if ($buf eq "\"ZZZ\"\n") { $buffer .= "\"EOS\""; last; } else { $buffer .= $buf; } } last; } print " $buffer \n"; open(DATA, ">$runpath/pd2x.dat") or die ("error opening pd2x.dat $!\n"); print DATA $buffer; print "$runpath/pd2x.dat \n"; system ("perl $runpath/packets2a.pl"); my $message; my $fname_response = "$runpath/response.dat"; my $check_value = ' '; open FILE1, "< $fname_response" or die "Cannot open datfile: ", $!; while () { $check_value = $_; if ($check_value ne "END") { $message = ($message . $check_value); } else { next; } } close (FILE1); print $sock ($message); print "Response packet $message \n"; close ($sock); } exit (0);