structures.
=cut
use strict;
use warnings;
use Carp;
use HTTP::Request;
use LWP::UserAgent;
use JSON::Any;
our $VERSION = '0.02';
our $states = { 'ok' => 0, 'warning' => '1', 'critical' => '2', 'u
;
$self->{'_url'} = $self->_get_url();
$self->{'_ua'} = LWP::UserAgent->new;
$self->{'_json'} = JSON::Any->new;
return $self;
}
sub _get_url {
my $self = shift;
return sprintf('%s://%s/
sword'});
my $req = HTTP::Request->new( GET => $url );
$req->header( 'Content-Type' => 'text/json' );
$req->header( 'X-Username' => $self->{'user'} );
$req->header( 'X-Password' => $self->{'p
$fixed_length, $help, $json );
my ( $sfile, $stfile );
my $error = '';
parse_options( $params_array, \$error, \$check, \$file, \$fixed_length,
\$help, \$json );
return <<EOF
ut as fixed length fields
-h, --help prints this help and exits
-j, --json prints output as json
EOF
if ($parser_class) {
eval "require $parser_class";
}
els
ass->new( file => $file_name ); };
return "Parsing error: $@\n" if $@;
return json_dump($cfg) if $json;
my @output = deep_dump( [], $cfg, \@errors );
my $output = ( $check && scalar
uthorization grant
... send token request
# receive token
#
my %params = ... decode from JSON, URI fragment, etc...
my ($error, @token) = $access_scheme->token_accept(%params)
... complai
ear in a successful token or authorization
endpoint response (i.e., prior to being encoded into a JSON structure
or URI fragment on the authorization server, or, equivalently, after
such decoding on t
$pack->root;
my $global_config_patch_json = delete $files->{global_config_patch_json};
my $local_config_patch_json = delete $files->{local_config_patch_json};
debug "storing config files";
hin helper we have json structures
my $serializer = Project::Easy::Config->serializer ('json');
# global config
my $patch = $serializer->parse_string ($global_config_patch_json);
$pack->conf_pat
n
$local_config_patch_json = Project::Easy::Config::string_from_template (
$local_config_patch_json,
$vars
);
$patch = $serializer->parse_string ($local_config_patch_json);
$pack->fixup_path->
# 1. set correct presentation
# 2. remove redirect header
$app->set_presentation ({type => 'json'});
return;
}
sub new {
my $class = shift;
my $self = dclone ($template);
if ($Class::
f ! exists $result->{$col_meta->{field_name}};
}
return {%{$self->{embed}}, %$result};
}
*TO_JSON = \&hash;
*TO_XML = \&hash;
sub embed {
my $self = shift;
my $what = shift;
if (@_ == 1) {
ension,
isInterbase => ($self->is_interbase ? "true" : "false"),
};
return $self->json->encode($query);
}
=head2 get_list_request_parameters(List[Str => Str])
Returns the request par
= shift;
return $self->_sequence_results("gff3");
}
with 'Webservice::InterMine::Role::KnowsJSON';
with 'Webservice::InterMine::Role::Listable';
no Moose;
__PACKAGE__->meta->make_immutable();
content output";
# fix for "Wide characters to print"
binmode STDOUT, ":utf8";
utf8::decode ($content);
$| = 1;
print $content;
}
sub TO_JSON {
my $self = shift;
return {%$self};
}
1;
TP;
use Digest::HMAC_SHA1 qw(hmac_sha1 hmac_sha1_hex);
use LWP::UserAgent;
use HTTP::Request;
use JSON;
use WWW::DNSMadeEasy::Domain;
our $VERSION ||= '0.0development';
has api_key => (
is => 'ro'
request->header('Accept' => 'application/json');
if (defined $data) {
$request->header('Content-Type' => 'application/json');
$request->content(encode_json($data));
}
my $res = $self->_http_age
nt->request($request);
if ($res->is_success) {
return decode_json($res->content);
} else {
die __PACKAGE__.' HTTP request failed: '.$res->status_line, "\n";
}
}
#
# DOMAINS
#
sub path_domains
fresh retry)],
methods => {
addRR => [qw(name type data ttl?)],
'listRRs:JSON' => [qw(name? type? data?)],
removeRR => [qw(name type data)],
updateSerial =
e:
use PerlX::QuoteOperator::URL 'qh';
use JSON qw(decode_json);
say decode_json( qh{ http://twitter.com/statuses/show/6592721580.json } )->{text};
# => "He nose the truth."
=
ware
# framework that handles all text-related
# information extracted from an EML or XML
# or JSON data file. This allows the VoteFair
# Ranking software to just handle numbers
# (and a few err
Load a JSON package and define our decode_json function:
BEGIN
{
if (_eval "use JSON::XS ()") {
# Can't find JSON::XS, try JSON (2.0 or later):
_eval_or_die "use JSON qw(decode_json)";
}
if ($JSON::XS::VERSION >= 2) {
*decode_json = \&JSON::XS::decode_json;
} else {
*decode_json = \&JSON::XS::from_json; # old name for decode_json
} # end else found JSON::XS pri
or to version 2.0
} # end else we were able to load JSON::XS
} # end BEGIN
#=====================================================================
# Define exceptions:
use Exception::Class (
'Web
=======
BEGIN {
__PACKAGE__->_define(
type => 'email',
methods => {
'listForwards:JSON' => [],
removeForward => [qw(forward)],
setForward => [qw(forward dest_email)],
$self;
}
sub render
{
my ( $self, $data ) = @_;
if ($self->{'format'} eq 'JSON') {
TRACE ( "Rendering to JSON" );
DUMP ( $data );
return Data::JavaScript::Anon->anon_dump ( $data )
late
{
return 0;
}
sub available_formats
{
return [ "JavaScript::Anon", "Javascript::Anon", "JSON" ];
}
sub TRACE {}
sub DUMP {}
1;
=head1 NAME
Any::Renderer::JavaScript::Anon - renders anony
JSON
Use the format 'JSON' to return completely anonymous data structures - i.e. with no leading
"var script_output = " and no trailing ";"
perl -MAny::Renderer -e "print Any::Renderer->new('JSON
equires <<_END_
Moose
Xyzzy 1.02
JSON 2
_END_
Is equivalent to:
requires 'Moose' => 0
requires 'Xyzzy' => 1.02
requires 'JSON' => 2
=head2 parse_requires $kind, $documen
===============
BEGIN {
__PACKAGE__->_define(
type => 'member',
ro => [qw(accounts:JSON sites:JSON)],
);
} # end BEGIN
#===================================================================
tmagic.com/
package Net::SMS::TextMagic;
use strict;
use warnings;
our $VERSION = '1.00';
use JSON;
use LWP::UserAgent;
use URI::Escape qw(uri_escape uri_escape_utf8);
use Encode qw(encode decode)
_json = contact_api($class, 'send', %params);
if (defined($r_json)) {
# No errors
my %response = ();
$response{'sent_text'} = $r_json->{'sent_text'};
$response{'parts_count'} = $r_json
->{'parts_count'};
while (my ($id, $number) = each %{$r_json->{"message_id"}} ) {
$response{'message_id'}{$number} = $id;
}
return %response;
}
else {
# Errors, we expect that err
JSON 2 can substitute for JSON::XS:
sub prereq_failures
{
my $self = shift @_;
my $out = $self->SUPER::prereq_failures(@_);
return $out unless $out;
if (my $attrib = $out->{requires}{'JSON
my $message;
eval "use JSON 2 ();";
if (not $@) {
# JSON 2.0 or later is an acceptable replacement for JSON::XS:
delete $out->{requires}{'JSON::XS'};
# Clean out empty
JSON 2.0 or later can substitute for JSON::XS, but its pure-Perl
implementation is slower, and you don't have it installed either.
} # end else we couldn't load JSON 2 either
} # end if JSON
=> 'account',
ro => [qw(balance balanceCash balanceCredit balanceHigh
status:JSON sites:JSON)],
rw => [qw(friendlyName)],
methods => {
addSite => [qw(site)],