Group
Extension

Matches 35358

Plack-Middleware-OAuth ( C/CO/CORNELIUS/Plack-Middleware-OAuth-0.10.tar.gz, CORNELIUS, 2011; MetaCPAN )
Plack-Middleware-OAuth/lib/Plack/Middleware/OAuth/UserInfo/GitHub.pm ( view source; MetaCPAN )
 warnings;
use strict;
use parent qw(Plack::Middleware::OAuth::UserInfo);
use LWP::UserAgent;
use JSON;
# use Net::GitHub;

sub create_handle {
    my $self = shift;
    # return Net::GitHub->new( acc
ate_handle;

    my $ua = LWP::UserAgent->new;
    my $uri = URI->new( 'https://github.com/api/v2/json/user/show' );
    $uri->query_form( access_token => $self->token->access_token );
    my $respons
e = $ua->get( $uri );
    my $body = $response->decoded_content;
    return unless $body;

    my $obj = decode_json( $body ) || { };
    return $obj->{user};
}

1;
Plack-Middleware-OAuth ( C/CO/CORNELIUS/Plack-Middleware-OAuth-0.10.tar.gz, CORNELIUS, 2011; MetaCPAN )
Plack-Middleware-OAuth/lib/Plack/Middleware/OAuth/UserInfo/Live.pm ( view source; MetaCPAN )
 warnings;
use strict;
use parent qw(Plack::Middleware::OAuth::UserInfo);
use LWP::UserAgent;
use JSON;

sub query {
    my $self = shift;

    my $ua = LWP::UserAgent->new;
    my $uri = URI->new( 'h
$self->token->access_token );
    my $response = $ua->get( $uri );
    my $body = $response->decoded_content;
    return unless $body;
    my $obj = decode_json( $body ) || {};
    return $obj;
}

1;
Plack-Middleware-OAuth ( C/CO/CORNELIUS/Plack-Middleware-OAuth-0.10.tar.gz, CORNELIUS, 2011; MetaCPAN )
Plack-Middleware-OAuth/lib/Plack/Middleware/OAuth/UserInfo/Facebook.pm ( view source; MetaCPAN )
 warnings;
use strict;
use parent qw(Plack::Middleware::OAuth::UserInfo);
use LWP::UserAgent;
use JSON;

sub query {
    my $self = shift;
    # my $gh = $self->create_handle;

    my $ua = LWP::UserA
m( access_token => $self->token->access_token );
    my $response = $ua->get( $uri );
    my $body = $response->decoded_content;
    return unless $body;
    return decode_json( $body ) || { };
}

1;
Net-GraphSpace ( I/IR/IRONCAMEL/Net-GraphSpace-0.0009.tar.gz, IRONCAMEL, 2011; MetaCPAN )
Net-GraphSpace/lib/Net/GraphSpace/Graph.pm ( view source; MetaCPAN )
package Net::GraphSpace::Graph;
use Moose;

use Carp qw(croak);
use JSON qw(decode_json);
use Net::GraphSpace::Edge;
use Net::GraphSpace::Node;
use Net::GraphSpace::Types;

has name        => (is => '
->add_node($_) foreach @{$_[1]} }

sub add_edges { $_[0]->add_edge($_) foreach @{$_[1]} }

