S => 1999,
TV => 2007,
TH => 2007,
PL => 2002,
RO => 2005,
);
our $MAIN_GAME_FILE = 'BS.json';
our $SECONDARY_GAME_FILE = 'BS.html';
our $REGULAR = 2;
our $PLAYOFF = 3;
our $UNKNOWN_PLAYER
> 2010, source => 'json', descr => 'Event Coordinates' },
location => {season => 1997, source => 'json', descr => 'Game Venue' },
officials => {season => 1923, source => 'json', descr => 'Game
rce => 'json', descr => 'Penalty Box'},
periods => {season => 2010, source => 'json', descr => 'Period data, inconsistent before that' },
severity => { season => 2010, source => 'json', descr
IS_AUTHOR LOG_DIR MAIN_LOG MERGED_FILE MONGO_DB
MONGO_HOST MONGO_PORT NORMALIZED_FILE NORMALIZED_JSON
REDIRECT_STDERR REPORTS_DIR SCRAPED_GAMES SQL_COMMIT_RATE
STDERR_LOG SQLNAME SQLUSER SUMMARIZED
ASON, $CURRENT_STAGE
=item :scrape
:basic, $DEFAULT_PLAYERFILE_EXPIRATION - when the playerfile json is considered stale and needs to be re-scraped
=item :test
:basic, $IS_AUTHOR - you shouldn't s
ing' => sub { shift->$_call_if_can('toString') },
'Test::NiceDump::024_TO_JSON' => sub { shift->$_call_if_can('TO_JSON') },
'Test::NiceDump::030_get_inflated_columns' => sub {
my %c =
ject to send messages via Net::Stomp
=head1 VERSION
version 2.005
=head1 SYNOPSIS
my $ser = JSON::XS->new->utf8;
my $p = Net::Stomp::Producer->new({
connect_headers => { login => 'some-lo
],
serializer => sub { $ser->encode($_[0]) },
default_headers => { 'content-type' => 'json' },
});
$p->send('/queue/somewhere',
{ type => 'my_message' },
{ a =>
w({
servers => [ { hostname => 'localhost', port => 61613 } ],
serializer => sub { encode_json($_[0]) },
});
$p->send($destination,\%headers,$body_hashref);
The body will be passed throu
ATED) Retrieve stock quotes using the IEX API
use strict;
use warnings;
use DateTime;
use JSON qw(decode_json);
use HTTP::Status qw(status_message);
warnings::warnif( 'deprecated',
'Finance::Quo
$errormsg, $symbol, $url, $code, $desc );
next;
}
my $data = decode_json( $response->decoded_content );
if ( !defined $data->{latestPrice} ) {
my $co
n be used.
For example, if the data files were in JSON format:
MyTests->run_data_tests(
match => qr/\.json$/,
parser => sub { decode_json( $_[0]->slurp_raw ) },
);
Note that the argume
use strict;
use warnings;
use RPi::UnicornHatHD;
use Imager;
use HTTP::Tiny;
use JSON::Tiny qw[decode_json];
use Time::HiRes qw[sleep];
# Scroll the front page of Reddit
my $display = RPi::UnicornHat
= HTTP::Tiny->new->get('https://www.reddit.com/r/all/new.json');
die "Failed!\n" unless $response->{success};
my $json = decode_json $response->{content};
push @titles, map {
spr
s] %s (/u/%s)',
$_->{data}{subreddit}, $_->{data}{title}, $_->{data}{author}
} @{$json->{data}{children}};
for my $title (map { $_ . ' --- ' } @titles) {
my $bounds = $font
=> undef,
directories => {},
};
$self->{ connection } = undef;
$self->{ json } = undef;
#--------------------------------------------------------------------------
ll';
use experimental qw(smartmatch);
use Encode;
use Storable qw(dclone);
use Date::Parse;
use JSON;
use Try::Tiny;
use Text::Unidecode;
use Sport::Analytics::NHL::Util qw(:format :utils :times);
the Player JSON report
=head1 SYNOPSYS
Class for the Boxscore JSON report.
use Sport::Analytics::NHL::Report::Player;
my $report = Sport::Analytics::NHL::Report::Player->new($json)
$rep
ort->process();
=head1 METHODS
=over 2
=item C<new>
Create the Player object with the JSON.
=item C<process>
Process the Player into the object compatible with further processing, etc.
=item C<
=> 'all';
use utf8;
use experimental qw(smartmatch);
use Encode;
use Storable qw(dclone);
use JSON;
use Try::Tiny;
use Text::Unidecode;
use parent 'Sport::Analytics::NHL::Report';
use Sport::Ana
r the Boxscore JSON report
=head1 SYNOPSYS
Class for the Boxscore JSON report.
use Sport::Analytics::NHL::Report::BS;
my $report = Sport::Analytics::NHL::Report::BS->new($json)
$report-
>process();
=head1 METHODS
=over 2
=item C<new>
Create the Boxscore object with the JSON.
=item C<process>
Process the Boxscore into the object compatible with further processing, etc.
=item C<
our instances using L<YAML>, L<JSON>,
L<Storable>. Which backend to use can be a parameter.
parameter format => (
isa => (enum ['Storable', 'YAML', 'JSON']),
default => 'Stora
ebService::DetectLanguage;
$WebService::DetectLanguage::VERSION = '0.04';
use 5.010;
use Moo;
use JSON::MaybeXS;
has key => (
is => 'ro',
required => 1,
);
has ua => (
is => '
cess}) {
die "failed $response->{status} $response->{reason}\n";
}
return decode_json($response->{content});
}
sub detect
{
my ($self, $string) = @_;
my ($result) = $self->m
:DetectLanguage::Result;
require WebService::DetectLanguage::Language;
my $data = decode_json($response->{content});
my @results;
foreach my $result_set (@{ $data->{data}{detections}
w(time2str);
use JSON;
use List::MoreUtils qw(any part firstval);
use Sport::Analytics::NHL::Vars qw(
:globals :web
$DATA_DIR $REPORTS_DIR $CURRENT_SEASON $MONGO_DB $NORMALIZED_JSON
);
use Sport::A
refers to
Arguments: the YYYYMMDD date
Returns: the YYYY or YYYY-1 season
=item C<get_schedule_json_file>
Returns the path to the schedule file in the filesystem
Arguments: the season and the ro
e_ids
get_game_files_by_id get_schedule_json_file
);
our @web = qw(
);
our @schedule = qw(
convert_schedule_game arrange_schedule_by_date get_schedule_json_file
read_schedules get_games_from_sche
nstant {
CONTENT_TYPE => "application/json",
SERIALIZE_FORMAT => 'json',
SR_ATTRS => {
json => [
{ # For serialize
if (my $err = value($res => "error")) {
return $err;
}
} else {
return "The response has not valid JSON format";
}
return "Unknown error";
}
1;
__END__
/mbutiny",
CONTENT_TYPE => "application/json; charset=utf-8",
SERIALIZE_FORMAT => 'json',
SR_ATTRS => {
json => [
{ # For serialize
.8 Perl/v5.16.3
< Connection: close
< Content-Length: 214
< Content-Type: application/json; charset=utf-8
<
{
"dsn" : "dbi:SQLite:dbname=/var/lib/mbutiny/mbutiny.db",
2.4.29 (Ubuntu)
< Connection: close
< Content-Length: 556
< Content-Type: application/json; charset=utf-8
<
{
"name" : "foo",
"error" : "",
"file" : null,
:Object::OMRResponseDetails;
require 5.6.0;
use strict;
use warnings;
use utf8;
use JSON qw(decode_json);
use Data::Dumper;
use Module::Runtime qw(use_module);
use Log::Any qw($log);
use Da
turn perl hash
sub to_hash {
return decode_json(JSON->new->convert_blessed->encode( shift ));
}
# used by JSON for serialization
sub TO_JSON {
my $self = shift;
my $_data = {};
eserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^hash\[(.*),(.*)\]$/i) { #has
d::Object::OMRFunctionParam;
require 5.6.0;
use strict;
use warnings;
use utf8;
use JSON qw(decode_json);
use Data::Dumper;
use Module::Runtime qw(use_module);
use Log::Any qw($log);
use Da
turn perl hash
sub to_hash {
return decode_json(JSON->new->convert_blessed->encode( shift ));
}
# used by JSON for serialization
sub TO_JSON {
my $self = shift;
my $_data = {};
eserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^hash\[(.*),(.*)\]$/i) { #has
ud::Object::OmrResponseInfo;
require 5.6.0;
use strict;
use warnings;
use utf8;
use JSON qw(decode_json);
use Data::Dumper;
use Module::Runtime qw(use_module);
use Log::Any qw($log);
use Da
turn perl hash
sub to_hash {
return decode_json(JSON->new->convert_blessed->encode( shift ));
}
# used by JSON for serialization
sub TO_JSON {
my $self = shift;
my $_data = {};
eserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^hash\[(.*),(.*)\]$/i) { #has
oud::Object::AsposeResponse;
require 5.6.0;
use strict;
use warnings;
use utf8;
use JSON qw(decode_json);
use Data::Dumper;
use Module::Runtime qw(use_module);
use Log::Any qw($log);
use Da
turn perl hash
sub to_hash {
return decode_json(JSON->new->convert_blessed->encode( shift ));
}
# used by JSON for serialization
sub TO_JSON {
my $self = shift;
my $_data = {};
eserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^hash\[(.*),(.*)\]$/i) { #has
rcloud::Object::OMRResponse;
require 5.6.0;
use strict;
use warnings;
use utf8;
use JSON qw(decode_json);
use Data::Dumper;
use Module::Runtime qw(use_module);
use Log::Any qw($log);
use Da
turn perl hash
sub to_hash {
return decode_json(JSON->new->convert_blessed->encode( shift ));
}
# used by JSON for serialization
sub TO_JSON {
my $self = shift;
my $_data = {};
eserialize the data
while ( my ($_key, $_type) = each %{$self->swagger_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
if ($_type =~ /^hash\[(.*),(.*)\]$/i) { #has