Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re^2: LWP::USERAGENT - POST through basic authentication

by zantoro (Initiate)
on Oct 11, 2011 at 13:51 UTC ( #930817=note: print w/ replies, xml ) Need Help??

Comment on Re^2: LWP::USERAGENT - POST through basic authentication
Replies are listed 'Best First'.
Re^3: LWP::USERAGENT - POST through basic authentication
by Khen1950fx (Canon) on Oct 12, 2011 at 14:54 UTC

    Where do I put the $args

    You don't. In some of the Net modules, you can use a %args for options, but since this is LWP, there's a slightly different way to do that. For example, in the example that I gave you, I tried to keep it simple, step-by-step. Lets look at another way to do it.

    $req = HTTP::Request->new(POST => $self->{'baseurl'}, $args);

    First, you're missing a shebang line( #!/usr/bin/perl ) and strictures. You also need to declare your variables with my. Another problem is your use of $self->{'baseurl'}---What's that? You didn't declare $self nor $args. Putting it altogether:
    #!/usr/bin/perl use strict; use warnings; use LWP::UserAgent; #using for our $url my $req = HTTP::Request->new(POST => '');
    Note that the url should be absolute; also, I dropped $self->{'baseurl'} and $args because they weren't necessary and didn't do anything. Now you know where to put $args:).

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://930817]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2016-02-13 18:42 GMT
Find Nodes?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?

    Results (442 votes), past polls