= 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
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
a::Validate::URI qw(is_uri is_web_uri);
use IO::Scalar;
use Scalar::Util qw(refaddr reftype);
use JSON;
our $AUTOLOAD;
our @HIDDEN_PROPERTIES =
qw(to format xmlns cgi header xmlheader xslt pi ca
encoding=\"UTF-8\"?>\n$xml" if $param{header};
return $xml;
}
sub struct {
my ($self, $json) = @_;
my $struct = { };
foreach my $property (keys %$self) {
next unless $proper
if (ref $self->{$property} eq 'ARRAY') {
$struct->{$property} = [ map { $_->struct($json) } @{$self->{$property}} ];
} elsif ( UNIVERSAL::isa( $self->{$property}, "DAIA::Object"
A::Document>
our $VERSION = '0.43'; #VERSION
use strict;
use base 'DAIA::Object';
use DAIA;
use JSON;
our %PROPERTIES = (
id => $DAIA::Object::COMMON_PROPERTIES{id},
href =>
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::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,
= 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
"application/javascript" => q{js},
"application/json" => q{json},
"application/mathml+xml" => q{xml},
"appl
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.
} elsif( $from eq '-' ) {
$file = \*STDIN;
} elsif( $from =~ /\.(xml|json)$/ ) {
$file = $from ;
$format = $1 unless $format;
}
}
i
push @objects, $object;
}
}
} elsif ( $format eq 'json' ) {
eval { $value = JSON->new->decode($from); };
croak $@ if $@;
if ( (keys %$value) ==
delete $value->{schema} if $root eq 'Response'; # ignore schema attribute
croak "JSON does not contain DAIA elements" unless $value;
push @objects, eval('DAIA::'.$root.'->new(
package CGI::Lazy::Widget::DomLoader;
use strict;
use base qw(CGI::Lazy::Widget);
use JSON;
#----------------------------------------------------------------------------------------
sub new {
my $
foreach my $rawvar (keys %{$self->vars->{raw};}) {
$rawObjectJs .= "var $rawvar = JSON.parse('".to_json($self->vars->{raw}->{$rawvar})."');\n";
}
$rawObjectJs = $self->q->jswr
package CGI::Lazy::Widget::Controller;
use strict;
use JSON;
use JavaScript::Minifier qw(minify);
use CGI::Lazy::Globals;
use base qw(CGI::Lazy::Widget);
#------------------------------------------
dname} = $value;
}
}
my $jscontrollername = $widgetID."Controller";
my $selectObject = to_json([map {{name => $_->{name}, required => $_->{required}}} @{$self->controls}]);
my $javascript =
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::Widget::Composite;
use strict;
use JSON;
use CGI::Lazy::Globals;
use base qw(CGI::Lazy::Widget);
# for new composite types need the following: ajaxSelect<type> and dbwrite<type
axSelectParentChild {
my $self = shift;
my %args = @_;
my $incoming = $args{incoming} || from_json(($self->q->param('POSTDATA') || $self->q->param('keywords') || $self->q->param('XForms:Model')));
ctSelectableDataset {
my $self = shift;
my %args = @_;
my $incoming = $args{incoming} || from_json(($self->q->param('POSTDATA') || $self->q->param('keywords') || $self->q->param('XForms:Model')));
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::Widget;
use strict;
use JSON;
use Tie::IxHash;
use CGI::Lazy::Globals;
use CGI::Lazy::Widget::Dataset;
use CGI::Lazy::Widget::DomLoader;
use CGI::Lazy::Widget::Composite;
use CGI:
$validator->{$_->widgetID} = $_->validator for @widgetlist;
my $json = to_json($validator);
return '{"validator" : '.$json.', "html" : "'.$outgoingdata .'"}';
}
#------------------------
foreach my $object (keys %{$self->vars->{objects};}) {
$objectJs .= "var $object = JSON.parse('".to_json($self->vars->{objects}->{$object})."');\n";
}
$objectJs = $self->q->jsw
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
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-\