0.10';
use File::Slurp qw/slurp/;
use File::Spec;
use File::Find ();
use File::ShareDir ();
use JSON ();
use JavaScript::V8;
our $LOG = 0;
my $module_dir = File::ShareDir::module_dir( __PACKAGE__
= @_;
$self->c->bind( console => {
log => sub {
my $json = JSON->new->pretty->utf8;
for( @_ ) {
if( ref $_ ) {
print $json->encode( $_ );
}
else {
print "$_\n";
}
::Types->new;
$mimes->addType(
MIME::Type->new(
type => 'text/x-json',
extensions => [qw/json/]
)
);
$mimes->addType(
MIME::Type->new(
type => 'text/x-y
>mimeTypeOf('rss');
}
sub wants_json {
my $self = shift;
my $c = $self->context;
return $c->request->preferred_content_type eq $mimes->mimeTypeOf('json');
}
sub wants_yaml {
my $
id($id);
$c->stash->{'entity'} = $user;
};
http://localhost/user/1?view=json
=head1 DESCRIPTION
Mango::Catalyst::Controller::REST is a base Catalyst controller that
automat
args) {
my ($key, $value) = splice @args, 0, 2;
$self->{$key} = $value;
weaken($self->{$key}) if ref $value;
}
return $self;
} ## end sub set
sub TO_JSON { return undef }
1;
s $opts->{all};
}
} else {
my $p;
for my $e (".js", ".json", ".node") {
$p = "$d/$name$e";
if (-f $p) {
last unless $opts->{all};
} elsif (-f "$p/package.json") {
push @res, "$p/package.json";
last unless $opts->{all};
}
dule is found, or string containing the found path.
Known options:
=over
=item * parse_package_json => bool (default: 0)
Not yet implemented.
=item * cwd => str
Use this directory instead of usi
$object->{what}->frobozz; # called on $ref1 if still alive
# TO_JSON always returns undef
my $will_be_undef = $object->TO_JSON;
=head1 DESCRIPTION
This module provides a little wrapper class
on't have
to worry about circular references.
Additionally, when some JSON encoder tries to encode this object calling
L</TO_JSON>, it will get C<undef> back. This comes handy if you want to
e.g. def
rns C<$object> for possible chaining.
=head2 B<< TO_JSON >>
my $this_is_undef = $object->TO_JSON;
Return C<undef>. This will be called by JSON encoders when configured to
do so for blessed objec
package Net::Pface;
use strict;
use warnings;
use JSON::XS;
use utf8;
use HTTP::Request;
use LWP::UserAgent;
use Encode;
our $VERSION = '1.02';
my %def = (
server =>
,
agent => 'Net-Pface-' . $VERSION,
type => 'application/json',
cache_time => 300
);
sub new {
my $class = shift;
my $self = {@_}
# init json::xs
$self->{'json_xs'} = JSON::XS->new();
#init cache data
$self->{'cache_data'} = {};
return $self;
}
# get data from users.get.json
sub get {
ly) a super set of JSON you can
% # convert perl structures into config items using json
% # function:
% # (json method requires Clustericious::Config 0.25)
other_urls: <%= json [ @{ cluster->urls
the L<Clustericious> application
name. The second string is the configuration in either YAML
or JSON format (may include L<Mojo::Template> templating in it,
see L<Clustericious::Config> for details)
ET /audit
You can do a simple GET on this route to see if the plugin is loaded.
It will return a JSON string with the version of the plugin as the body
and 200 if the plugin is available, if not L<Pl
$title,
body => $body });
=cut
use strict;
use warnings;
use Data::Dump qw(dump);
use JSON;
use LWP::UserAgent;
use MIME::Types;
our $VERSION = 'v1.6.0';
my %PUSHBULLET = (
REALM
tacts");
if ($res->is_success)
{
$self->_update_limits($res);
my $data = JSON->new->decode($res->content);
return ($data->{contacts});
}
else
{
pri
vices");
if ($res->is_success)
{
$self->_update_limits($res);
my $data = JSON->new->decode($res->content);
return ($data->{devices});
}
else
{
prin
huh?
}
sub parse_request {
my ($self, $request) = @_;
my @updates = $request->json;
return @updates;
}
sub render_response {
my ($self, $controller, $response, $
= $response->{chat_id}
// $update->{message}{chat}{id};
return $controller->render(json => $response);
}
1;
=head1 DESCRIPTION
This is an updates receiver and dispatcher role f
ssage::Request> and return all the updates
inside.
Defaults to just returning C<< $req->json >>, i.e. the JSON decoding of
the request's content, which should work in most cases. You should
override
TTP::Request::Common qw(POST);
use AnyEvent::HTTP::MultiGet;
use AnyEvent::WebSocket::Client;
use JSON;
use namespace::clean;
use IO::Socket::SSL;
our $VERSION='1.0005';
BEGIN {
no namespace::clea
$json,$conn_data)=@_;
if(exists $json->{type} and $json->{type} eq 'desktop_notification') {
my $ref={
type=>'message',
bot_id=>$sb->bot_id,
channel=>$json-
text=>'this is a test',
subtype=>'bot_message',
};
print Dumper($json,$ref);
$sb->send($ref);
}
},
);
my $result=$sb->connect_and_run;
die $re
l reasons, some routes return text by default
# in older versions, even if a format (e.g. /auth.json) is specified.
# this is a simple helper to render using autodata if a format
# is explicitly
> sub { shift->data }, fallback => 1;
use Mojo::Util 'b64_encode';
has [qw(data type)];
sub TO_JSON { b64_encode shift->data, '' }
1;
=encoding utf8
=head1 NAME
Mango::BSON::Binary - Binary typ
container for the BSON binary type used by
L<Mango::BSON>. For C<JSON> implementations like L<Mojo::JSON>, that support
the C<TO_JSON> method, it will automatically C<Base64> encode the binary data.
its all methods from L<Mojo::Base> and implements
the following new ones.
=head2 TO_JSON
my $b64 = $bin->TO_JSON;
Base64 encode L</"data">.
=head1 OPERATORS
L<Mango::BSON::Binary> overloads the
up, $action, $resource) = map { $c->stash($_) } qw( group action1 resource );
$resource =~ s/\.(json|yml)$//;
if($c->authz->grant($group, $action, $resource))
{
$c->render_message('ok',
up, $action, $resource) = map { $c->stash($_) } qw( group action1 resource );
$resource =~ s/\.(json|yml)$//;
if($c->authz->revoke($group, $action, $resource))
{
$c->render_message('ok',
ead3 POST /user
Create a user. The C<username> and C<password> are provided autodata arguments
(JSON, YAML, form data, etc).
If supported by your authentication plugin (requires C<create_user_cb> t
alues
=item *
Support HTML checkbox as bool
=item *
Simple JSON values extraction and validation using JSON Pointer from
L<Mojo::JSON::Pointer>.
=item *
Simple XML/HTML values extraction and val
is not work if you site has i18n.
=head2 json
JSON incapsulated as form parameter.
=head2 address
Location address. Two forms are parsed: string and json.
Can verify adress sign to trust source.
turn
formatted scalar.
=head2 jpath
If you POST data not form but raw JSON you can use JSON Pointer selectors
from L<Mojo::JSON::Pointer> to get and validate parameters.
# POST data contains:
package WWW::Connpass::Event::Question;
use strict;
use warnings;
use JSON 2;
use Module::Load ();
my @QUESTION_TYPES = qw/FreeText CheckBox Radio PullDown/;
sub _answer_type { die "this is abstrac
answer_type;
}
# normalize required option
$args{required} = $args{required} ? JSON::true : JSON::false;
# normalize answer_frame to options
if (exists $args{answer_frame}) {
# JSON Pointer
unless(exists $vars->{json}) {
$vars->{json} =
Mojolicious::Plugin::Vparam::JSON::parse_json(
}
if( $vars->{json} ) {
$vars->{pointer} //=
Mojo::JSON::Pointer->new( $vars->{json} );
if( $vars->{pointe
# JSON Pointer
unless (exists $vars->{json}) {
$vars->{json} =
Mojolicious::Plugin::Vparam::JSON::parse_json(
any
#pod others. All named items are written to F<META.json> (and maybe to F<META.yml>) automatically, all
#pod you need is just using C<MetaJSON> and/or C<MetaYAML> plugin(s) in your F<dist.ini> file
sa.pm]
#pod filename = lib/Assa.pm
#pod content = package Assa; 1;
#pod [MetaJSON]
#pod [FakeRelease]
#pod
#pod =encoding UTF-8
#pod
#pod =head2 C<Test::Version> adaptive stri
est::Version' );
#pod . = $tv->{ is_strict } = $dist->is_trial ? '0' : '1';
#pod [MetaJSON]
#pod [FakeRelease]
#pod
#pod =encoding UTF-8
#pod
#pod =head2 Template Variables
#pod
#pod I
= '1.03'; # VERSION 1.03
use strict;
use warnings;
use Algorithm::CurveFit;
use Time::HiRes;
use JSON::PP;
our %STATS_H; # side-products of fit() stored here for profiling purposes
BEGIN {
req
sion;
use strict;
use warnings;
use Carp qw/croak/;
use Web::Query qw/wq/;
use Text::CSV_XS;
use JSON 2;
use URI;
use WWW::Connpass::Agent;
use WWW::Connpass::Event;
use WWW::Connpass::Event::Questi
nnpass::Place;
use WWW::Connpass::User;
use constant DEBUG => $ENV{WWW_CONNPASS_DEBUG};
my $_JSON = JSON->new->utf8;
sub new {
my ($class, $user, $pass, $opt) = @_;
my $mech = WWW::Connpas
=> $opts->{group}->id) : (),
});
_check_response_error_or_throw($res);
my $data = $_JSON->decode($res->decoded_content);
return WWW::Connpass::Event->new(session => $self, event => $