On Jan 5, 2004, at 10:49 AM, Paul Kraus wrote:


Code
----
#!/usr/bin/perl

use strict;
use warnings;

&dhcpd;

sub dhcpd {
  use Text::DHCPparse;
  use Net::SCP qw( scp iscp );
  my $scp = Net::SCP -> new( 'hylafax', 'pkraus' );
  $scp -> get ( 'dhcpd.leases' ) or die $scp->{errstr};
  print "hello\n";
}

Error
-----
Use of uninitilazed value in die at C:\Documents and Settings\pdk\My
Documents\perl code\squidlogs\squid.pl line12. Died at C:\... line 12


Ok, there are two things I would think about
doing:

a. check and see if you got the file dkcp.leases
from the host hylafax - and of course a part of the
problem there is whether or not that file would
actually be where you think it is....

b. it is possible that a part of the problem
is actually in how the local implementation
of
  waitpid $pid, 0;
  if ( $? >> 8 ) {
    my $errstr = join('', <$error>);
    #chomp(my $errstr = <$error>);
    $self->{errstr} = $errstr;
    0;
  } else {
    1;
  }

is working on your machine - the way you
would like it to work -
cf:
<http://search.cpan.org/src/IVAN/Net-SCP-0.06/SCP.pm>

check first the get() function
and then into the scp() function.

then play with say:

        $? = 12345;
        my $retval = funk_moi() ; #or die "errorno $?\n";
        print "got back retval $retval\n";
        
        $?= 3 ;
        $retval = funk_moi() ; #or die "errorno $?\n";
        print "got back retval $retval\n";
        
        #------------------------
        #
        sub funk_moi
        {
          if ( $? >> 8 ) {
           print "error case: $?\n";
           0;
          } else {
           print "is ok: $?\n";
           1;
          }
        
        } # end of funk_moi

which generated for me:

error case: 12345
got back retval 0
is ok: 3
got back retval 1

so there are a couple of places where things
could be breaking down in strange and twisted manners.

What did you see when you ran it in the perl debugger?

ciao
drieux

---


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to