Perl Module

Hi,
Please help me!!
Im wondering if anyone can help me with a problem i have with some perl modules.
My problem is:
I'm trying to connect remote host to a unix box from a windows machine. So i'm developing an application to do this.
I'm programming it in perl with tcl/tk Gui interface.
I'm having some trouble with the modules. Firstly i realize there are 2 ways to connect to the unix box. SSH1 and SSH2. I'm having trouble connecting both ways.
For a SSH1 connection i need to install the module Math-GMP?
And for SSH2 connection i need to install the module Math-Pari?
When i try to connect with SSH1, i get the error:
Can't locate Math/GMP.pm in @INC (@INC contains:
And with SSH2 i get:
Can't locate Math/Pari.pm
For SSH2, i downloaded the pari-2.3.4.tar.gz, extracted to C:\
Then in Math-Pari, within the Makefile.pl i pointed to
$paridir = "c:/pari-2.1.7";
But i still get an error here. The SSH2 way of connecting seems overcomplicated.
So i went back to SSH1, but i cannot find the location of GMP that works with SSH1.
I went to a website gmplib.org
and i downloaded gmp-4.2.4.tar.bz2, But i don't know how to install this on windows. I don't think i can.
ppm will not work for me. I'm using Perl Version : v5.10.0
So as you can see, i'm stuck, can anyone please assist me on what i should do next.
Thank you,
Philip

Why doesn't PPM work for you (I assume you mean the manager shipped with ActivePerl)? And why don't you try Net::SSH or Net::SSH::Perl?

When i start ppm in dos, it takes a while before i have control over it as it Synchronizing with the database. I only see the packages i have in my list. i get the following error.

 Synchronizing Database ...
  Downloading ActiveState Package Repository packlist ... failed 500 Can't connect to ppm4.activestate.com:80 (connect: timeout)

I'm then not able to install any packages. I also have my firewall turned off.

I have downloaded NET::SSH and NET::SSH::PERL,
and installed them using nmake in windows.
But they require to have the pari installed or gmp installed.
SSH1 uses the following NET::SSH:PERL:SSH1
I have also tried that.

Additionally,
ppm seems to only have the packages i have installed, i don't know if this is true. I only think so because it does not allow me to install any of the packages in its list.

That's strange. Might there be something else blocking access to the site (company firewall/proxy maybe)?

PPM usually starts with the list of installed modules. To change to a list of all modules, press Ctrl+1 or the leftmost button on the bar or go via the menu View->All Packages. If that still doesn't work, you could try installing the modules via the CPAN.pm module, which takes care of dependencies and correct installation paths.

C:\Perl\> perl -MCPAN -e shell

hmm, well, its not the firewall, because i turned it off, but i do think its a proxy.
I've also tried with CPAN.pm in Dos, but again this has connection problems, it just hangs as it tries to fetch results.
How can i allow Dos to accept the proxy im using....

You can configure PPM for proxies, see the help files.

Ok guys, Thanks for your help, ppm seems to be working now, will check more out tomorrow. pludi thanks alot for your help, and Kevin too.

A few more things, I need to install Math-BigInt-GMP, its not located on ppm. I went to CPAN and downloaded Math-BigInt-GMP-1.24, went to dos and ran "perl Makefile.pl".
I'm getting errors

Set up gcc environment - 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)
Note (probably harmless): No library found for -lgmp
Note (probably harmless): No library found for -lkernel32
Note (probably harmless): No library found for -luser32
Note (probably harmless): No library found for -lgdi32
Note (probably harmless): No library found for -lwinspool
Note (probably harmless): No library found for -lcomdlg32
Note (probably harmless): No library found for -ladvapi32
Note (probably harmless): No library found for -lshell32
Note (probably harmless): No library found for -lole32
Note (probably harmless): No library found for -loleaut32
Note (probably harmless): No library found for -lnetapi32
Note (probably harmless): No library found for -luuid
Note (probably harmless): No library found for -lws2_32
Note (probably harmless): No library found for -lmpr
Note (probably harmless): No library found for -lwinmm
Note (probably harmless): No library found for -lversion
Note (probably harmless): No library found for -lodbc32
Note (probably harmless): No library found for -lodbccp32
Note (probably harmless): No library found for -lmsvcrt
YAML not installed, make dist will not override metafile at Makefile.pl line 20.

Writing Makefile for Math::BigInt::GMP

Then when i run the the command "nmake", i get the following:

Microsoft (R) Program Maintenance Utility   Version 1.50
Copyright (c) Microsoft Corp 1988-94. All rights reserved.

cp lib/Math/BigInt/GMP.pm blib\lib\Math\BigInt\GMP.pm
        C:\Perl\bin\perl.exe C:\Perl\lib\ExtUtils\xsubpp  -typemap C:\Perl\lib\E
xtUtils\typemap -typemap typemap  GMP.xs > GMP.xsc && C:\Perl\bin\perl.exe -MExt
Utils::Command -e mv GMP.xsc GMP.c
        gcc -c    -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES_FCRYPT -DUS
E_SITECUSTOMIZE -DPRIVLIB_LAST_IN_INC -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SY
S -DUSE_PERLIO -DPERL_MSVCRT_READFIX -DHASATTRIBUTE -fno-strict-aliasing -mms-bi
tfields -O2    -DVERSION=\"1.24\"  -DXS_VERSION=\"1.24\"  "-IC:\Perl\lib\CORE"
 GMP.c
gcc: no input files
NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return code '0x1'
Stop.

Whats going on here?

Also,
In CPAN
i ran the following

perl -MCPAN -e "install Crypt::Random"

And i recieved the following error:

