nzo::Transaction;
use Business::Monzo::Account;
use Data::Dumper;
use Mojo::UserAgent;
use Mojo::JSON;
use Carp qw/ carp /;
=head1 ATTRIBUTES
=head2 token
Your Monzo access token, this is required
= (
'Authorization' => "Bearer " . $self->token,
'Accept' => 'application/json',
);
if ( $method =~ /POST|PUT|PATCH/i ) {
$tx = $self->_ua->$method( $path => {
if ( $res->is_success ) {
carp( "RES: " . Dumper $res->json )
if $ENV{MONZO_DEBUG};
return $res->json;
}
else {
my $error = $res->message;
car
tem Embedded lua language into the grammar
=item Bindings to java, lua and perl languages
=item JSON (strict and extended) grammars for decoding/encoding
=item Declarative lua action directly into
ge Net::CVE;
use 5.014002;
use warnings;
our $VERSION = "0.009";
use Carp;
use HTTP::Tiny;
use JSON::MaybeXS;
use List::Util qw( first );
# https://cveawg.mitre.org/api/cve/CVE-2022-26928
# But th
get",
source => $url,
usage => undef,
};
return $self;
}
$self->{data} = decode_json ($r->{content});
}
elsif (-s $cve) {
my $fh;
unless (open $fh, "<:encoding(utf-8)", $cve)
"get",
source => $cve,
usage => 'get ("cve-2022-26928.json")',
};
return $self;
}
unless (eval { $self->{data} = decode_json (do { local $/; <$fh> }); 1 }) {
$self->{diag} = {
#ifndef MARPAESLIF_INTERNAL_JSON_H
#define MARPAESLIF_INTERNAL_JSON_H
static const char *jsonStringRegexsp[_MARPAESLIF_JSON_TYPE_LAST] = {
/* Strict */
"\"(?C50)(?:((?:[^\"\\\\\\x00-\\x1F]+)|(?:\
ic const char *jsonStringRegexModifiersp[_MARPAESLIF_JSON_TYPE_LAST] = {
/* Strict */
"u",
/* Extended */
"u"
};
static const char *jsonConstantOrNumberRegexsp[_MARPAESLIF_JSON_TYPE_LAST] =
6)|(?:-?NaN)(?C67)"
};
static const char *jsonConstantOrNumberRegexModifiersp[_MARPAESLIF_JSON_TYPE_LAST] = {
/* Strict */
"",
/* Extended */
"i"
};
#endif /* MARPAESLIF_INTERNAL_JSON_H */
censes/>
=cut
our $VERSION = '0.02';
use Carp qw/croak/;
use Mojo::Collection;
use Mojo::JSON qw(from_json);
use Mojo::Util qw(tablify);
sub new {
my $class = shift;
my $args = scalar(@_)
arp;
MarpaX_ESLIF_constants_t *constantsp;
} MarpaX_ESLIF_Grammar_t, MarpaX_ESLIF_JSON_Encoder_t, MarpaX_ESLIF_JSON_Decoder_t;
/* Symbol type */
typedef struct MarpaX_ESLIF_Symbol {
SV
ESLIF_constants_t *constantsp);
PERL_STATIC_INLINE short marpaESLIFPerl_JSONDecodePositiveInfinityAction(void *userDatavp, char *strings, size_t stringl, marpaESLIFValueResul
lueResultp, short confidenceb);
PERL_STATIC_INLINE short marpaESLIFPerl_JSONDecodeNegativeInfinityAction(void *userDatavp, char *strings, size_t stringl, marpaESLIFValueResul
vious request invocation, it will check on the current resources C<update_frequency> from C<usage.json>
API call, if the C<Last-Modified> timestamp HTTP header that is attached with our existing respo
await $exch->latest('USD', 'CAD', ['JPY']);
To request L<latest.json enpoint|https://docs.openexchangerates.org/reference/latest-json> from API.
It accepts a list, C<ARRAYref> or a mixture of both f
h->historical('2024-04-04', 'CAD');
To request L<historical/*.json endpoint|https://docs.openexchangerates.org/reference/historical-json> from API.
Used to retrieve old rates, takes multiple paramete
fore the XS loader
#
our $true;
our $false;
BEGIN {
use JSON::MaybeXS 1.004000 qw//;
$true = JSON::MaybeXS::true();
$false = JSON::MaybeXS::false();
}
#
# Bootstrap
#
BEGIN {
#
ou
IF::Grammar::Rule::Properties;
use MarpaX::ESLIF::Grammar::Symbol::Properties;
use MarpaX::ESLIF::JSON;
use MarpaX::ESLIF::Logger::Level;
use MarpaX::ESLIF::Recognizer;
use MarpaX::ESLIF::Symbol;
use
Type;
use MarpaX::ESLIF::Rule::PropertyBitSet;
sub getInstance {
goto &new
}
*is_bool = \&JSON::MaybeXS::is_bool;
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
MarpaX::ESLIF - ESLIF is Ex
clean_eval { eval $_[0] } # needs to be here (RT#101273)
use strict;
use warnings;
use Safe;
use JSON::PP ();
use Dumpvalue;
use version ();
use File::Spec ();
our $VERSION = '0.47';
our $VERBOSE =
$self->{VERSION} = $version;
if ($self->{VERSION} =~ /^\{.*\}$/) {
# JSON error message
} elsif ($self->{VERSION} =~ /[_\s]/ && !$self->{ALLOW_DEV_VERSION} && !$AL
age};
if ($pp->{version} && $pp->{version} =~ /^\{.*\}$/) { # JSON parser error
my $err = JSON::PP::decode_json($pp->{version});
if ($err->{x_normalize}) {
vious request invocation, it will check on the current resources C<update_frequency> from C<usage.json>
API call, if the C<Last-Modified> timestamp HTTP header that is attached with our existing respo
Try;
#use Syntax::Keyword::Dynamically;
use Log::Any qw($log);
use Net::Async::HTTP;
use URI;
use JSON::MaybeUTF8 qw(:v1);
use Digest::MD5 ();
use Time::Moment;
use feature qw(current_sub);
field $_a
authorization => join(' ', 'Token', $_app_id),
accept_encoding => 'application/json'
},
));
}
async method $cache_get($key) {
if ( $_use_cache ) {
#
witch;
use 5.020;
use Moo 2;
use experimental 'signatures';
use Carp 'croak';
use JSON 'encode_json', 'decode_json';
use POSIX 'strftime';
use Future::Utils 'repeat';
use Future::HTTP;
our $VERSION
my $f = $self->ua->http_request( POST => 'https://gql.twitch.tv/gql',
body => encode_json( $query ),
headers => {
# so far we need no headers
"Client-ID" =
)->then(sub( $body, $headers ) {
my $res;
if( $body ) {
$res = decode_json( $body );
} else {
return Future->done()
}
return Future->don
JSON data with jq
=head1 SYNOPSIS
greple -Mjq --glob JSON-DATA --IN label pattern
=head1 VERSION
Version 0.06
=head1 DESCRIPTION
This is an experimental module for L<App::Greple> to search JSON
formatted text using L<jq(1)> as a backend.
Search top level json object which includes both C<Marvin> and
C<Zaphod> somewhere in its text representation.
greple -Mjq 'Marvin Zaphod'
You can s
s labels
start with C<name>.
If the label is simple string like C<name>, it matches any level of
JSON data.
If the label string contains period (C<.>), it is considered as a
nested labels. Name C<.
mpact on how ESLIF will represent *inputcp depending on serialization context */
/* (e.g. the :json action). */
/* The default v
mbol is verbose */
} marpaESLIFSymbolProperty_t;
/* Whenever marpaESLIF fails to parse exactly a JSON number it will call the proposal callback if defined. */
/* It will always propose either UNDEF o
rt (*marpaESLIFJSONProposalAction_t)(void *userDatavp, char *strings, size_t stringl, marpaESLIFValueResult_t *marpaESLIFValueResultp, short confidenceb);
typedef struct marpaESLIFJSONDecodeOption {
ata dump of JSON structure";
say " Will use Data::Peek if available,";
say " otherwise Data::Dumper";
say " -j --json Dump as json";
say
" -J --json-pp Dump as json (formatted)";
say " -Q --json-jq Dump as json (formatted by jq)";
say " -c --csv Dump as CSV (NYI)";
exit $err;
} # usage
use Net::CV
E;
use Data::Peek;
use Data::Dumper;
use JSON::MaybeXS;
use List::Util qw( first );
use Getopt::Long qw(:config bundling);
GetOptions (
"help|?" => sub { usage (0); },
"V|version"
or both rule and symbol actions.
=item C<::json>
Creates a value of type STRING in the UTF-8 encoding, containing a strict JSON string as per original JSON specification, i.e. it is using UTF-16 sur
l for both rule and symbol actions.
=item C<::jsonf>
Creates a value of type STRING in the UTF-8 encoding, containing a JSON string as per original JSON specification plus infinity and nan extension
| '::false'
| '::json'
| '::jsonf'
| '::row'
he method C<MarpaX::ESLIF::is_bool> is used to determine the boolean nature. Default is to call C<JSON::MaybeXS::is_bool>.
=item [2]
If input is a IV only scalar, storage is decided when comparing t
fault implementations of C<$MarpaX::ESLIF::true> and C<$MarpaX::ESLIF::false> are C<JSON::MaybeXS::true()> and C<JSON::MaybeXS::false()>, respectively.
=item [6]
If the encoding is "UTF-8", returns
use Mojo::Base 'Mojolicious::Command';
use Getopt::Long qw(GetOptionsFromArray);
use JSON qw(encode_json);
use List::Util qw(max);
use Scalar::Util qw(looks_like_number);
use Syntax::Keywo
);
}
my sub stringify_value($value) {
return 'undef' unless (defined($value));
return encode_json($value) if (ref($value));
return $value if (looks_like_number($value));
return q
'::false' */
#define G1_ACTION_ACTION_NAME_11 "::ascii" /* <action name> ::= '::json' */
#define G1_ACTION_ACTION_NAME_12 "::ascii" /* <action name> ::= '::row' */
"::ascii" /* <symbol action name> ::= '::json' */
#define G1_ACTION_SYMBOLACTION_NAME_11 "::ascii" /* <symbol action name> ::= '::jsonf' */
#define G1_ACTION_SYMBOLACTION_NAME_12
1_TERMINAL_ANY_CHARACTER,
G1_TERMINAL___TRUE,
G1_TERMINAL___FALSE,
G1_TERMINAL___JSON,
G1_TERMINAL___JSONF,
G1_TERMINAL___ROW,
G1_TERMINAL___TABLE,
G1_TERMINAL_IF_ACTION,
G1_TERMINAL_R
TERMINAL___JSON, MARPAESLIF_TERMINAL_TYPE_STRING, 0, NULL,
"'::json'", NULL, NULL,
#ifndef MARPAESLIF_NTRACE
"::json", "::jso"
#else
NULL, NULL
#endif
},
{ G1_TERMINAL___JSONF, MARPAES
LIF_TERMINAL_TYPE_STRING, 0, NULL,
"'::jsonf'", NULL, NULL,
#ifndef MARPAESLIF_NTRACE
"::jsonf", "::json"
#else
NULL, NULL
#endif
},
{ G1_TERMINAL___ROW, MARPAESLIF_TERMINAL_TYPE_STRIN
F_lua_functiondecl marpaESLIF_lua_functiondecl_t;
typedef enum marpaESLIF_json_type marpaESLIF_json_type_t;
typedef struct marpaESLIF_pcre2_callout_context marpaESLIF_pcre2_callou
MARPAESLIF_INTERNAL_RULE_ACTION___FALSE,
MARPAESLIF_INTERNAL_RULE_ACTION___JSON,
MARPAESLIF_INTERNAL_RULE_ACTION___JSONF,
MARPAESLIF_INTERNAL_RULE_ACTION___ROW,
MARPAESLIF_INTERNAL_RULE_ACTION
ESLIF_INTERNAL_SYMBOL_ACTION___FALSE,
MARPAESLIF_INTERNAL_SYMBOL_ACTION___JSON,
MARPAESLIF_INTERNAL_SYMBOL_ACTION___JSONF
} marpaESLIF_internal_symbol_action_t;
/* Symbol types */
enum marpaESLIF