lt the log is displayed on the console. Log
types can be one of the following "console", "file", "json" or "syslog".
=head2 --log-facility
What log facility class to use. This follows syslog convent
package WWW::MelbourneBikeShare;
use strict;
use warnings;
use LWP;
use JSON;
use WWW::MelbourneBikeShare::Terminal;
our $VERSION = 0.01;
sub new {
my ( $class, %args ) = @_;
my $self = bless {
LWP::UserAgent->new();
$self->{ __uri } = 'https://data.melbourne.vic.gov.au/resource/qnjw-wgaj.json';
$self->{ __cache }->{ timeout } = $args{ cache } ||= 900;
$self->{ __cache }->{ present } = 0
if ( $r->is_success ) {
$self->{ error } = '';
return from_json( $r->content );
}
else {
$self->{ error } = "Unable to retrieve $
Log::Console>
=item L<XAS::Lib::Log::File|XAS::Lib::Log::File>
=item L<XAS::Lib::Log::Json|XAS::Lib::Log::Json>
=item L<XAS::Lib::Log::Syslog|XAS::Lib::Log::Syslog>
=item L<XAS::Lib::Mixins::Bufop
|XAS::Lib::Process::Win32>
=item L<XAS::Lib::RPC::JSON::Client|XAS::Lib::RPC::JSON::Client>
=item L<XAS::Lib::RPC::JSON::Server|XAS::Lib::RPC::JSON::Server>
=item L<XAS::Lib::Service|XAS::Lib::Serv
Grab;
use YAML::Tiny;
use WWW::Mechanize;
use Crypt::SSLeay;
use Digest::Perl::MD5 'md5_hex';
use JSON;
use error_codes;
sub readConfig {
my $conf = YAML::Tiny->read( 'config.yaml' );
return
} else {
%config = (%config, %timestamp);
};
my @o_formats = ('xml', 'json');
my $request_json; my $request_xml;
foreach my $format (@o_formats) {
$config{return} = $fo
f-8', raw => 1);
$request_json = $request if $format eq 'json';
$request_xml = $request if $format eq 'xml';
};
my $r = from_json($request_json);
my @error;
if ($r->{er
ants
constant => {
# generic
LF => "\012",
CR => "\015",
# JSON RPC
RPC_JSON => '2.0',
RPC_DEFAULT_ADDRESS => '127.0.0.1',
RPC_DEFAULT_PORT
LOG_LEVELS => qr/info|warn|error|fatal|debug|trace/,
LOG_TYPES => qr/console|file|json|syslog/,
LOG_FACILITY => qr/auth|authpriv|cron|daemon|ftp|local[0-7]|lpr|mail|news|user|uuc
LOCK_DRIVERS => qr(Flom|Filesystem|Nolock|KeyedMutex),
},
exports => {
all => 'RPC_JSON RPC_DEFAULT_PORT RPC_DEFAULT_ADDRESS RPC_ERR_PARSE
RPC_ERR_REQ RPC_ERR_METHOD RPC_
Log::Console>
=item L<XAS::Lib::Log::File|XAS::Lib::Log::File>
=item L<XAS::Lib::Log::Json|XAS::Lib::Log::Json>
=item L<XAS::Lib::Log::Syslog|XAS::Lib::Log::Syslog>
=item L<XAS|XAS>
=back
=head1
tion/font-woff' => 'woff',
'application/javascript' => 'js',
'application/json' => 'json',
'application/pdf' => 'pdf',
'application/rss+xml' => 'rss',
my $uri = shift->url;
if ($uri =~ qr{\.(css|png|gif|jpeg|jpg|pdf|js|json)$}i) {
return 1;
}
if ($uri->host eq 'assets
%Y');
}
sub time {
my ($self) = @_;
return $self->{datetime}->strftime('%H:%M:%S');
}
sub TO_JSON {
my ($self) = @_;
return { %{$self} };
}
1;
__END__
=head1 NAME
Travel::Status::DE::URA::
}
## Match for incoming requests with HTTP Accepts: application/json
sub for_json : Path('foo') Accept('application/json') { ... }
=head1 DESCRIPTION
Lets you specify a match for the HTTP
t the 'our_action_json' action to consume this ActionRole. In this
## example GET '/json' would only match if the client request HTTP included
## an Accept: application/json.
__PACKAGE__
action => {
our_action_json => { Path => 'json', Accept => 'application/json' },
});
## GET '/foo' will dispatch to either action 'our_action_json' or action
## 'our_action_ht
$ext;
}
# TODO: Make this configurable from the command line, either by accepting some
# sort of JSON-as-command-line-argument-flag setting, or by having multiple
# attributes that *are* individually
ce;
use lib './modules';
use Attribute::Handlers;
#use strict;
use warnings;
use 5.010;
use JSON::PP;
use Data::Dumper qw(Dumper);
use utf8;
use Encode;
use File::Basename;
use warnings;
=> shift,
# @var string $base_url Base url for log file directory and oxd-rp-setting.json file.
_base_url => dirname(__FILE__)
};
bless $self, $class;
return $self;
}
ome_text);
Send a I<ask> API request. The returned C<$answer> is a hash reference
derived by the JSON decoding of the response body, e.g.:
{
status => 'success',
response => 'Hullo'
_nick);
Send a I<create> API request. The returned C<$answer> is a hash reference
derived by the JSON decoding of the response body, e.g.:
{
status => 'success',
nick => 'NickTheRob
ibutes available
use lib './modules';
use Attribute::Handlers;
use strict;
use warnings;
use JSON::PP;
use OxdPackages::OxdConfig;
use Data::Dumper qw(Dumper);
use utf8;
use Encode;
s
from oxd-server
_data => [],
# @var string $response_json Response data from oxd-server in format json
_response_json=>shift,
# @var object $response_object Response dat
ends the command to the oxd server.
# Args:
# command (dict) - Dict representation of the JSON command string
# @return void
#
sub request{
my ($self) = @_;
# @var array $co
et
# @see OxdClient
# @see OxdConfig
#######################################
use JSON::PP;
package GetAuthorizationUrl;
use OxdPackages::OxdClient;
use base qw(OxdClient Class::Ac
atmandu::Sane;
use LWP::UserAgent;
use JSON;
has query => (is => 'ro', required => 1);
has url => (is => 'ro', default => 'http://vocab.getty.edu/sparql.json');
has lang => (is => 'ro', default =
onse = $self->ua->post($self->url, $form);
if ($response->is_success) {
return decode_json($response->decoded_content);
} else {
Catmandu::HTTPError->throw({
code
t};
our $oxdHostPort;
$oxdHostPort = 'package';
bless $self, $class;
$self->json_read;
return $self;
}
sub setOpHost {
#my ( $self, $op_host,$oxd_host_port,$authorizatio
r_values};
}
sub json_read{
my ($self) = @_;
my $filename = 'oxd-settings.json';
#my $baseUrl = $self->{_base_url};
#print $baseUrl;
my $configOBJECT;
if (open (my $configJSON, $filename)){
;
my $json = JSON::PP->new;
$configOBJECT = $json->decode(<$configJSON>);
if(!$configOBJECT->{authorization_redirect_uri}){
my $defaultOxdSettingsJson = 'oxd-rp-settings-test.json';
i
Blue::VERSION = '0.005';
}
use strict;
use warnings;
use HTTP::Request;
use LWP::UserAgent;
use JSON;
use Data::Dumper;
use IO::Socket::INET;
use URI::Query;
use WebService::SendInBlue::Response;
>is_success;
$self->log($inbox->decoded_content);
sleep(1);
my $inbox_data = decode_json($inbox->decoded_content);
my $inbox_url = $inbox_data->{'base_url'};
my $req = $self->c
items->is_success;
$self->log($items->decoded_content);
my $items_data = decode_json($items->decoded_content);
for my $i (@{$items_data->{'items'}}) {
my %data =
\@ARGV,
});
# Use of JSON serializer
my $logger = Log::UDP::Client->new( serializer_module => 'JSON' );
# Will emit { "message" => "Hi" } because JSON want to wrap stuff into a hash
about them there.
=head1 SEE ALSO
=over 4
=item *
L<Moose>
=item *
L<Storable>
=item *
L<JSON::XS>
=item *
L<IO::Socket::INET>
=back
=for :stopwords cpan testmatrix url annocpan anno bugt
redefine';
my @booleans = (
'JSON::PP::Boolean',
'JSON::XS::Boolean',
'Types::Serialiser::Boolean', # should not be needed
'Mojo::JSON::_Bool', # only up to Mojol
icious 6.21
# Dancer, Dancer2 use JSON
);
sub YAML::Tiny::dumper_for_unknown {
my ($self, $element, $line, $indent, $seen) = @_;
my $type = ref $element;
for my $boolean
1,
default => \&DEFAULT_records,
);
has JSON_decoder => (
is => 'rw',
lazy => 1,
default => sub {
for my $module (qw< JSON JSON::PP >) {
(my $filename = "$module.p
Controller::Root
View::AppKitTT
View::Email
View::Download
View::JSON
View::Excel
Plugins
All the standard ones we use as per their documentation.