package CGI::Lazy::Widget::Dataset;
use strict;
use JavaScript::Minifier qw(minify);
use JSON;
use CGI::Lazy::Globals;
use Tie::IxHash;
use base qw(CGI::Lazy::Widget);
our $tableCaptionVar = "
."Validator = ".to_json($self->validator).";");
my $primarykey = $self->recordset->primarykey;
my $searchObjectName = $self->widgetID.'SearchObject';
my $searchObject = to_json([map {$widgetID."-
s caused by network traffic. It's using AJAX and JSON, but there's no eval-ing. All data is passed into the browser as JSON, and washed though a JSON parser.
To do its magic, the Dataset relies he
package CGI::Lazy::Config;
use strict;
use JSON;
use Carp;
use CGI::Lazy::Globals;
#-------------------------------------------------------------------------------
sub AUTOLOAD {
my $self = shift;
name = shift;
my $json;
my $conf;
if (ref $filename) {
$conf = $filename;
} else {
eval {
open IF, "< $CONFIGROOT/$filename" or croak $!;
while (<IF>) {
$json .= $_ unless ($_ =
F;
};
if ($@) {
$q->errorHandler->noConfig($filename);
}
eval {
$conf = from_json($json);
};
if ($@) {
$q->errorHandler->badConfig($filename);
}
}
my $self = {_q => $q,
package CGI::Lazy::Session;
use strict;
use JSON;
use CGI::Lazy::ID;
use CGI::Lazy::CookieMonster;
use CGI::Lazy::Session::Data;
use CGI::Lazy::Globals;
#-------------------------------------------
e sessionID = ?", $self->sessionID);
my $data = $results->[0]->[0];
if ($data) {
return from_json($data);
} else {
return;
}
}
#--------------------------------------------------------------
ime
my $var = {
created => $now,
updated => $now,
expires => $expires,
};
my $data = to_json($var);
$self->db->do($query, $sessionID, $data);
return $sessionID;
}
#-------------------
if ( env_true('AUTHOR_TESTING') or env_true('RELEASE_TESTING') ) {
my $prereqs = parse_meta_json()->effective_prereqs;
my $reqs = $prereqs->requirements_for( 'develop', 'requires' );
my
package CGI::Lazy::Javascript;
use strict;
use CGI::Lazy::Globals;
use CGI::Lazy::Javascript::JSONParser;
use JavaScript::Minifier qw(minify);
#javascript for ajax requests
our $AJAXJS = q[
functio
failed: "+ err);
}
request.setRequestHeader('Content-Type', 'application/json');
request.send(JSON.stringify(outgoing));
request.onreadystatechange = function() {
if (request.readyS
failed: "+ err);
}
request.setRequestHeader('Content-Type', 'application/json');
request.send(JSON.stringify(outgoing));
returnHandler(request.status, request.responseText);
}
];
#ja
package CGI::Lazy;
use strict;
use JSON;
use CGI::Pretty;
use CGI::Lazy::Config;
use CGI::Lazy::Plugin;
use CGI::Lazy::DB;
use CGI::Lazy::DB::RecordSet;
use CGI::Lazy::Session;
use CGI::Lazy::Templa
umed to be the absolute path to the config file for the Lazy object. That file will be parsed as JSON.
tmplDir => Directory where Lazy will look for html templates. Absolute path to directory.
= cwd();
chdir '/tmp/cpan-fixes';
cpanm(@params);
chdir $cwd;
}
sub parse_meta_json {
$_[0] ||= 'META.json';
require CPAN::Meta;
return CPAN::Meta->load_file( $_[0] );
}
sub import {
m
ixes;
$caller_stash->{cpanm_fix} = *cpanm_fix;
$caller_stash->{parse_meta_json} = *parse_meta_json;
$caller_stash->{capture_stdout} = *capture_stdout;
$caller_stash->{deploy_st
if ( env_true('AUTHOR_TESTING') or env_true('RELEASE_TESTING') ) {
my $prereqs = parse_meta_json()->effective_prereqs;
my $reqs = $prereqs->requirements_for( 'develop', 'requires' );
my
= cwd();
chdir '/tmp/cpan-fixes';
cpanm(@params);
chdir $cwd;
}
sub parse_meta_json {
$_[0] ||= 'META.json';
require CPAN::Meta;
return CPAN::Meta->load_file( $_[0] );
}
sub import {
m
ixes;
$caller_stash->{cpanm_fix} = *cpanm_fix;
$caller_stash->{parse_meta_json} = *parse_meta_json;
$caller_stash->{capture_stdout} = *capture_stdout;
$caller_stash->{deploy_st
I::Lazy::Javascript::JSONParser;
use strict;
use Exporter;
use base qw(Exporter);
our @EXPORT = qw($JSONPARSER);
our $JSONPARSER = <<END;
//JSON Parser
if(!this.JSON){this.JSON={};}
(function(){fu
nction f(n){return n<10?'0'+n:n;}
if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+'-'+
f(this.getUTCMonth()+1)+'
tUTCMinutes())+':'+
f(this.getUTCSeconds())+'Z':null;};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf();};}
var cx=/[\\u0000\\u00ad\\u0600-\
$self->render_to_rel_file('fixture_config', "$name/share/$mode/fixtures/1/conf/all_tables.json");
};
# tests
$self->render_to_rel_file('test', "$name/t/basic.t", $class );
#
| | `-- 1.fix
| | `-- conf
| | `-- all_tables.json
| |-- production
| | `-- fixtures
| | `-- 1
| | |-- all
| | `-- 1.fix
| | `-- conf
| | `-- all_tables.json
| `-- testing
| `-- fixtures
| `-- 1
| |-- all_ta
';
## <?= $method ?> <?= $path ?>
? if ($description) {
<?= $description ?>
? }
### Request
```json
<?= $method ?> <?= $path ?><?= $query ? '?'.$query : '' ?>
<?= $request_body ?>
```
? if ($rule)
$rule->{$name}{$key}) {
* <?= $key ?>: **<?= $rule->{$name}{$key} || '' ?>**
? }
? }
? }
? }
### Response
```json
Status: <?= $code ?>
<?= $response_body ?>
```
---
END
return $tmpl;
}
1;
turns C<undef> here.
=cut
sub get_time { undef }
=head2 TO_JSON()
Meant to be called by the L<JSON> family of modules to create a JSON
representation of the OID. So, for example, "4162F712-1DD2-11
"4162F712-1DD2-11B2-B17E-C09EFE1DC403" }>.
my $json = JSON->new->allow_blessed->convert_blessed;
$json->encode(MorboDB::OID->new);
=cut
sub TO_JSON { { '$oid' => shift->value } }
sub _build_valu
e::Roles::JSONable;
use Moose::Role;
our $VERSION = '0.10';
our $AUTHORITY = 'cpan:STEVAN';
requires 'as_json';
no Moose::Role; 1;
__END__
=pod
=head1 NAME
Forest::Tree::Roles::JSONable - An
iding JSON serialization
=head1 DESCRIPTION
This is just an abstract role for trees capable of JSON serialization.
=head1 REQUIRED METHODS
=over 4
=item B<as_json (?%options)>
Return a JSON stri
ackage WWW::HarWalk;
use 5.006;
use strict;
use warnings FATAL => 'all';
use Carp qw(croak);
use JSON;
use HTTP::Request;
use base qw(Exporter);
=head1 NAME
WWW::HarWalk - Replay HTTP requests from
{
local $/;
$content = <$fh>;
}
close $fh;
my $json = JSON->new->utf8;
my $o = $json->decode($content);
while (my $entry = shift @{$o->{log}->{entries}}) {
package Test::Shodo::JSONRPC;
use strict;
use warnings;
use Shodo;
use parent qw/Exporter/;
use JSON qw/from_json/;
use Try::Tiny;
use Test::More;
our @EXPORT = qw/
shodo_document_root
shodo_
req_ok {
my ($req, $note) = @_;
$suzuri->request($req);
my $data = try {
from_json($req->content);
}catch{
warn "$_\n";
};
return unless $data;
return unles
hodo::JSONRPC - Test module using Shodo for JSON-RPC Web API
=head1 SYNOPSIS
use Test::More;
use Plack::Test;
use HTTP::Request;
use JSON qw/to_json/;
use Test::Shodo::JSONRPC;
package Shodo::Suzuri;
use strict;
use warnings;
use Carp qw//;
use Try::Tiny;
use JSON qw/from_json to_json/;
use Data::Validator;
use Clone qw/clone/;
sub new {
my ($class, %args) = @_;
my
pe =~ m!^application/json!) {
my $json_body = to_json(from_json($self->stash->{request_body}, { utf8 => 1 }), { pretty => 1 });
$self->stash->{request_body} = $json_body;
}
ret
e =~ m!^application/json!) {
my $json_body = to_json(from_json($self->stash->{response_body}, { utf8 => 1}), { pretty => 1 });
$self->stash->{response_body} = $json_body;
}
ret
if ( env_true('AUTHOR_TESTING') or env_true('RELEASE_TESTING') ) {
my $prereqs = parse_meta_json()->effective_prereqs;
my $reqs = $prereqs->requirements_for( 'develop', 'requires' );
my
ion Action can be one of several things.
info
Spits out a bunch of theme information in JSON form.
Mainly used for debugging, and gedit integration.
pullAll
Pulls all themes from t
ly and remotely present will be pulled.
=cut
use WWW::Shopify::Tools::Themer;
use JSON qw(encode_json decode_json);
my @ARGS = ();
my $settings = {directory => '.'};
my $interval = 1;
GetOptions(
ectory} . "/.shopsettings", $settings->{directory} . "/.shopmanifest");
my $filesettings = decode_json(read_file($settingFile)) if (-e $settingFile);
for (keys(%$filesettings)) { $settings->{$_} = $fi
use WWW::Shopify;
use WWW::Shopify::Private;
package WWW::Shopify::Tools::Themer::Manifest;
use JSON;
use File::stat;
use File::Slurp;
use Scalar::Util qw(weaken);
# When we save things down, we tr
_[1];
my $json = decode_json(read_file($_[1]));
for (keys(%{$json->{files}})) {
$json->{files}->{$_}->{'local'} = DateTime->from_epoch(epoch => $json->{files}->{$_}->{'local'});
$json->{files}->
$json->{files}->{$_}->{'remote'});
$json->{files}->{$_}->{'system'} = DateTime->from_epoch(epoch => $json->{files}->{$_}->{'system'});
}
$_[0]->{files} = $json->{files};
$_[0]->{themes} = $json-