After successfully establishing a SSH connection I use the following code 
snippet, variations of which have been posted many places.

    my $chan = $ssh2->channel();
    $chan->shell();
    $chan->blocking(0);
    my ($len, $buf);
    $chan->write("ls\n");
    select(undef,undef,undef,0.25);
    print $buf while (($len = $chan->read($buf,512)) > 0);

I get an error message "Use of uninitialized value in numeric gt (>) at 
SFTP_test2.pl line 21" which is the print statement

print $buf while (($len = $chan->read($buf,512)) > 0);

If I turn on debugging ( $ssh->debug(1) ). I get the following output

libssh2_channel_open_ex(ss->session, pv_channel_type, len_channel_type,
window_size, packet_size, ((void *)0) , 0 ) -> 0x1ca3ecc
Net::SSH2::Channel::read(size = 512, ext = 0)
mail
mbox
Network Trash Folder
Private
user
vsite
web
- read 54 bytes
- read -37 bytes
- read 54 total
Net::SSH2::Channel::read(size = 512, ext = 0)
- read -37 bytes
Use of uninitialized value in numeric gt (>) at SFTP_test2.pl line 21.
Net::SSH2::Channel::DESTROY
Net::SSH2::DESTROY object 0x19a4c9c

Lines 3-9 is the 'ls' output I am looking for so I know it is in the 
channel. What is causing the error "Use of uninitialized value in numeric gt 
(>)"  from the statement

print $buf while (($len = $chan->read($buf,512)) > 0);


Thanks
 

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to