shift;
$str =~ s/$eol/\n/gs;
return $str;
}
=head1 FAQ
=over 4
=item Why not use YAML/JSON/XML?
There are times when you have existing INI files you need to maintain backward
compatibilit
for talking to restful web services
use strict;
use warnings;
use LWP::UserAgent;
use URI;
use JSON::XS;
use HTTP::Request;
use HTTP::Headers;
use File::Path qw( mkpath );
use REST::Consumer::Reque
file_path {
my ($uri) = @_;
my $cache_filename = $uri->host . '-' . $uri->port . $uri->path . '.json';
# $cache_filename =~ s/\//-/g;
my ($dir, $filename) = $cache_filename =~ /(.*)\/([^\/]*)/i;
r
e "Couldn't open config file '$path': $!";
my $data = <$config_fh>;
my $decoded_data = JSON::XS::decode_json($data);
close $config_fh;
return $decoded_data;
}
sub write_config_to_file {
my ($ur
ader('Content-Type');
if ($content_type && $content_type =~ m|.+/json|) {
eval {
$self->{parsed_response} = JSON::XS::decode_json($self->response->decoded_content() );
$self->{response_parsea
an error. e.g. if content is empty or is just a string
$self->debug(sprintf("failed to parse json response: %s\n%s\n",
$self->{response_body},
$@,
));
$self->{response_parseable} =
= '0.001';
}
use MooseX::App::Command;
use 5.010;
use POSIX qw(strftime);
use HTTP::Request;
use JSON;
use TryCatch;
use WebService::Amazon::Glacier::GlacierError;
extends qw(WebService::Amazon::Glac
s';
use namespace::autoclean;
has 'format' => ( is => 'ro', isa => 'Str', default => 'JSON' );
has 'format_args' => ( is => 'ro', isa => 'HashRef', default => sub { {} } );
has 'engi
# default
engine_args => { password => read_password('Pass: ') },
format => 'JSON', # default
);
my %data = $collector->collect;
...
Data::Collector uses I<Info>s to
ill actually be a module
to push all the changes you want in a database you have.
The default is JSON.
=head2 format_args(HashRef)
Much like I<engine_args>, you can supply any additional arguments
equest failed';
my $res_params = Net::OAuth2::Profile::WebServer::_parse_json($res->content)
or die 'parse_json for refresh_token response failed';
$self->access_token($res_params);
}
res->as_string;
my $res_params = Net::OAuth2::Profile::WebServer::_parse_json($res->content)
or die 'parse_json for userinfo response failed';
return $res_params;
}
sub sign_request
{ meta_noindex => 1 }
],
qw(
MinimumPerl
MetaConfig
MetaYAML
MetaJSON
),
# Make sure we use a sane version of Test::More, always
[ Prereqs => 'TestMoreW
[MetaYAML] ; include META.yml (v1.4) (dzil core [@Basic])
[MetaJSON] ; include META.json (v2) (more info than META.yml)
[Prereqs / TestRequires]
Test::More = 0.96
::Sentry::Client;
use strict;
use warnings;
use HTTP::Request::Common;
use LWP::UserAgent;
use JSON ();
use Data::UUID::MT ();
use MIME::Base64 'encode_base64';
use Compress::Zlib;
use Time::HiRes
( $uri, %header, Content => $message );
return $request;
}
# From outside message, we make a json message for server.
sub _getMessage {
my ( $self, $params ) = @_;
my $data = {
arams->{traceback}||undef,
};
my $json = JSON->new->utf8(1)->pretty(1)->allow_nonref(1)->encode( $data );
return encode_base64(compress( $json ));
}
# Make signature which is require
= '0.001';
}
use MooseX::App::Command;
use 5.010;
use POSIX qw(strftime);
use HTTP::Request;
use JSON;
use TryCatch;
use WebService::Amazon::Glacier::GlacierError;
extends qw(WebService::Amazon::Glac
use System::Introspector::Gatherer;
use Object::Remote::Future qw( await_all );
use JSON::Diffable qw( encode_json );
has config => (is => 'ro', required => 1);
has root => (is => 'ro', required =>
my @files;
for my $class (sort keys %$gathered) {
my $file = sprintf '%s.json', join '/',
map lc, map {
s{([a-z0-9])([A-Z])}{${1}_${2}}g;
storage->file($file);
$self->_log("Writing $full_path");
print $fh encode_json($gathered->{$class});
push @files, $full_path;
}
$self->_cleanup($sto
= '0.001';
}
use MooseX::App::Command;
use 5.010;
use POSIX qw(strftime);
use HTTP::Request;
use JSON;
use TryCatch;
use WebService::Amazon::Glacier::GlacierError;
use Net::Amazon::SignatureVersion4;
$response=$self->_submit_request($hr);
if ($response->is_success) {
my $vault_list = decode_json($response->decoded_content());
foreach my $vault(@{$vault_list->{'VaultList'}}){
push @rv,
$response=$self->_submit_request($hr);
if ($response->is_success) {
my $vault_list = decode_json($response->decoded_content());
foreach my $vault(@{$vault_list->{'VaultList'}}){
push @rv,
Perl itself.
package Authen::SASL::Perl::OAUTHBEARER 2.1900;
use strict;
use vars qw(@ISA);
use JSON::PP;
@ISA = qw(Authen::SASL::Perl);
my %secflags = (
noanonymous => 1,
);
sub _order {
n $auth_string;
}
sub client_step {
my ($self, $challenge) = @_;
my $json = JSON::PP->new;
my $payload = $json->decode( $challenge );
$self->set_error( $payload );
# Send dummy re
t of probes
on the remote system that gather specific information. Gathered results
are stored in JSON format.
=head1 AUTHOR
phaylon - Robert Sedlacek (cpan:PHAYLON) <r.sedlacek@shadowcat.co.uk>
=
ddress
Exception::Class
HTML::Entities
HTML::Tagset
HTML::Template
Iterator
Iterator::Util
JSON
Locale::Maketext::Lexicon
Mail::Sender
Net::IP
Net::LDAPS
PadWalker
PHP::Serialization
Pod
-doit has a built-in API based on JSON-RPC. To call this API set its URL:
Set($IDoitURL, 'http://example.org/i-doit/');
Set($IDoitAPI, $IDoitURL . '?api=jsonrpc');
Set($IDoitUser, 'admi
by setting
C<$l_url> to the URL of i-doit's API, e. g.
C<http://example.org/i-doit/index.php?api=jsonrpc>. In RT's site configuration
C<$IDoitAPI> has to be set to this script, e. g.
C<http://rt.exam
apcli - SOAP client for CLI with YAML and JSON input
=head1 SYNOPSIS
B<soapcli>
S<[--verbose|-v]>
S<[--dump-xml-request|-x]>
data.yml|data.json|{string:"JSON"}|-
[webservice.wsdl|webservice_wsdl.url
SOAP client which accepts YAML or JSON document as
an input data.
The first argument is a request data as a JSON string or a name of file which
contains data in JSON or YAML format.
The second argum
= '0.001';
}
use MooseX::App::Command;
use 5.010;
use POSIX qw(strftime);
use HTTP::Request;
use JSON;
use TryCatch;
use WebService::Amazon::Glacier::GlacierError;
extends qw(WebService::Amazon::Glac
Completed()){
push @{$request->{'Events'}}, 'InventoryRetrievalCompleted';
}
say(encode_json($request));
my $hr=HTTP::Request->new('PUT',"https://glacier.".$self->get_region().".ama
me(time())) ,
'x-amz-glacier-version', '2012-06-01',
]);
$hr->content(encode_json($request));
my $response=$self->_submit_request($hr);
if ($response->is_success) {
ret
bin/perl -c
package App::soapcli;
=head1 NAME
App::soapcli - SOAP client for CLI with YAML and JSON input
=head1 SYNOPSIS
my $app = App::soapcli->new(argv => [qw( calculator.yml calculator.url
::Tiny ();
use YAML::Syck ();
use YAML::XS ();
use JSON::PP ();
=head1 ATTRIBUTES
=over
=item argv : ArrayRef
Arguments list with o
self->{extra_argv}->[2];
my $request = do {
if ($arg_request =~ /^{/) {
JSON::PP->new->utf8->relaxed->allow_barekey->decode($arg_request);
}
elsif ($arg_reque
ory';
return $obj;
}
sub show{
my $self = shift;
return $self->render(status => 405, json => {message => 'You can only see your own categories!!!'} )
if ( !defined $self->param('id')
urn $self->render_json( $result );
}
=head update
sample of overriding a default update method
=cut
sub update{
my $self = shift;
return $self->render(status => 405, json => {message => 'Y
};
}
return $self->render_not_found() if scalar @$result == 0 ;
return $self->render_json( $result );
}
1;
__END__
=pod
=head1 NAME
ExpenseTracker::Controllers::Category - Controll
;
my $client = Net::HTTP::Spore->new_from_string($self->spec );
$client->enable( 'Format::JSON' );
$client;
}
sub _build_spec
{
my $factual_spec =
'{
"base_url" : "http://a
"subject_key"
]
},
"api_format" : [
"json"
],
"documentation" : "This method either suggests corrections for sing
"include_schema"
]
},
"api_format" : [
"json"
],
"documentation" : "The read method enables you to read either a sin