3.org/TR/ldp/>
for an example of the kind of data services Dallycot will target. Dallycot
prefers JSON-LD when communicating with services.
Dallycot is not a query language. Projects like L<Marmotta|
stant coffee_files => [];
use constant js_files => [qw(
jquery.js
jquery-ui.js
jquery-json.js
jquery.cookie.js
jquery.jemplate.js
jemplate.js
cog.js
config.js
url-m
ed on url
# Return results or OK
my $self = shift;
$self->env(shift);
$self->read_json;
my $path = $self->env->{PATH_INFO};
my $post_map = $self->config->post_map;
my ($reg
plication/json' ],
[ $self->json->encode($result) ]
];
}
else {
return [ 200, [ 'Content-Type' => 'text/plain' ], [ $result ] ];
}
}
sub response_json {
my
package Dallycot::AST::JSONProperty;
our $AUTHORITY = 'cpan:JSMITH';
# ABSTRACT: Create JSON-LD graph from JSON
use strict;
use warnings;
use utf8;
use parent 'Dallycot::AST';
use experimental qw(
a JSON-LD
document. This makes the examples easier to write. There's no reason
you can't publish as RDF/XML or some other serialization that supports
RDF.
Dallycot allows you to embed code in a JSON
even easier to write:
{
"@context": [
<https://www.dhdata.org/ns/linked-code/1.0.json>,
{
ns:l := <http://www.example.com/our-library#>,
@base: <http://www.ex
e in the scope of the array will become
JSON objects with the identifier as the C<@id>. If the scope were a JSON
object instead of an array, then the same JSON objects would be made, but
the C<@id> w
# System singleton object pointers.
my $app;
my $config;
my $maker;
my $runner;
my $webapp;
my $json;
# The config reference must be initialized at startup.
$Cog::Base::initialize = sub {
$app
a set up JSON object
sub json {
$json ||= do {
require JSON;
my $j = JSON->new;
$j->allow_blessed;
$j->convert_blessed;
$j;
};
return $json;
}
1;
strict;
use warnings;
use utf8;
use parent 'Dallycot::AST';
use Promises qw(deferred);
sub to_json {
}
sub to_string { return "" }
sub is_declarative { return 1 }
sub identifier { }
sub as_tex
package Dallycot::AST::JSONArray;
our $AUTHORITY = 'cpan:JSMITH';
# ABSTRACT: Create JSON-LD graph from JSON
use strict;
use warnings;
use utf8;
use parent 'Dallycot::AST';
use experimental qw(swi
Imager;
use URI::Escape 'uri_escape';
use List::MoreUtils 'none';
use WWW::Mechanize;
use JSON::XS 'decode_json';
use Data::asXML 0.07;
use meon::Web::Form::Login;
use meon::Web::Form::Delete;
use me
if ($res->header('Content-Type') =~ m{application/json}) {
my $data = eval { decode_json($res->content) };
if ($data && $data->
EMPLATE_EXTENSION => '.xsl',
},
'View::JSON' => {
allow_callback => 1,
callback_param => 'cb',
expose_stash => 'json',
},
'Plugin::Session' => { expires =>
e_dir, 'www') ];
}
sub json_reply {
my ( $c, $json_data ) = @_;
$c->res->header('X-Ajax-Controller',1);
$c->stash->{json} = $json_data;
$c->detach('View::JSON');
}
sub member {
package Test::JsonAPI::Autodoc::Request;
use strict;
use warnings;
use utf8;
use Carp;
use JSON;
use URL::Encode qw/url_params_flat/;
sub new {
my ($class) = @_;
bless {
}, $class;
}
su
ontent_type;
my $is_json = 0;
if ($content_type =~ m!^application/json!) {
$body = to_json(from_json($req->decoded_content), { pretty => 1 });
$is_json = 1;
}
my $tar
method => $req->method,
parameters => $self->_parse_request_parameters($body, $is_json, $param_description),
path => $req->uri->path,
query => $req->uri-
package HAL::Tiny;
use 5.008001;
use strict;
use warnings;
use JSON qw/encode_json/;
our $VERSION = "0.03";
sub new {
my ($class, %args) = @_;
my ($state, $links, $embedded)
= @arg
d} = $v;
}
return %hash;
}
sub as_hashref {
+{ $_[0]->as_hash };
}
sub as_json {
encode_json($_[0]->as_hashref);
}
1;
__END__
=encoding utf-8
=head1 NAME
HAL::Tiny - Hypertext
,
find => {
href => '/orders{?id}',
templated => JSON::true,
},
},
embedded => +{
orders => [
H
package Test::JsonAPI::Autodoc::Response;
use strict;
use warnings;
use utf8;
use JSON;
sub new {
my ($class) = @_;
bless {
}, $class;
}
sub parse {
my ($self, $res) = @_;
my $
my $content_type = $res->content_type;
if ($content_type =~ m!^application/json!) {
$body = to_json(from_json($res->decoded_content, { utf8 => 1 }), { pretty => 1, canonical => 1 });
}
en> simpler INI files).
For XML, JSON, and YAML, there are many modules available,
some examples are:
L<YAML::XS|YAML::XS>,
L<XML::Simple|XML::Simple>,
and L<JSON|JSON>.
=back
=head1 Author, Copyrig
e Test::JsonAPI::Autodoc::Markdown;
use strict;
use warnings;
use utf8;
use Data::Section::Simple;
use Time::Piece;
use Text::Xslate qw(mark_raw);
use Text::Xslate::Bridge::Star;
use Test::JsonAPI::Au
nerate {
my ($self, $description, $results, $first_time) = @_;
my $document_path = Test::JsonAPI::Autodoc::Path->document_path($self->{output_path});
my $vpath = Data::Section::Simple->n
: $tx->render('document.json.tx', $vars);
print $fh $rendered;
close $fh;
}
1;
__DATA__
@@ document.json.tx
: if $generated_at {
generated at: <: $generated_at
username = meon::Web::Util->username_cleanup($username, $c->default_auth_store->folder);
$c->json_reply({
username => $username,
});
}
sub email : Chained('base') PathPart('email') {
ail(
members_folder => $members_folder,
email => $email,
);
$c->json_reply({
registered => ($member ? 1 : 0),
});
}
__PACKAGE__->meta->make_immutable;
package Test::JsonAPI::Autodoc;
use 5.008005;
use strict;
use warnings;
use parent qw/Exporter/;
use Carp;
use Test::More ();
use Scope::Guard;
use LWP::UserAgent;
use Test::JsonAPI::Autodoc::Markdown
;
use Test::JsonAPI::Autodoc::Request;
use Test::JsonAPI::Autodoc::Response;
our @EXPORT = qw/
describe
http_ok
plack_ok
set_documents_path
set_template
/;
our $VERSION = "0.22";
test($description => $coderef);
if ($result && $results && $ENV{TEST_JSONAPI_AUTODOC}) {
my $markdown = Test::JsonAPI::Autodoc::Markdown->new($output_path, $template);
$markdown->
r;
use strict;
use warnings;
our $VERSION = '0.03';
use LWP::UserAgent;
use HTTP::Request;
use JSON;
use Want;
use URI;
use WWW::RabbitMQ::Broker::Shovel;
sub new
{
my $class = shift;
my $self
lication/json; charset=UTF-8');
$req->authorization_basic($self->{username}, $self->{password});
my $parser = JSON->new->utf8(1);
my $json = $parser->encode($args);
$req->content($json);
my $
package Net::Airbrake::Request;
use strict;
use warnings;
use JSON qw(encode_json);
use Class::Tiny qw(errors context environment session params);
sub BUILDARGS {
my $class = shift;
my ($pa
$param->{$member}{$key} =~ s/./*/g;
}
}
$param;
}
sub to_json {
my $self = shift;
encode_json({
notifier => {
name => "Net-Airbrake/$Net::Airbra
use Data::Dumper;
use Mojo::UserAgent;
use Time::HiRes 'gettimeofday';
use POSIX 'strftime';
use JSON::XS;
use MIME::Base64;
use XML::Simple;
use feature 'say';
=head1 VERSION
Version 0.02
=cut
pping::MRW;
my $MRW = Business::Shipping::MRW->new();
my $Info = $E->TransmEnvio('envio.json');
my $PDF = $E->EtiquetaEnvio($Info->{NumeroEnvio});
=head1 EXPORT
A list of functions t
=cut
sub new {
my $class = shift;
my $file = shift;
my $self;
my $config = OpenJSON($file);
map { $self->{mrw}->{$_} = $config->{$_} } keys %{ $config };
$self->{error
age Net::Airbrake;
use strict;
use warnings;
our $VERSION = '0.02';
use HTTP::Tiny;
use JSON qw(decode_json);
use Scope::Guard qw(guard);
use Net::Airbrake::Request;
use Net::Airbrake::Error;
use
elf->_ua->request(POST => $self->_url, {
content => $req->to_json,
headers => { 'Content-Type' => 'application/json' },
});
die "Request failed to Airbrake: @{[$res->{status}]}
@{[$res->{reason}]} (@{[$res->{content}]})"
unless $res->{success};
decode_json($res->{content});
}
sub notify {
my $self = shift;
my ($error, $option) = @_;
$self->add_err