API
$WWW::Pusher::Client::VERSION = '0.04';
use strict;
use warnings;
use 5.010_001;
use Moo;
use JSON;
use Carp;
use AnyEvent::WebSocket::Client;
use Digest::SHA qw(hmac_sha256_hex);
has 'auth_key'
my $body = from_json($message->decoded_body);
if ($body->{event} eq 'pusher:connection_established') {
$self->_socket_id(from_json($body->{data})->{socket_id}
my $data = $self->_construct_private_auth_data($channel);
return $self->ws_conn->send(to_json({
event => 'pusher:subscribe',
data => $data
}));
}
sub _construct_private_a
file extension, the value is the MIME type to send.
my %type_override = (
'json' => 'application/json; charset=UTF-8',
'htc' => 'text/x-component',
);
return ($type_overr
ote stuff in onfoo handlers...
my $onchange = 'Jifty.update('
. Jifty::JSON::encode_json({
actions => {},
action_arguments => {},
rict;
use warnings;
use bignum;
use base 'Salvation::AnyNotify::Plugin::Graphite::Monitor';
use JSON ();
use Salvation::Method::Signatures;
use constant {
POINT_IDX_TIME => 1,
POINT_IDX_VA
if( scalar( @warnings ) > 0 ) {
my $bus = $core -> bus();
my $json = JSON
-> new()
-> allow_blessed()
-> al
foreach my $warning ( @warnings ) {
$bus -> notify( $warning -> { 'type' }, $json -> encode( $warning ) );
}
}
}
};
}
1;
__END__
lso automatically published as web services.
Clients can POST requests, usually using the YAML or JSON request
format. See C<bin/service> for a trivial generic webservice client.
(XXX TODO More abou
less $trigger_structure->{preload_key};
my @preloaded;
my $preload_json = Jifty::JSON::encode_json(
{
fragments => $trigger_structure->{fragments},
cture->{preload_key},
}
);
push @javascript, "Jifty.preload($preload_json, this);";
}
return join "\n", @javascript;
}
=head2 render_hints
Renders any hints for
:Dispatcher -base;
use Jifty::YAML ();
use Jifty::JSON ();
use Data::Dumper ();
use XML::Simple;
use URI::Escape ();
before qr{^ (/=/ .*) \. (js|json|yml|yaml|perl|pl|xml|html) $}x => run {
Jifty
ts:
JSON, JS, YAML, XML, Perl, and HTML
and may be requested in such formats by sending an appropriate HTTP Accept: header
or appending one of the extensions to any resource:
.json, .js, .y
rns the user's desired output format. Returns a hashref of:
format: JSON, JS, YAML, XML, Perl, or HTML
extension: json, js, yml, xml, pl, or html
content_type: text/x-yaml; charset=UTF-8,
t fallback method yet.
=back
=cut
use base qw/Jifty::Object Class::Accessor::Fast/;
use Jifty::JSON;
=head2 handlers
The following handlers are supported:
onclick onchange ondblclick onmousedown
;
if ( @$fragments or ( !$actions || %$actions ) ) {
my $update_json = Jifty::JSON::encode_json({
actions => $actions,
action_argument
$update = $trigger eq "onclick" ? "Jifty.c(event,$update_json,this)"
: "Jifty.update($update_json,this);";
$string .= "return $update";
# ABSTRACT: An OO interface to UrbanDictionary.com's JSON API.
our $VERSION = "2.015";
use Carp;
use strict;
use warnings;
use Moo;
use JSON;
use LWP::UserAgent;
use WebService::UrbanDictionary::
= shift or carp "No term provided.";
my $url = $self->_end_point_url . $term;
my $res = decode_json $self->_ua->get( $url )->decoded_content or carp "Error during fetch/decode.";
$res->{term} = $t
_END__
=pod
=head1 NAME
WebService::UrbanDictionary - An OO interface to UrbanDictionary.com's JSON API.
=head1 VERSION
version 2.015
=head1 SYNOPSIS
use WebService::UrbanDictionary;
my $ud
ebService::UrbanDictionary> objects upon successfully retreiving data from UrbanDictionary.com's
JSON API.
=head2 Methods
=over 12
=item C<< definition >>
Returns either an array of hashes contai
alhost/db') };
get '/' => sub {
my $c = shift;
my $db = $c->mysql->db;
$c->render(json => $db->query('select now() as time')->hash);
};
app->start;
Every database connection can
alhost/db') };
get '/' => sub {
my $c = shift;
my $db = $c->mysql->db;
$c->render(json => $db->query('select now() as time')->hash);
};
app->start;
Every database connection can
=> 'XML::Simple',
'text/x-yaml' => 'YAML',
'application/json' => 'JSON',
'text/x-json' => 'JSON',
'text/x-data-dumper' => 'Data::Dumper',
'text/x-data-denter' =>
r $VERSION = '0.001';
use v5.14;
use strict;
use warnings;
use parent qw/Exporter/;
use JSON qw/encode_json/;
use Log::Log4perl qw//;
use DB_File qw//;
use Storable qw/freeze thaw/;
use App::FonB
package MojoX::AlmostJSON;
$MojoX::AlmostJSON::VERSION = '1.151250';
# ABSTRACT: Almost JSON but allow javascript function
# Code stolen from Mojo::JSON
use Mojo::Base -strict;
use B;
use Carp 'croa
ed';
our @EXPORT_OK = qw(decode_json encode_json false from_json j to_json true);
# Booleans
my ($FALSE, $TRUE) = map { bless \(my $dummy = $_), 'MojoX::AlmostJSON::_Bool' } 0, 1;
# Escaped spec
$_} //= sprintf '\u%.4X', $_ }
sub decode_json {
my $err = _decode(\my $value, shift);
return defined $err ? croak $err : $value;
}
sub encode_json { Mojo::Util::encode 'UTF-8', _encode_value
ION
Handles pulling in symbol-related data versioned by date.
=cut
use Net::SSL;
use JSON qw(to_json from_json);
use List::Util qw(min max);
use Moose::Role;
use Carp;
use URL::Encode qw(:all);
use
:Status qw/HTTP_BAD_REQUEST HTTP_OK HTTP_NO_CONTENT HTTP_FORBIDDEN HTTP_UNAUTHORIZED/;
use JSON qw/encode_json/;
use Log::Log4perl;
use POE::Component::Server::HTTP qw/RC_OK RC_DENY RC_WAIT/;
use DB_
;
if (exists $commands{$user}) {
my $json=encode_json thaw $commands{$user};
$log->debug("Sending JSON: $json to $user");
$response->content($json);
$response->code(HTTP_OK);
$respon
);
if (exists $responses{$user}) {
my $json=encode_json $responses{$user};
$log->debug("Sending JSON: $json to $user");
$response->content($json);
$response->code(HTTP_OK);
$response
variables, to more closely imitate the state of a non-javascript
enabled client. It constructs a JSON request based on that
information, and passes it off to the XML web-service endpoint on the
serve
and add Ajax interactions to your web pages.
=item C<JSON> L<http://json.org>
Hereby, major support for encoding and decoding data into the JSON
data format (similar to C<YAML>) is provided.
=item
e . Defaults to C</test>.
=item lib_dir
By default the plugin uses a version of Jasmine and its JSON reporter bundled
in its share folder. If you prefer to use your own version of
Jasmine, you can
PhantomJS, we could use:
use strict;
use warnings;
use Test::More;
use JSON qw/ from_json /;
use Test::TCP;
use WWW::Mechanize::PhantomJS;
use Dancer::Plugin::Test::J
$mech->get("http://localhost:$port?test=verify_title");
jasmine_results from_json
$mech->eval_in_page('jasmine.getJSReportAsString()';
},
server =