##
#!/usr/bin/perl
use strict;
use warnings;
use LWP::UserAgent;
{
our $USER = "foo";
our $PASS = "bar";
}
my $ua = LWP::UserAgent->new();
my $resp = $ua->post(
"http://localhost:8080/login",
[
DATA => our $USER,
DATA => our $PASS,
]
);
if ($resp->is_success) {
print $resp->decoded_content;
} else {
print $resp->status_line;
}
####
$ ./HTTPserver.pl
Use 'kill 25807' to stop server.
HTTP::Server::Simple: You can connect to your server at http://localhost:8080/
$ ./lwp-test.pl
Info
You sent: user='foo', pass='bar'