Bundle-WATERKIP
view release on metacpan or search on metacpan
bin/opnpost view on Meta::CPAN
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;
push(@options, 'wrap-soap');
push(@options, 'soap-version=s');
push(@options, 'soap-action=s');
}
elsif ($script_name eq 'opnjson') {
$options{'content-type'} = 'application/json';
}
{
local $SIG{__WARN__} = sub { die shift };
my $ok = eval { GetOptions(\%options, @options) };
if (!$ok) {
die($@);
}
}
bin/opnpost view on Meta::CPAN
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) {
if ($options{v}) {
( run in 2.167 seconds using v1.01-cache-2.11-cpan-524268b4103 )