/usr/share/doc/libhttp-tiny-perl/examples/post.pl is in libhttp-tiny-perl 0.070-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | #!/usr/bin/perl
use strict;
use warnings;
use HTTP::Tiny;
use URI::Escape qw/uri_escape_utf8/;
my $url = 'http://search.cpan.org/search';
my %form_data = (
query => 'DAGOLDEN',
mode => 'author',
);
my @params;
while( my @pair = each %form_data ) {
push @params, join("=", map { uri_escape_utf8($_) } @pair);
}
my $response = HTTP::Tiny->new->request('POST', $url, {
content => join("&", @params),
headers => { 'content-type' => 'application/x-www-form-urlencoded' }
});
print "$response->{status} $response->{reason}\n";
print $response->{content};
|