Bundle-WATERKIP

 view release on metacpan or  search on metacpan

bin/opnpost  view on Meta::CPAN

use Pod::Usage;
use XML::LibXML;

my $script_name = $FindBin::Script;
my %options = (
    timeout      => 60,
    X            => 'POST',
    'ca-path'    => '/etc/ssl/certs',
);

my @required = qw(content endpoint);
my @options = qw(help endpoint=s content=s content-type=s timeout=i k d v cc=s ca=s ca-path=s X=s man redir=s@ agent=s r);

if ($script_name eq 'opnpost') {
    push(@required, 'content-type');
    push(@options, 'wrap-soap');
    push(@options, 'soap-version=s');
    push(@options, 'soap-action=s');
}
elsif ($script_name eq 'opnsoap') {
    $options{'content-type'} = 'application/xml';
    $options{'soap-version'} = 1.1;

bin/opnpost  view on Meta::CPAN

        $options{cc}
        ? (
            SSL_cert_file => $options{cc},
            SSL_key_file  => $options{cc}
            )
        : ()
    }
);

my $req = HTTP::Request->new(
    $options{X} => $options{endpoint},
    HTTP::Headers->new(
        Content_Type => $options{'content-type'},
        exists $options{'soap-action'} ?
        ( SOAPAction   => sprintf('"%s"', $options{'soap-action'}) ) : (),
    ),
    $content,
);

my $res = $ua->request($req);
if ($res->is_success) {

bin/opnpost  view on Meta::CPAN

=head1 VERSION

version 0.003

=head1 SYNOPSIS

opnpost opnjson opnsoap OPTIONS

=head1 DESCRIPTION

opnpost is a generic useragent that posts data to a particual endpoint.
It is basicly wget or curl, but only for POSTING data.
opnsoap is a client for posting SOAP and opnjson is a client for posting JSON

=head1 NAME

opnpost opnjson opnsoap - A OPN UA poster boy object

=head1 OPTIONS

=over

=item endpoint

The end point you want to talk to. Required

=item content_type

Required when using opnua.

Defaults to C<application/json; charset=UTF-8> for opnjson.
Defaults to C<application/xml; charset=UTF-8> for opnsoap.



( run in 0.266 second using v1.01-cache-2.11-cpan-27979f6cc8f )