,v 1.1 2010/11/01 18:41:55 jaw Exp $
package AC::MrGamoo::Iter::File;
use AC::MrGamoo::Iter;
use JSON;
our @ISA = 'AC::MrGamoo::Iter';
use strict;
sub new {
my $class = shift;
my $fd = sh
= $me->{buf};
delete $me->{buf};
return $r;
}
my $fd = $me->{fd};
my $l = scalar <$fd>;
return unless $l;
$me->{progress}->();
return decode_json($l);
}
1;
(
'title' => 'Bar chart test',
);
print $chart->render_swf(600, 400, 'chart-data.json', 'test-chart');
OFC2 bar chart data:
use Chart::OFC2;
use Chart::OFC2::Axis;
use C
lash
Chart 2 is offering. But it should help you to starting creating OFC2
graphs quite fast. The JSON format is quite intuitive and can be created
from any hash. This module is more like guideline.
2 is a flash script for creating graphs. To have a graph we need an
F<open-flash-chart.swf> and a JSON data file describing graph data.
Complete examples you can find after successful run of this modu
o::Task::Running;
use AC::MrGamoo::PeerList;
use AC::MrGamoo::Config;
use AC::DC::IO::Forked;
use JSON;
use strict;
my $TSTART = $^T;
my $TIMEOUT = 3600;
my $MAXREQ = 2;
my $MAXRUNNING = 7; # tune
n $REGISTRY{$task};
}
$me->{options} = decode_json( $me->{request}{options} ) if $me->{request}{options};
$me->{initres} = from_json( $me->{request}{initres}, {allow_nonref => 1} ) if $me
THODS
=head2 new()
Object constructor.
=head2 TO_JSON()
Returns HashRef that is possible to give to C<encode_json()> function.
=cut
sub TO_JSON {
my ($self) = @_;
return {
m
oo::MySelf;
use AC::MrGamoo::EUConsole;
use AC::MrGamoo::Stats;
use AC::DC::IO;
use AC::Misc;
use JSON;
use Time::HiRes 'time';
use strict;
# RSN - config? tune?
our $TASKTIMEOUT = 10;
our $XFERTIMEO
w job: $me->{request}{jobid} ($me->{request}{traceinfo})");
my $cf = $me->{options} = decode_json( $me->{request}{options} ) if $me->{request}{options};
# open connection to eu-console
# $Id: SolveMedia.pm,v 1.1 2010/09/13 18:01:06 ilia Exp $
package WWW::SolveMedia;
use Carp;
use JSON;
use LWP::UserAgent;
use Digest::SHA1 'sha1_hex';
use strict;
our $VERSION = '1.1';
my $AC_AP
";
if( $opts ){
$html .= " <script>\n var ACPuzzleOptions = "
. encode_json($opts)
. ";\n </script>\n";
}
my $baseurl = $sslp ? $me->{https} : $me->{http
THODS
=head2 new()
Object constructor.
=head2 TO_JSON()
Returns HashRef that is possible to give to C<encode_json()> function.
=cut
sub TO_JSON {
my $self = shift;
return {
$self->get_id, $resource->get_resource_name,
$resource->get_id ),
{format => 'json'}
);
return $result;
}
1;
__END__
=head1 NAME
WWW::BigDoor::Attribute - Attribute Reso
nt->POST( sprintf( '%s/%s/execute/%s', $ep, $self->get_id, $end_user_login ),
{format => 'json'}, $payload );
return $result;
}
1;
__END__
=head1 NAME
WWW::BigDoor::NamedTransactionGrou
rGamoo::AC::FileList;
use AC::MrGamoo::Debug 'files';
use AC::ISOTime;
use AC::Yenta::Direct;
use JSON;
use strict;
my $YDBFILE = "/home/acdata/logfile.ydb";
# return an array of:
# {
# filena
} map {
#debug("file: $_");
my $d = $yenta->get($_);
$d = $d ? decode_json($d) : {};
$d->{location} = [ map { $CONVERT{$_} || $_ } (split /\s+/, $d->{location}) ];
T( sprintf( '%s/%s', $ep, $self->get_id ), {format => 'json'}, $payload );
}
else {
$result = $client->POST( $ep, {format => 'json'}, $payload );
}
### result: $result->[0]
use Digest::SHA1 'sha1';
use Digest::MD5 'md5';
use File::Path;
use Sys::Syslog;
use Socket;
use JSON;
use strict;
my $STATUSTIME = 5; # seconds
my $MAXRUN = 3600; # override with %attr maxr
md5( $key ));
my $p = $hash % $n;
my $io = $me->{outfd}[$p];
$io->output( encode_json( [ $key, $data ] ), "\n" );
}
# end-user's 'print' come here
sub eu_print_stdout {
my $me =
chomp;
_maybe_update_status( $me, 'RUNNING', $linen++ );
my $x = decode_json($_);
$f_final->( $x->[0], $x->[1] );
}
$h_final->{cleanup}() if $h_f
THODS
=head2 new()
Object constructor.
=head2 TO_JSON()
Returns HashRef that is possible to give to C<encode_json()> function.
=cut
sub TO_JSON {
my $self = shift;
my %hash = (
ON
extends 'Chart::OFC2::BarLineBase';
In L<Chart::OFC2::HBarValues> when converting values to JSON the values are
reversed. This is done so that the C<y_axis->labels> match to the values.
Also not
is_max($max)
if defined $max;
}
=head2 TO_JSON()
Returns HashRef that is possible to give to C<encode_json()> function.
=cut
sub TO_JSON {
my $self = shift;
return {
nings;
use Pipe::Between::Object;
use LWP::UserAgent;
use HTTP::Request::Common qw(GET POST);
use JSON;
use utf8;
use Desktop::Notify;
use Encode::Guess qw/shiftjis euc-jp 7bit-jis/;
use Encode qw/fro
);
our $VERSION = '0.02';
# Preloaded methods go here.
our $ua = LWP::UserAgent->new;
our $json = JSON->new->allow_nonref;
sub new {#{{{
my $class = shift;
my $self = {
who => 'Net::Chaton::A
= POST($apilogin_url, [%postdata]);
my $responce = $ua->request($req);
my $decoded_responce = $json->decode($responce->content);
$self->{'post-uri'} = $decoded_responce->{'post-uri'};
$self->{'co
THODS
=head2 new()
Object constructor.
=head2 TO_JSON()
Returns HashRef that is possible to give to C<encode_json()> function.
=cut
sub TO_JSON {
my $self = shift;
return {
THODS
=head2 new()
Object constructor.
=head2 TO_JSON()
Returns HashRef that is possible to give to C<encode_json()> function.
=cut
sub TO_JSON {
my $self = shift;
return {
map
use File::ShareDir qw( dist_file );
use File::Spec;
use File::Slurp;
use Pod::Simple::Search;
use JSON::XS;
use Path::Class::File;
use Pod::POM;
use XML::Simple;
use LWP::Simple;
use List::MoreUtils q
=> $data->{matches}};
while(my($k,$v) = each %{$output->{module}}) {
}
$c->res->body(encode_json($data));
}
sub module : Local {
my ( $self, $c, $module ) = @_;
my $search = Pod::Simple::Sea
arser->parse($source);
$toc = $view->print($pom);
return encode_json( _toc_to_json( [], split( /\n/, $toc ) ) );
}
sub _toc_to_json {
my $tree = shift;
my @sections = @_;
my @uniq = uniq
__PACKAGE__->apply_request_class_roles(qw/
Catalyst::TraitFor::Request::DecodedParams::JSON
/);
1;
=head1 METHODS
=over
=item decoded_query_parameters
decoded_query_params, dqu