Tue May 26 16:15:43 2009: Request 46382 was acted upon.
Transaction: Ticket created by mike.ear...@newriver.com
       Queue: Win32-Internet
     Subject: Bug in Win32::Internet::FTP subroutine when using a parameter 
hash.
   Broken in: (no value)
    Severity: (no value)
       Owner: Nobody
  Requestors: mike.ear...@newriver.com
      Status: new
 Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=46382 >


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

mear...@newriver.com

 


Reply via email to