Hi All,

This is a small LWP utility I wrote:
It works fine using Windows, but it doesn't work when I try to download a
file into unix, does anyone knows what I did wrong?
Thanks
Chanan

use LWP 5.64;
&download_plugin('check_snmp', 'admin', 'admin', '192.168.111.9');

sub download_plugin
{
    my ($lv_plugin, $lv_user, $lv_pass, $lv_host, $lv_path, $lv_port) = @_;
        
        $lv_port = 80 unless ($lv_port);
        $lv_path = '/docs/' unless ($lv_path);

        $lv_host .= ":" . $lv_port unless ($lv_host =~ /:/); 
        print $lv_host;
        exit;
        
    my $lv_browser = LWP::UserAgent->new;
    $lv_browser->credentials(
                  $lv_host,
          'Monitor Server',
                  $lv_user => $lv_pass
    );
    my $lv_url = "http://$lv_{host}$lv_{path}/$lv_plugin";;
   
    my $lv_response = $lv_browser->get($lv_url);
    open FILE, ">$lv_plugin";
    binmode(FILE);
    if ($lv_response->is_success) 
    {
      print FILE $lv_response->content;  # or whatever
    }
    else {
       die $lv_response->status_line;
    }
    close FILE;
}

_______________________________________________
Perl mailing list
[email protected]
http://perl.org.il/mailman/listinfo/perl

Reply via email to