sub TO_JSON {
    my ($self) = @_;
    return {
        metadata => {
            map { defined($self->$_) ? 
       }
    };
}

sub new_from_http_response {
    my($class, $res) = @_;

    my $data = decode_json($res->content);
    my $metadata = $data->{metadata};
    my $graph = Net::GraphSpace::Graph->new
Plack-Middleware-OAuth ( C/CO/CORNELIUS/Plack-Middleware-OAuth-0.10.tar.gz, CORNELIUS, 2011; MetaCPAN )
Plack-Middleware-OAuth/lib/Plack/Middleware/OAuth.pm ( view source; MetaCPAN )
self->redirect( .... );

            return $self->to_yaml( .... );

            return $self->to_json( .... );

            # or just return a raw arrayref
            return [  200 , [ 'Content-type
Net-GraphSpace ( I/IR/IRONCAMEL/Net-GraphSpace-0.0009.tar.gz, IRONCAMEL, 2011; MetaCPAN )
Net-GraphSpace/lib/Net/GraphSpace.pm ( view source; MetaCPAN )
package Net::GraphSpace;
use Moose;

our $VERSION = '0.0009'; # VERSION

use v5.10;
use JSON qw(decode_json);
use LWP::UserAgent;
use Net::GraphSpace::Edge;
use Net::GraphSpace::Graph;
use Net::GraphS
', $self->user, $self->password); 
        return $ua;
    },
);

my $JSON = JSON->new->convert_blessed->utf8;
sub to_json { $JSON->encode(shift) }

sub gen_uri {
    my ($self, $path) = @_;
    #retu
, [], to_json($graph));
        $res = $self->_ua->request($req);
    } else {
        my $uri = $self->gen_uri("users/$user/graphs");
        $res = $self->_ua->post($uri, Content => to_json($graph))
Plack-Middleware-OAuth ( C/CO/CORNELIUS/Plack-Middleware-OAuth-0.10.tar.gz, CORNELIUS, 2011; MetaCPAN )
Plack-Middleware-OAuth/lib/Plack/Middleware/OAuth/GenericHandler.pm ( view source; MetaCPAN )
nericHandler;
use parent qw(Plack::Request);
use warnings;
use strict;
use YAML::Any;
use JSON::Any;

our $json_any;

sub run { 
    my $self = $_[0];
    # get method or post method ?
    my $res;
  
ntent_type { 'text/html' }

sub to_json { 
    my ($self, $obj) = @_;
    $json_any ||= JSON::Any->new;
    return $self->render( $json_any->encode($obj) , 'text/json' );
}

sub to_yaml {
    my ($sel
ng )

=head2 render( $body | String , $content_type | String )

=head2 to_yaml( $obj )

=head2 to_json( $obj )

=head2 post 

POST handler, abstract method.

=head2 get

GET handler, abstract method.
Plack-Middleware-OAuth ( C/CO/CORNELIUS/Plack-Middleware-OAuth-0.10.tar.gz, CORNELIUS, 2011; MetaCPAN )
Plack-Middleware-OAuth/lib/Plack/Middleware/OAuth/UserInfo/Google.pm ( view source; MetaCPAN )
;
use strict;
use parent qw(Plack::Middleware::OAuth::UserInfo);
use LWP::UserAgent;
use URI;
use JSON::Any;

sub query {
    my $self = shift;
    my $ua = LWP::UserAgent->new;
    my $uri = URI->new
s_token ,
        'max-results' => 0,
        'alt'=> 'json',
    );
    my $res = $ua->get($uri);
    warn $res->decoded_content;
    return JSON::Any->new->decode($res->decoded_content) if $res->is_
Prosody ( G/GE/GETTY/Prosody-0.007.tar.gz, GETTY, 2011; MetaCPAN )
Prosody/lib/Prosody/Storage/SQL.pm ( view source; MetaCPAN )
 mod_storage_sql

use Moose;
use Moose::Util::TypeConstraints;
use Prosody::Storage::SQL::DB;
use JSON;
use Encode;

has driver => (
	is => 'ro',
	isa => enum(["SQLite3","MySQL","PostgreSQL"]),
	requi
) = @_;
	if ($row->type eq 'string') {
		return $row->value;
	} elsif ($row->type eq 'json') {
		return decode_json(encode('utf8', $row->value));
	}
}

1;
__END__
=pod

=head1 NAME

Prosody::Storage::
Prosody ( G/GE/GETTY/Prosody-0.007.tar.gz, GETTY, 2011; MetaCPAN )
Prosody/lib/Prosody/Mod/Data/Access.pm ( view source; MetaCPAN )
TTY';
}
{
  $Prosody::Mod::Data::Access::VERSION = '0.007';
}

use Moose;
use LWP::UserAgent;
use JSON;
use Encode;
use HTTP::Request;

our $VERSION ||= '0.0development';

has hostname => (
	is => 'ro
'/json';
	my $req = HTTP::Request->new('GET',$url);
	$req->authorization_basic($self->jid,$self->password);
	my $res = $self->_useragent->request($req);
	if ($res->is_success) {
		return decode_json(e
a';
	my $req = HTTP::Request->new('PUT',$url);
	$req->content(encode_json($data));
	$req->header('Content-Type' => 'application/json');
	$req->authorization_basic($self->jid,$self->password);
	my $res
AnyEvent-JSONRPC-Lite ( T/TY/TYPESTER/AnyEvent-JSONRPC-Lite-0.15.tar.gz, TYPESTER, 2011; MetaCPAN )
AnyEvent-JSONRPC-Lite/lib/AnyEvent/JSONRPC/Lite/Client.pm ( view source; MetaCPAN )
package AnyEvent::JSONRPC::Lite::Client;
use Any::Moose;

use Carp;
use Scalar::Util 'weaken';

use AnyEvent;
use AnyEvent::Socket;
use AnyEvent::Handle;

has host => (
    is       => 'ro',
    isa  
ead(json => sub {
                $self->_handle_response( $_[1] );
            });
        });

        while (my $pooled = shift @{ $self->_request_pool }) {
            $handle->push_write( json =>
        params => \@params,
    };

    if ($self->handler) {
        $self->handler->push_write( json => $request );
    }
    else {
        push @{ $self->_request_pool }, $request;
    }

    $sel
AnyEvent-JSONRPC-Lite ( T/TY/TYPESTER/AnyEvent-JSONRPC-Lite-0.15.tar.gz, TYPESTER, 2011; MetaCPAN )
AnyEvent-JSONRPC-Lite/lib/AnyEvent/JSONRPC/Lite.pm ( view source; MetaCPAN )
nt::JSONRPC::Lite;
use strict;
use warnings;
use base 'Exporter';

our $VERSION = '0.15';

our @EXPORT = qw/jsonrpc_client jsonrpc_server/;

use AnyEvent::JSONRPC::Lite::Client;
use AnyEvent::JSONRPC:
:Lite::Server;

sub jsonrpc_client($$) {
    my ($host, $port) = @_;

    AnyEvent::JSONRPC::Lite::Client->new(
        host => $host,
        port => $port,
    );
}

sub jsonrpc_server($$) {
    my 
nt::JSONRPC::Lite::Server->new(
        address => $address,
        port    => $port,
    );
}

1;

__END__

=encoding utf-8

=for stopwords TCP TCP-based JSONRPC RPC

=head1 NAME

AnyEvent::JSONRPC:
AnyEvent-JSONRPC-Lite ( T/TY/TYPESTER/AnyEvent-JSONRPC-Lite-0.15.tar.gz, TYPESTER, 2011; MetaCPAN )
AnyEvent-JSONRPC-Lite/lib/AnyEvent/JSONRPC/Lite/Server.pm ( view source; MetaCPAN )
package AnyEvent::JSONRPC::Lite::Server;
use Any::Moose;

use Carp;
use Scalar::Util 'weaken';

use AnyEvent::Handle;
use AnyEvent::Socket;

use AnyEvent::JSONRPC::Lite::CondVar;

has address => (
   
            fh => $fh,
        );
        $handle->on_read(sub {
            shift->unshift_read( json => sub {
                $self->_dispatch($indicator, @_);
            }),
        });

        $
$type   = shift;
            my $result = @_ > 1 ? \@_ : $_[0];

            $handle->push_write( json => {
                id     => $id,
                result => $type eq 'result' ? $result : undef
Data-SearchEngine-Solr ( G/GP/GPHAT/Data-SearchEngine-Solr-0.20.tar.gz, GPHAT, 2011; MetaCPAN )
Data-SearchEngine-Solr/lib/Data/SearchEngine/Solr.pm ( view source; MetaCPAN )
8';

has options => (
    is => 'ro',
    isa => 'HashRef',
    default => sub { {
        wt => 'json',
        fl => '*,score',
    } }
);

has 'url' => (
    is => 'ro',
    isa => 'Str',
    requi
Github-Score ( C/CN/CNRDEEIO/Github-Score-0.2.0.tar.gz, CNRDEEIO, 2011; MetaCPAN )
Github-Score/lib/Github/Score.pm ( view source; MetaCPAN )
BSTRACT: Pull author contribution counts for github repos

use strict;
use warnings;
use LWP;
use JSON;
use HTTP::Request;
use URI;

use Data::Dumper;

use Moose; # automatically turns on strict and w
' => (is => 'rw', );

  sub clear {
      my $self = shift;
      $self->$_(undef) for qw(ua user json uri timeout);
  }


 our $VERSION = '0.001';
 $VERSION = eval $VERSION;
 
 sub new {
     my $sel
RI->new( sprintf( 'http://github.com/api/%s/json/repos/show/%s/%s/contributors', 
 	$_[0]->api_version,$_[0]->user, $_[0]->repo ) 
 	); 
 	}
 sub json { JSON->new->allow_nonref }
 
 sub scores {
     
Alice ( L/LE/LEEDO/Alice-0.20.tar.gz, LEEDO, 2011; MetaCPAN )
Alice/lib/Alice/HTTP/Stream/XHR.pm ( view source; MetaCPAN )
package Alice::HTTP::Stream::XHR;

use JSON;
use Time::HiRes qw/time/;
use Any::Moose;

extends 'Alice::HTTP::Stream';

use strict;
use warnings;

my $separator = "xalicex";
our @headers = ('Content-T
$self->clear_queue;
  $self->last_send(time);
}

sub to_string {
  my $self = shift;

  return to_json({
    queue => $self->queue,
    time  => time - $self->offset,
  }, {utf8 => 1, shrink => 1});
}
Alice ( L/LE/LEEDO/Alice-0.20.tar.gz, LEEDO, 2011; MetaCPAN )
Alice/lib/Alice/HTTP/Stream/WebSocket.pm ( view source; MetaCPAN )
package Alice::HTTP::Stream::WebSocket;

use JSON;
use Any::Moose;
use Digest::MD5 qw/md5/;
use Time::HiRes qw/time/;

extends 'Alice::HTTP::Stream';

has fh => (
  is => 'ro',
  required => 1,
);

ha
$_[0]->push_read(
      'AnyEvent::Handle::Message::WebSocket',
      sub { $self->on_read->(from_json $_[1]) }
    );
  });
    
  $self->handle($h);
  $self->send([{type => "identify", id => $self->
lf, $messages) = @_;

  $messages = [$messages] unless ref $messages eq "ARRAY";

  my $line = to_json(
    {queue => $messages},
    {utf8 => 1, shrink => 1}
  );
  
  $self->send_raw($line);
}

sub 
ObjectDB-InflateColumn ( C/CC/CCCP/ObjectDB-InflateColumn-0.01.tar.gz, CCCP, 2011; MetaCPAN )
ObjectDB-InflateColumn/lib/ObjectDB/InflateColumn.pm ( view source; MetaCPAN )
   );
    
    use JSON;
    my $json = JSON->new;
    
    # describe infalte
    __PACKAGE__->schema->inflate_column(
        'data', 
        {
            inflate => sub { $json->allow_nonref->enc
ode($_[0]) },
            deflate => sub { $json->utf8(1)->decode($_[0]) },
        }
    );
    
    # =============================================================
    
    # in main code
    packag
ObjectDB-InflateColumn ( C/CC/CCCP/ObjectDB-InflateColumn-0.01.tar.gz, CCCP, 2011; MetaCPAN )
ObjectDB-InflateColumn/README.pod ( view source; MetaCPAN )
   );
    
    use JSON;
    my $json = JSON->new;
    
    # describe infalte
    __PACKAGE__->schema->inflate_column(
        'data', 
        {
            inflate => sub { $json->allow_nonref->enc
ode($_[0]) },
            deflate => sub { $json->utf8(1)->decode($_[0]) },
        }
    );
    
    # =============================================================
    
    # in main code
    packag
Alice ( L/LE/LEEDO/Alice-0.20.tar.gz, LEEDO, 2011; MetaCPAN )
Alice/lib/Alice/MessageStore.pm ( view source; MetaCPAN )
package Alice::MessageStore;

use AnyEvent::DBI;
use List::Util qw/min/;
use Any::Moose;
use JSON;

has insert => (
  is => 'rw',
  default => sub {[]},
);

has trim => (
  is => 'rw',
  default => su
sgid >= ? ORDER BY msgid DESC LIMIT ?",
    $id, $max, $min, $limit,
    sub { $cb->([map {decode_json $_->[0]} reverse @{$_[1]}]) }
  );
}

sub add {
  my ($self, $id, $message) = @_;

  $self->dbi->
 INTO window_buffer (window_id,msgid,message) VALUES (?,?,?)",
    $id, $message->{msgid}, encode_json($message), sub {});

  $self->trim->{$id} = 1;
}

sub do_trim {
  my $self = shift;

  my @trim =

Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.