Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Remote web form post

by linuxer (Curate)
on Aug 20, 2011 at 19:00 UTC ( #921436=note: print w/replies, xml ) Need Help??


in reply to Remote web form post

Where do you define and fill $res?

That variable is never defined or filled and therefore is undefined.

Maybe you should consider to use strict and warnings.

Addendum:

I had another look at your script and think, there are more flaws than the one I previously mentioned.

  • $req should contain a HTTP::Request object; so you should create one.
  • POST 'http://...' is missing the correct operator between POST and the URL string
  • $ua->request() returns a response object; you should give the variable a better fitting name than $request.

Replies are listed 'Best First'.
Re^2: Remote web form post
by Anonymous Monk on Aug 21, 2011 at 01:19 UTC

    is missing the correct operator between POST and the URL string

    Sure its not :)

    use DDS; use HTTP::Request::Common qw(POST); Dump( POST 'http://example.com', [ qw' username joe password joe ' ] ) +; __END__ $HTTP_Request1 = bless( { _content => 'username=joe&password=joe', _headers => bless( { "content-length" => 25, "content-type" => 'application/x-ww +w-form-urlencoded' }, 'HTTP::Headers' ), _method => 'POST', _uri => \do { my $v = 'http://example.com' } }, 'HTTP::Request' ); bless( $HTTP_Request1->{_uri}, 'URI::http' );

    I agree with the rest of your words

      Ah, thank you for the hint. I tested with HTTP::Request, which I prefer...

      I thought of POST being a bareword and not an exported function from HTTP::Request::Common.

      Well, now I see, I don't like that style... ;-)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://921436]
help
Chatterbox?
[karlgoethebier]: Discipulus: Perhaps i should add some more of these idiots to my sig?
[karlgoethebier]: Discipulus: There are countries were people get imprisoned for things like this...
[1nickt]: Are there enough bytes for all the idiots you would need to include?
[choroba]: I find it more entertaining to have something clever there
[Discipulus]: ys Karl i know; there are also children who die in mines where precious metals for phones are taken
[Discipulus]: 1nickt for sure no! post has 64k limit..

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (8)
As of 2017-06-22 12:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (519 votes). Check out past polls.