Subject: | Bug in Win32::Internet::FTP subroutine when using a parameter hash. |
Date: | Tue, 26 May 2009 16:15:15 -0400 |
To: | <bug-Win32-Internet [...] rt.cpan.org> |
From: | "Mike Earley" <Mike.Earley [...] newriver.com> |
This works:
%<--------------------------------------------
use Win32::Internet;
my $internet = new Win32::Internet();
my $ftp;
print "result = ", $internet->FTP($ftp, "ftp.myhost.com", "myname",
"mypassword" );
------------------------------------------>%
This doesn't:
%<--------------------------------------------
use Win32::Internet;
my $internet = new Win32::Internet();
my $ftp;
my $hash = {
"server" => "ftp.myhost.com",
"username" => "myname",
"password" => "mypassword",
};
print "result = ", $internet->FTP( $ftp, $hash ), "\n";
------------------------------------------>%
The code that interprets the hash is this:
if(ref($server) and ref($server) eq "HASH") {
$port = $server->{'port'};
$username = $server->{'username'};
$password = $password->{'host'};
my $myserver = $server->{'server'};
$pasv = $server->{'pasv'};
$context = $server->{'context'};
undef $server;
$server = $myserver;
}
What is the $password->{'host'} doing there? When I run this through
the debugger $password is undef as expected. Shouldn't the line be:
$password = $server->{'password'};
If the password assignment is correct could you tell me how to set the
password in a hash reference so that the call might work?
Thanks.
Mike Earley
mearley@newriver.com