package OpusVL::SysParams;
use warnings;
use strict;
use JSON;
use Data::Munge qw/elem/;
use Moose;
has 'schema' => (isa => 'DBIx::Class::Schema', is => 'ro', required => 1,
default => sub
ltset('SysInfo')->set(@_);
}
sub set_json {
my $self = shift;
my $name = shift;
my $val = shift;
my $schema = $self->schema;
my $obj = JSON->new->allow_nonref->decode($val);
ame, $obj);
}
sub get_json {
my $self = shift;
my $schema = $self->schema;
my $val = $schema->resultset('SysInfo')->get(@_);
return if !$val;
return JSON->new->allow_nonref->enc
ar2GitHub;
use strict;
use warnings FATAL => 'all';
# Import Module :
use Data::Dumper;
use JSON;
use JSON::XS;
use Term::ReadKey;
use Hash::MultiValue;
use BlankOnDev::DateTime;
use BlankOnDev::Util
my ($new_config) = @_;
# Create File :
my $newData_cfg = encode_json($new_config);
BlankOnDev::Utils::file->create($file_name, $dir_dev, $newData_cfg);
my ($new_config) = @_;
# Create File :
my $newData_cfg = encode_json($new_config);
BlankOnDev::Utils::file->create($file_name, $dir_dev, $newData_cfg);
OpusVL::SysParams::Schema::ResultSet::SysInfo;
use Moose;
extends 'DBIx::Class::ResultSet';
use JSON;
sub ordered
{
my $self = shift;
my $me = $self->current_source_alias;
return $self
my $info = $self->find_or_new({
name => $name,
});
$info->set_column(value => JSON->new->allow_nonref->encode($value));
if ($data_type) {
$info->set_column(data_type =>
lf = shift;
my $name = shift;
my $info = $self->find
({
name => $name
});
return $info ? JSON->new->allow_nonref->decode($info->value) : undef;
}
sub del
{
my $self = shift;
my $name = sh
l_display_here',
toolbar_container: 'grid_toolbar_will_display_here',
dto: {VUE: 'JSON'},
columns: [
{label: 'Full Name', value: function(e) {
retu
ESCRIPTION
Displays a dataset in a grid format.
Dataset is bound to a JSON datasource retrieved via an AJAX request.
JSON object has a predefined format that the Grid class understands and rende
ast page correspondingly.
=back
=head1 JSON Datasource
As mentioned before, the Grid expects the JSON datasource object to be of a predefined format.
json = {
'liste' : [
{'fname':
strict;
use warnings;
package Apache::Tika;
use Encode qw/decode_utf8/;
use LWP::UserAgent;
use JSON::MaybeXS();
our $VERSION = '0.07';
sub new {
my ($this, %pars) = @_;
my $self = bless {}, $t
ua} // LWP::UserAgent->new();
$self->{url} = $pars{url} // 'http://localhost:9998';
$self->{json} = JSON::MaybeXS->new();
return $self;
}
sub _request {
my ($self, $method, $path, $headers, $bod
'put',
'meta',
{
'Accept' => 'application/json',
$contentType? ('Content-type' => $contentType) : ()
},
$bytes
);
return $self->{json}->decode($meta);
}
sub rmeta {
my ($self, $byt
exists $INC{$module};
return undef;
}
sub been_numeric {
my $value = shift;
# From Mojo::JSON
return 1 if B::svref_2object(\$value)->FLAGS & (B::SVp_IOK | B::SVp_NOK)
and 0 + $value e
te::JSONCodec;
our $VERSION = '0.1_1';
use v5.14;
use strictures 2;
use Moo::Role;
use Carp;
use JSON ();
use namespace::clean;
=item _json (read-only)
A L<JSON> codec object.
=cut
has _json =>
is => lazy => init_arg => undef, builder => sub {
JSON->new->utf8->allow_blessed(1)
};
1;
HTTPClient>.
JSON data is decoded using a L<JSON> object handled by
L<Net::Async::Graphite::JSONCodec>.
=cut
with 'Net::Async::Graphite::HTTPClient';
with 'Net::Async::Graphite::JSONCodec';
=head
=item find
=item expand
=item index[.json]
C</metrics/index.json> can be requested with C<$method> of C<index> or
C<index.json> because requiring the C<.json> suffix is silly. Also I
can consider
llowed_metrics_params{'index.json'} = $allowed_metrics_params{index}; # FFS
sub metrics {
my $self = shift;
my ($method, $query, %extra) = @_;
$method = 'index.json' if $method eq 'index';
re
ost of the
functionality of C</render>, C</metrics/expand>, C</metrics/find> and
C</metrics/index.json> which is described in detail in
L<Net::Async::Graphite::API>.
There is also support to pass the
d::Input::Feed::Run;
use strict;
use warnings;
use BusyBird::Input::Feed;
use LWP::UserAgent;
use JSON;
use Carp;
sub run {
my ($class, %opts) = @_;
my $download_url = $opts{download_url};
put::Feed->new(
defined($user_agent) ? (user_agent => $user_agent) : ()
);
my $json = JSON->new->utf8->ascii;
my $statuses = _parse_feed($input, $download_url);
if(defined($lev
->{busybird}{level} = $level;
}
}
my $statuses_json = $json->encode($statuses) . "\n";
_post_statuses(\$statuses_json, $post_url, $user_agent);
}
sub _parse_feed {
my ($input,
use strict;
use warnings;
use CGI;
use HTTP::Daemon;
use HTTP::Status;
use URI::Escape;
use JSON;
use Encode qw/decode_utf8/;
my $query;
my @countries = <DATA>;
chomp foreach @countries;
my $port =
code => $c, } } @countries_list;
my $json = to_json(\@choices, {ascii => 1});
print STDERR "RESPONSE: $json\n";
my $response = HTTP::Response->new(RC_OK);
'Pragma' => 'no-cache',
'Expires' => '0');
$response->content($json);
$client_connection->send_response($response);
}
elsif ($path_info =~ s[^g/country
ma->new( storage_class => q(Any) );
my $loaded = $schema->load( 'data_file1.xml', 'data_file2.json' );
=head1 Description
Selects storage class using the extension on the path
=head1 Configurat
then an Ajax request
will be sent to C</myapp/completion?search=ab>.
The server should return a JSON array, in the format explained below.
=item a callback function
That function will be called, w
See also C<options.caseSensitive>.
=item an object (JSONP)
Useful when accessing data on a different domain via JSONP services.
Ex : { json_url: 'http://search.yahooapis.com/WebSearchService/V
&query=?1&output=json&callback=?2',
json_list: 'ResultSet/Result' }
The object should hold details of the JSONP service to be called.
C<json_url> : url to call with placeholders (?1, ?2)
;
has 'storage_class' => is => 'rw', isa => Str,
default => 'JSON', lazy => TRUE;
has 'tempdir' => is => 'ro', isa => Directory,
coerce
ibutes
Creates a new instance of the storage class which defaults to
L<File::DataClass::Storage::JSON>
Defines these attributes
=over 3
=item C<cache>
Instantiates and returns the L<Cache|File::D
type.getJSON
Prototype.getJSON(url, callback)
based on: getJSON function by Juriy Zaytsev L<http://github.com/kangax/protolicious/tree/master/get_json.js>
A method to temporarily load JSON data (
ideally hosted on a different domain and accessible via JSONP service) and send it over to callback method when ready.
=head2 Hash utilities
=head3 Hash.expand
var tree = Hash.expand(flat_hash);
cf = Mojo::CallFire->new(username => '...', password => '...');
say $cf->get('/calls')->result->json('/items/0/id');
=head1 DESCRIPTION
A simple interface to the CallFire API.
Currently only L<
package CloudCronCLI::Remove;
use MooseX::App::Command;
use Paws;
use JSON;
use CloudDeploy::Utils;
use CloudCron::AWS::CloudWatch;
command_short_description q(Delete a crontab queue or
e 'missing access_key' };
has base_url => 'https://api.cloudcheckr.com/api';
has format => 'json';
has _ua => sub { Mojo::UserAgent->new };
sub get {
my ($self, $cb) = (shift, ref $_[-
ojo::CloudCheckr->new(access_key => '...');
say $cc->get(account => 'get_accounts_v2')->result->json('/accounts_and_users/0/account_name');
=head1 DESCRIPTION
A simple interface to the CloudChec
;
$cc = $cc->format($format);
The response format from the CloudCheckr API, defaults to json.
# Set the format to XML
$cc->format('xml');
=head1 METHODS
L<Mojo::CloudCheckr> inherits
];
run ( command => $cmd, verbose => 0 );
}
if ( -e 'MYMETA.json' ) {
$struct = $self->meta_from_file( 'MYMETA.json' );
}
elsif ( -e 'MYMETA.yml' ) {
$struct = $self->meta_fro
TA.json' ) {
$struct = $self->meta_from_file( 'META.json' );
}
elsif ( -e 'META.yml' ) {
$struct = $self->meta_from_file( 'META.yml' );
}
else {
die "There is no 'META.json' n