t => 0.3;
has 'storage_class' => is => 'lazy', isa => NonEmptySimpleStr,
default => 'JSON';
has 'tab_title' => is => 'lazy', isa => NonEmptySimpleStr,
default => 'Shell';
ime>
Time in seconds to sleep whilst C<DBus> settles down
=item C<storage_class>
Defaults to C<JSON>. Format of the configuration file
=item C<tab_title>
Defaults to C<Shell>. String used for the
utput eq 'json' ) {
eval {
require JSON;
JSON->import;
print encode_json( \@found );
} or do {
die "You require the module JSON for this
age RDF::vCard::Entity;
use 5.008;
use strict;
use warnings;
no warnings qw(uninitialized);
use JSON qw[];
use RDF::TrineX::Functions
-shortcuts,
statement => { -as => 'rdf_statement' },
iri
return $self;
}
sub to_jcard
{
my ($self, $hashref) = @_;
return ($hashref ? $self->TO_JSON : JSON::to_json($self));
}
{
my @singular = qw(fn n bday tz geo sort-string uid class rev
anniversary
dday death gender kind prodid sex version);
my @typed = qw(email tel adr label impp);
sub TO_JSON
{
my ($self) = @_;
my $object = {};
foreach my $line (@{ $self->lines })
{
my $p =
my $accept = join q{, } => (
'application/sparql-results+xml',
'application/sparql-results+json;q=0.9',
'application/rdf+xml',
'application/x-turtle',
'text/turtle',
);
my $agent =
ocal $@ = undef;
my $iterator = eval
{
if ($response->content_type =~ /json/)
{ RDF::Trine::Iterator->from_json($response->decoded_content); }
else
{ RDF::Trine::Iterator->from_strin
ref to tie hash to" unless ref $ref eq 'SCALAR';
$implementation = "Scalar::Accessors::LikeHash::JSON" unless defined $implementation;
Module::Runtime::use_package_optimistically($implementation);
LikeHash> role. If the implementation is omitted, then
defaults to L<Scalar::Accessors::LikeHash::JSON>.
=head1 BUGS
Please report any bugs to
L<http://rt.cpan.org/Dist/Display.html?Queue=Scalar-Acc
$invocant->_empty_structure;
}
1;
__END__
=head1 NAME
Scalar::Accessors::LikeHash - access a JSON/Sereal/etc scalar string in a hash-like manner
=head1 SYNOPSIS
{
package Acme::Storabl
sors::LikeHash::JSON";
$string->store(foo => 42);
Or as class methods passing the scalar reference as an extra first argument:
my $string = "{}";
Scalar::Accessors::LikeHash::JSON->store(\$string
tations, see L<Scalar::Accessors::LikeHash::JSON>
and L<Scalar::Accessors::LikeHash::Sereal>.
For an insane usage of this concept, see L<Acme::MooseX::JSON>.
=head1 AUTHOR
Toby Inkster E<lt>tobyink
=head1 NAME
JSON::Schema::Examples - examples of JSON::Schema
=head1 EXAMPLES
=head2 Validate some JSON contact info against nested schemas.
The card schema at L<http://json-schema.org/card> is tr
eed to be followed. But JSON::Schema
handles it with ease...
use JSON qw[to_json];
use JSON::Schema;
use LWP::Simple qw[get];
# Here's some data...
my $contact = to_json({
fn => 'Tob
n => 'East Sussex' },
});
# Now we create our JSON Schema validator:
my $card_schema = get('http://json-schema.org/card');
my $validator = JSON::Schema->new($card_schema);
# Validate:
my $v
pan:TOBYINK';
$Plack::Middleware::Auth::Bitcard::VERSION = '0.002';
}
use Carp;
use JSON qw(to_json from_json);
use Plack::Response;
use Plack::Request;
use Plack::Util;
use Plack::Util::Accessor
ard->api_secret . $user->{username});
$res->cookies->{bitcard} = to_json($user);
}
else
{
$res->cookies->{bitcard} = to_json({});
}
$req->cookies->{bitcard_return_to} = { value => "-" };
ret
$self = shift;
my ($req, $env) = @_;
return unless $req->cookies->{bitcard};
my $user = from_json($req->cookies->{bitcard});
return unless $user->{username};
return unless sha1_hex($self->bit
ge_format => 'text',
notify => 1,
color => 'yellow',
format => 'json',
});
unless ($response->is_success) {
warn "Hipchat notification failed!";
warn $resp
es::MooseLike::Base qw( Str CodeRef ArrayRef InstanceOf );
use Carp qw( confess );
use JSON qw( from_json to_json );
use HTML::HTML5::Entities qw( encode_entities_numeric );
use constant read_only =>
$self, $req) = @_;
my $id = $self->make_paste_id;
$self->storage->file("$id.paste")->spew(
to_json( +{ %{$req->parameters} } ),
);
return Response->new(
302,
[
'Content-Type' => 'text/pla
rage->file("$id.paste");
-r $file or return $self->show_error("Bad file", 404);
my $data = from_json($file->slurp);
exists $req->parameters->{raw}
? Response->new(200, ['Content-Type' => 'text/
rt.cpan.org/Dist/Display.html?Queue=Syntax-Highlight-RDF>.
=head1 SEE ALSO
L<Syntax::Highlight::JSON2>,
L<Syntax::Highlight::RDF>.
=head1 AUTHOR
Toby Inkster E<lt>tobyink@cpan.orgE<gt>.
=head1 CO
sub to_hashref
{
my ($self) = @_;
$self->[IDX_USED] ||= {};
return $self->[IDX_USED];
}
*TO_JSON = \&to_hashref;
sub rdfa
{
my ($self) = @_;
my $rv;
foreach my $prefix (sort keys %$self)
{
("%s => %s\n", $prefix, $context->{$prefix});
}
=item C<< TO_JSON >>
A synonym for to_hashref, provided for the benefit of the L<JSON> package.
=item C<< rdfa >>
Return the same data as C<to_has
return "Syntax::Highlight::XML"->new;
};
$hint =~ m{json}i and do {
require Syntax::Highlight::JSON2;
return "Syntax::Highlight::JSON2"->new;
};
$hint =~ m{(ttl|turtle)}i and retur
s yet)
=item *
SPARQL Update 1.1 (but not property paths yet)
=item *
JSON - intended for RDF/JSON and SPARQL Results JSON, but just generic highlighting
=item *
XML - intended for RDF/XML and S
rt.cpan.org/Dist/Display.html?Queue=Syntax-Highlight-RDF>.
=head1 SEE ALSO
L<Syntax::Highlight::JSON2>,
L<Syntax::Highlight::XML>.
L<PPI::HTML>,
L<Syntax::Highlight::Engine::Kate>.
L<RDF::Trine>,
package Number::Natural::SetTheory;
use 5.010;
use boolean;
use JSON qw/to_json/;
use strict;
use utf8;
our (@EXPORT, @EXPORT_OK, %EXPORT_TAGS);
BEGIN
{
$Number::Natural::SetTheory::AUTHORITY = 'c
return scalar @$set;
}
return undef;
}
sub set_to_string
{
my ($set) = @_;
my $string = to_json($set);
$string =~ s/\[/\{/g;
$string =~ s/\]/\}/g;
return $string;
}
'What exactly is zero?';
ode($s);
print($s);
}
}
sub json_encode($) {
if ( use_try 'JSON::XS' ) { return \( JSON::XS->new->encode(@_) ) }
if ( use_try('JSON') ) { return \( JSON->new->encode(@_) ); }
{
loc
lugin('DBI');
# __PACKAGE__->load_plugin('Web::FillInFormLite');
# __PACKAGE__->load_plugin('Web::JSON');
__PACKAGE__->enable_session();
__PACKAGE__->to_app(handle_static => 1);
__DATA__
@@ index.
.');
Makefile
inc/
MANIFEST
*.bak
*.old
nytprof.out
nytprof/
*.db
blib/
pm_to_blib
META.json
META.yml
MYMETA.json
MYMETA.yml
...
}
1;
__END__
=head1 NAME
Amon2::Setup::Flavor::Lite - Amon2::Lite fl
;
if ( $param->{'json'} and psmisc::use_try 'JSON' ) {
$config{'view'} = 'json';
my $j = {};
eval { $j = JSON->new->decode( $param->{'json'} ) || {} }; #allow_
r\n>" ); }
exit;
};
$config{'out'}{'json'}{'http-header'} = "Content-type: application/json\n\n";
$config{'out'}{'json'}{'footer'} ||= sub {
my ( $param, ) = @_;
$param->{'callback'} . '(':'') ,${ psmisc::json_encode($param->{__result} || {}) }, ($param->{'callback'} ? ');' : '');
};
$config{'out'}{'json'}{'result_string'} ||= sub {
my ( $
che cache_A01 --alternatives
ironcache.pl list items .+ --cache cache_A01 --config iron_cache.json
ironcache.pl list items item.01_0[[:digit:]]{1} --cache cache_B05
ironcache.pl list items
)
=item * filling in missing data (combining data)
=item * converting formats (from CSV to XML, JSON, CSV, whatever)
=back
=head1 METHODS
=head2 new
This is the constructor.
The constructor tak
ile_name = 'iron_cache.json';
BAIL_OUT("File " . $config_file_name . " not exists! Quitting...") if(!-e $config_file_name);;
my $policies_file_name = 'iron_cache_policies.json';
my $policies_file_c