Set up gcc environment - 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)
Going to read C:\Perl\cpan\Metadata
Warning: Found only 0 objects in C:\Perl\cpan\Metadata
Fetching with LWP:
  http://ppm.activestate.com/CPAN/authors/01mailrc.txt.gz
LWP failed with code[501] message[Protocol scheme '>>My Proxy setting here<<' is
 not supported]
Fetching with LWP:
  http://cpan.perl.org/authors/01mailrc.txt.gz
LWP failed with code[501] message[Protocol scheme '>>My Proxy setting here<<' is
 not supported]
No external ftp command available


I would like to connect to one of the following sites to get 'authors/01mailrc.t
xt.gz':

Can someone help me on installing Math::BigInt::GMP.

Thanks,
Philip.

Ok, an update here again. I added

http://cpan.uwinnipeg.ca/PPMPackages/10xx/

onto ppm repository and it loaded the modules i needed, Math-Pari, GMP, etc....

But now when i goto run my perl script, i'm recieving this error.

The getpwuid function is unimplemented at C:/Perl/site/lib/Net/SSH/Perl/SSH2.pm
line 39, <GEN0> line 1.

How can i fix this?

Thanks,
Philip.

UPDATE::

I've installed Modules,

Net-SSH2
Net-SSH-Perl
NET-SSH

now i receive the following error:

The getpwuid function is unimplemented at C:/Perl/site/lib/Net/SSH/Perl.pm line
110.

Thanks.

Please, can someone help me??

The short of it is that the system you are running the script on does not support getpwuid. I don't know what you can do about it though.

My system is Windows XP, surly i can run a connection script to a unix box on that.

I'm having these errors now, with these scripts, maybe this will help in me getting an answe. I'm using this script to create a connection.

use Net::SSH::Perl::SSH1 ;

$scon = Net::SSH::Perl->new ("com123.mynetwork.mydomain.com");
$scon->login("user123","pass123");
print "looking around ...\n";
($output,$errors,$exit) = $scon->cmd("ls -l");
print $output;

With this error:

Can't set socket non-blocking: Bad file descriptor at C:/Perl/site/lib/Net/SSH/P
erl.pm line 217.

Another Example:

#!/opt/local/bin/perl
#
# checkDiskspace.pl: See if any partitions are greater than a percentage and notify
#
use strict;
use warnings;

use Net::SSH::Perl;
use Math::BigInt::GMP;  # Don't forget this!

$| = 1;

my $alert_percent = 75;
my $server = 'com123.mynetwork.mydomain.com';
my $username = 'user123';
my $password = 'pass123';


# However you wanna notify yourself (like email)
sub alert_notify {
    my $message = shift;
    print "STUB: $message\n";
}

# Log into server
print "Creating ssh object... ";
my $ssh = Net::SSH::Perl->new($server); # Error check this
print "done\n";
print "Logging into server... ";
$ssh->login($username, $password); # Error check this
print "done\n";

# Check df
my $command = "df";
print "Running command ($command)... ";
my ($stdout, $stderr, $exit) = $ssh->cmd($command); # Check output
print "done\n";

# Find percentage
foreach my $df_line (split(/\n/, $stdout)) {
    # If disk space usage percent > $alert_percent, notify
    if ($df_line =~ /\s+(\d+)%\s+(\/.*)/ && $1 >= $alert_percent) {
        alert_notify ("[$server] device $2 at $1 percent!");
    }
}

With this error:

Creating ssh object... Can't set socket non-blocking: Bad file descriptor at C:/
Perl/site/lib/Net/SSH/Perl.pm line 217.

Final Example, this time the dos command promt hangs, i'm still waiting to see if anything happens.

use strict;
use warnings;

use Net::SSH::Perl;

my $server = 'alpha12z';
my $user = 'user123';
my $pwd = 'pass123';

my $ssh = Net::SSH::Perl->new($server);

$ssh-> login($user, $pwd);
my ($out, $err, $exit) = $ssh-> cmd("ls");

The Result is that the command prompt hangs, i'm gracefully waiting and hoping for a connection, at this point i will be happy with any connection even a slow one.!!

Just want to say to Mods, my post are for updates on where i am with this problem and are not to bump my posts.

UPDATE:

I commented out the lines

defined($sock->blocking(0))
 or die "Can't set socket non-blocking:  $!";

On "C:\perl\site\net\ssh\perl.pm"

Now the program seems to connect to my server, But its not executing the commands. Is there a way of debugging or seening what's happening here?

Why aren't my commands executing?
Is there a work around for this?

UPDATE:

Using adding the addition on the line

$ssh = Net::SSH::Perl->new("com123.mynetwork.mydomain.com",(protocol=>'2',port=>'22',debug=>'true'));

I can see the following debug information:

channel 1: open confirm rwindow 0 rmax 32768

It seems to freeze on this line, does anyone know whats happening here?

UPDATE 3:

Ok, i have gotten the commands to exectured in the program by sending the output to a file.
Here is the command

($output,$errors,$exit) = $scon->cmd('ls > /tmp/file.out',"\n");

When i use this line the program doesn't hang. If i replace it with

($output, $errors, $exit) = $scon->cmd('ls');

The program hangs!!

Why is this?
Is there a way around this, or will i have to do an ftp to grab the file and read its contents.
Please Help!

There is really no way to know why your program hangs. All anyone could do is make suggestions to try his-or-that, but you actually seem to be doing an excellent job yourself finding answers to your questions. I have lno experience with what you are doing so I have no personal history I can recall and offer salient suggestions, maybe another user will. If not, you can alwyas take this over to perlmonks.com where the users are all perl users and have lots of experience outside of perl as well.