lt} );
my $attached_db;
if ( -s $sf->{i}{f_attached_db} ) {
my $h_ref = $ax->read_json( $sf->{i}{f_attached_db} ) // {};
$attached_db = $h_ref->{$sf->{d}{db}} // {};
}
my $h_ref = $ax->read_json( $sf->{i}{f_attached_db} ) // {};
$h_ref->{$sf->{d}{db}} = $attached_db;
$ax->write_json( $sf->{i}{f_attached_db}, $h_ref );
lt} );
my $attached_db;
if ( -s $sf->{i}{f_attached_db} ) {
my $h_ref = $ax->read_json( $sf->{i}{f_attached_db} ) // {};
$attached_db = $h_ref->{$sf->{d}{db}} // {};
}
h =
{
name => 'John Doe',
active => $bool,
};
# Converting to json
print( JSON->new->encode( $hash ), "\n" );
# Would result in
{
name: "Jogn Doe",
ed interchangeably as perl boolean, i.e. 1 or 0, or as L<JSON> bool, i.e. C<true> or C<false>
The code is taken and adapted from part of L<JSON> module.
=head1 CONSTRUCTOR
=head2 new
Provided with
perl true value i.e. 1 or C<true> when added into L<JSON>
=head2 false
This returns a perl false value i.e. 0 or C<false> when added into L<JSON>
=head2 is_bool
Provided with a value and this ret
nd call L<perlfunc/"die"> with it.
=head2 TO_JSON
Special method called by L<JSON> to transform this object into a string suitable to be added in a json data.
=head2 type
Set or get the error type
STORABLE_freeze
=for Pod::Coverage STORABLE_thaw
=for Pod::Coverage THAW
=for Pod::Coverage TO_JSON
Serialisation by L<CBOR|CBOR::XS>, L<Sereal> and L<Storable::Improved> (or the legacy L<Storable
use DBD::SQLite;
use DBI qw( :sql_types );
use Encode ();
use File::Spec;
use JSON;
use Locale::Unicode v0.3.5;
use Scalar::Util ();
use Wanted;
use constant {
die( "\$cldr->_decode_sql_arrays( \$array_ref_of_array_fields, \$data )" );
}
my $j = JSON->new->relaxed;
local $@;
if( ref( $ref ) eq 'HASH' )
{
foreach my $field ( @$
if( $@ )
{
warn( "Warning only: error attempting to decode JSON array in field \"${field}\" for value '", $ref->{ $field }, "': $@" );
$ref->
{$opt};
}
}
my $ax = App::DBBrowser::Auxil->new( $sf->{i}, $sf->{o}, {} );
my $file_name_fs = $sf->{i}{f_settings};
$ax->write_json( $file_name_fs, $tmp );
}
1;
__END__
my $ax = App::DBBrowser::Auxil->new( $sf->{i}, $sf->{o}, $sf->{d} );
my $h_ref = $ax->read_json( $sf->{i}{f_dir_history} ) // {};
my @dirs = @{$h_ref->{dirs}//[]};
if ( @dirs > $sf->{o}
$#dirs = $sf->{o}{insert}{history_dirs} - 1;
$h_ref->{dirs} = \@dirs;
$ax->write_json( $sf->{i}{f_dir_history}, $h_ref );
}
return [ sort @dirs ]; ##
}
sub __add_to_history
my $ax = App::DBBrowser::Auxil->new( $sf->{i}, $sf->{o}, $sf->{d} );
my $h_ref = $ax->read_json( $sf->{i}{f_dir_history} ) // {};
my @dirs = @{$h_ref->{dirs}//[]};
unshift @dirs, $dir;
tly::Object::FilterFieldItem;
require 5.6.0;
use strict;
use warnings;
use utf8;
use JSON::MaybeXS qw(decode_json);
use Data::Dumper;
use Module::Runtime qw(use_module);
use Log::Any qw($log);
use Da
f = shift;
my $_hash = decode_json(JSON()->new->allow_blessed->convert_blessed->encode($self));
return $_hash;
}
# used by JSON for serialization
sub TO_JSON {
my $self = shift;
my $
serialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
my $_is_nullable = ($self->openapi_nullable->{
tly::Object::ValuesBandwidth;
require 5.6.0;
use strict;
use warnings;
use utf8;
use JSON::MaybeXS qw(decode_json);
use Data::Dumper;
use Module::Runtime qw(use_module);
use Log::Any qw($log);
use Da
f = shift;
my $_hash = decode_json(JSON()->new->allow_blessed->convert_blessed->encode($self));
return $_hash;
}
# used by JSON for serialization
sub TO_JSON {
my $self = shift;
my $
serialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
my $_is_nullable = ($self->openapi_nullable->{
:Fastly::Object::DimensionOs;
require 5.6.0;
use strict;
use warnings;
use utf8;
use JSON::MaybeXS qw(decode_json);
use Data::Dumper;
use Module::Runtime qw(use_module);
use Log::Any qw($log);
use Da
f = shift;
my $_hash = decode_json(JSON()->new->allow_blessed->convert_blessed->encode($self));
return $_hash;
}
# used by JSON for serialization
sub TO_JSON {
my $self = shift;
my $
serialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
my $_is_nullable = ($self->openapi_nullable->{
y::Object::DimensionResponse;
require 5.6.0;
use strict;
use warnings;
use utf8;
use JSON::MaybeXS qw(decode_json);
use Data::Dumper;
use Module::Runtime qw(use_module);
use Log::Any qw($log);
use Da
f = shift;
my $_hash = decode_json(JSON()->new->allow_blessed->convert_blessed->encode($self));
return $_hash;
}
# used by JSON for serialization
sub TO_JSON {
my $self = shift;
my $
serialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
my $_is_nullable = ($self->openapi_nullable->{
::Object::ValuesCountryStats;
require 5.6.0;
use strict;
use warnings;
use utf8;
use JSON::MaybeXS qw(decode_json);
use Data::Dumper;
use Module::Runtime qw(use_module);
use Log::Any qw($log);
use Da
f = shift;
my $_hash = decode_json(JSON()->new->allow_blessed->convert_blessed->encode($self));
return $_hash;
}
# used by JSON for serialization
sub TO_JSON {
my $self = shift;
my $
serialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
my $_is_nullable = ($self->openapi_nullable->{
tly::Object::LogInsightsMeta;
require 5.6.0;
use strict;
use warnings;
use utf8;
use JSON::MaybeXS qw(decode_json);
use Data::Dumper;
use Module::Runtime qw(use_module);
use Log::Any qw($log);
use Da
f = shift;
my $_hash = decode_json(JSON()->new->allow_blessed->convert_blessed->encode($self));
return $_hash;
}
# used by JSON for serialization
sub TO_JSON {
my $self = shift;
my $
serialize the data
while ( my ($_key, $_type) = each %{$self->openapi_types} ) {
my $_json_attribute = $self->attribute_map->{$_key};
my $_is_nullable = ($self->openapi_nullable->{
_dir, 'general_settings.json';
$sf->{i}{conf_file_fmt} = catfile $app_dir, 'config_%s.json';
$sf->{i}{f_attached_db} = catfile $app_dir, 'attached_DB.json';
$sf->{i}{f_dir_hi
p_dir, 'dir_history.json';
$sf->{i}{f_subqueries} = catfile $app_dir, 'subqueries.json';
$sf->{i}{f_search_and_replace} = catfile $app_dir, 'search_and_replace.json';
}
sub __options
f->{i}{f_attached_db} ) {
if ( ! eval {
my $h_ref = $ax->read_json( $sf->{i}{f_attached_db} ) // {};
my $attached_db = $h_ref->{$db} // {};
ir}, 'cache_SQLite_files.json';
my $ax = App::DBBrowser::Auxil->new( {}, {}, {} );
my $tc = Term::Choose->new( $sf->{i}{tc_default} );
my $db_cache = $ax->read_json( $cache_sqlite_files )
irs;
$databases = [ sort { $a cmp $b } @$databases ];
$db_cache->{databases} = $databases;
$ax->write_json( $cache_sqlite_files, $db_cache );
return $databases;
}
1;
__END__
'Firebird_databases.json';
my $ax = App::DBBrowser::Auxil->new( {}, {}, {} );
my $tc = Term::Choose->new( $sf->{i}{tc_default} );
my $saved_databases = $ax->read_json( $file_firebird_dbs
elsif ( $choice eq $confirm ) {
if ( $changed ) {
$ax->write_json( $file_firebird_dbs, $databases );
}
return $databases;
}
use Scalar::Util qw( looks_like_number );
#use Storable qw(); # required
use JSON::MaybeXS qw( decode_json );
use List::MoreUtils qw( none uniq );
use Term::Choose qw();
use Term
[ 'Press ENTER to continue' ],
{ prompt => $message, info => $info }
);
}
sub write_json {
my ( $sf, $file_fs, $ref ) = @_;
if ( ! defined $ref ) {
open my $fh, '>', $fil
my $json = JSON::MaybeXS->new->utf8->pretty->canonical->encode( $ref );
open my $fh, '>', $file_fs or die "$file_fs: $!";
print $fh $json;
close $fh;
}
sub read_json {
my ( $sf,
my $ax = App::DBBrowser::Auxil->new( $sf->{i}, $sf->{o}, $sf->{d} );
my $h_ref = $ax->read_json( $sf->{i}{f_subqueries} ) // {};
my $saved_subqueries = $h_ref->{ $sf->{i}{driver} }{ $sf->{d
my $top_lines = [ $sf->{d}{db_string}, 'Stored Subqueries:' ];
my $h_ref = $ax->read_json( $sf->{i}{f_subqueries} ) // {};
my $saved_subqueries = $h_ref->{$driver}{$db} // [];
else {
delete $h_ref->{$driver}{$db};
}
$ax->write_json( $sf->{i}{f_subqueries}, $h_ref );
$any_change++;
}
}
}
sub __add_subqu
eturn( $self );
}
else
{
CORE::return( $class->new( $ref ) );
}
}
sub TO_JSON { CORE::return( [ @{$_[0]} ] ); }
# NOTE: Module::Generic::Array::Tie class
{
package
::signatures';
use Readonly;
use Carp qw(croak);
use Data::UUID;
use Mojo::File;
use Mojo::JSON qw(decode_json);
use Mojo::UserAgent;
use OIDC::Client::ResponseParser;
use OIDC::Client::TokenResponseP
ey ($self) {
if (my $private_jwk_file = $self->private_jwk_file) {
my $private_jwk = decode_json(Mojo::File->new($private_jwk_file)->slurp);
return $private_jwk;
}
elsif (my $private_jwk
}
$ua->on(start => sub {
my ($ua, $tx) = @_;
$tx->req->headers->accept('application/json');
});
return $ua;
}
sub _build_claim_mapping ($self) {
return $self->config->{claim_mapp
::Util ();
# This is disruptive for everybody. Bad idea.
# use JSON 4.03 qw( -convert_blessed_universally );
use JSON 4.03;
use Module::Generic::Global ':const';
use Storable::Impr
# I leave the feature of using it as a choice to the user, but defaults to JSON
$self->{_packing_method} = 'json';
$self->SUPER::init( @_ ) || return( $self->pass_error );
$self->{add
{
$self->{id} = shift( @_ );
}
return( $self->{id} );
}
sub json { return( shift->_packing_method( 'json' ) ); }
sub key
{
my $self = shift( @_ );
if( @_ )
{
my