::FileCache;
use Carp;
use Digest::MD5 qw(md5_hex);
use File::Spec::Functions qw(tmpdir);
use JSON;
use LWP::UserAgent;
use URI;
use WebService::MoviePosterDB::Movie;
=head1 METHODS
=head2 new(
m");
$uri->path("json");
$uri->query_form( map { my ($n, $v) = ($_, $_args{$_}); utf8::encode($n); utf8::encode($v); ($n => $v); } sort keys %_args );
my $json = JSON->new()->decode($self
->_get_page($uri->as_string()));
return WebService::MoviePosterDB::Movie->_new($json);
}
sub _get_secret {
my $self = shift;
my %args = @_;
if ($self->{'api_key'} eq "demo" && $sel
xt", autosave => 1);
# post request to login
my $link = $self->{_hostedurl}.'api/json/accounts/login/';
my $request = new HTTP::Request('POST',$link);
my $content = '
},
list => { Direct => undef, DirectArgs => 1 },
},
class => 'DBIC::User',
use_json_boolean => 1,
create_requires => [qw(email first last)],
return_object => 1,
);
before 'deseri
::Request;
use HTTP::Headers;
use HTTP::Request::Common;
use Digest::SHA 'hmac_sha1_base64';
use JSON;
our $VERSION = '0.9';
use constant DEBUG => $ENV{MONITIS_DEBUG} || 0;
require Carp;
our $TOK
$self->{ua} ||= LWP::UserAgent->new(agent => "perl-monitis-api/$VERSION");
$self->{json} ||= JSON->new;
bless $self, $class;
}
sub auth_token {
my ($self, $token, $expires) = @_;
w($self->api_url);
$uri->query_form(
action => 'authToken',
output => 'json',
version => $API_VERSION,
secretkey => $self->secret_key,
apikey =>
use base 'Bash::Completion::Plugin';
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;
use JSON;
use Bash::Completion::Utils qw( command_in_path );
sub should_activate {
my @commands = qw
= $ua->request(
POST 'http://api.metacpan.org/release/_search',
Content => encode_json(
{ size => 1000,
fields => ['distribution'],
sort
al {
my $json = decode_json( $res->content );
$req->candidates('') unless ( $json->{hits} );
my @candidates;
my $exact_match = 0;
for ( @{ $json->{hits}->{hits}
package App::perlrocks::Helpers;
use strict;
use warnings;
use HTTP::Tiny;
use JSON qw(from_json to_json);
use Exporter::Lite;
our @EXPORT = qw(metacpan_request);
sub metacpan_request {
my ($pat
{
content => defined($data) ? to_json($data) : ''
}
);
if ($response->{success}) {
my $data = from_json($response->{content});
return $cb ? $cb->($
data) : $data;
}
die "Request failed: " . to_json($response);
}
1;
rict;
use warnings;
=head1 NAME
Persevere::Client::Class - The Class interface to Persevere the JSON Database
=cut
our $VERSION = '0.31';
use HTTP::Request::Common qw(GET HEAD POST PUT DELETE);
$newclass{extends} = \%extends;
if ($self->{uuid}){
$newclass{useUUIDs} = $self->{client}->{json}->true;
}
if (defined $self->{properties}){
$newclass{properties} = \%{$self->{properties}
elf->{client}->{debug}){
print "DEBUG (FUNCTION create): POST $classpath " . $self->{client}->{json}->encode(\%newclass) . "\n";
}
my $req = $self->{client}->req('POST', $classpath, undef, \%ne
ck
=cut
sub get {
my $api = shift;
my @args;
my $uri = sprintf '/request-properties.json', @args;
$api->base->call("GET", $uri, @_);
}
=pod
=back
=cut
### END auto-generated
1;
my $api = shift;
my @args;
push @args, shift; # id
my $uri = sprintf '/api-keys/%s.json', @args;
$api->base->call("GET", $uri, @_);
}
=pod
=back
=cut
### END auto-generated
1;
package Persevere::Client;
use warnings;
use strict;
use JSON;
use LWP::UserAgent;
use HTTP::Request qw(GET HEAD POST PUT DELETE);
use HTTP::Status;
use HTTP::Headers;
use HTTP::Response;
use HTTP::C
e Encode qw(encode);
=head1 NAME
Persevere::Client - A Simple to use Interface to Persevere the JSON Database
=head1 VERSION
Version 0.31
=cut
our $VERSION = '0.31';
sub new{
my $class = shif
opt{host} || 'localhost') . ':' .
($opt{port} || '8080') . '/';
}
$self{json} = ($opt{json} || JSON->new->utf8->allow_blessed);
$self{ua} = ($opt{ua} || LWP::UserAgent->new(agent =
$api = shift;
my @args;
push @args, shift; # id
my $uri = sprintf '/relationships/%s.json', @args;
$api->base->call("GET", $uri, @_);
}
=pod
=item get_status
my $res = $tp->re
shift;
my @args;
push @args, shift; # id
my $uri = sprintf '/relationships/%s/status.json', @args;
$api->base->call("GET", $uri, @_);
}
sub status {
my $self = shift;
Carp::
shift;
my @args;
push @args, shift; # id
my $uri = sprintf '/relationships/%s/status.json', @args;
$api->base->call("PUT", $uri, @_);
}
=pod
=back
=cut
### END auto-generated
1;
ke being right
=head1 VERSION
version 9.99
=head1 DESCRIPTION
Using the C<META.yml> or C<META.json> to work out the prereqs for a distribution without being aware that
authors can do what they wan
stribution hammers home this point by not specifying any prereqs at all in C<META.yml> and C<META.json>
and autogenerates a list of prereqs when C<Makefile.PL> is executed.
So what exactly are the pr
$a,$b) = ($_[0]->cents, $_[1] );
new ($_[2] ? $b / $a : $a / $b);
},
'fallback' => 1;
*TO_JSON = \&dollars;
sub cents {
return '' unless defined($_[0][0]);
return $_[0][0]
};
su
}
sub dummy_record{ DUMMY }
sub hashmap_multi { wantarray?():{} }
sub hashmap_single{ wantarray?():{} }
sub next { DUMMY }
sub where { DUMMY }
sub count { 0 }
sub TO_JSON { [] }
1;
eval $code;
die "eval returned '$@'" if $@;
wantarray ? @out : \@out;
}
sub TO_JSON {
my $self = shift;
return $self->dump(
map { $_->name } @{ $self->[f_query]->pr
a work barely in progress... ;)
use strict;
use base 'DBR::Common';
use DBR::Config::Field;
use JSON;
use Data::Dumper;
sub new {
my( $package ) = shift;
my %params = @_;
my $sel
# $_[0][1]->set($_[0],@_);
# }
sub next { croak "Can not call next on a record" }
sub TO_JSON { die "This part doesn't work yet" } #HERE - this needs work
#sub DESTROY { print STDERR "RECORD
=> sub { $_[1] },
'-' => sub { return $_[2] ? $_[1] : 0 - $_[1] },
'*' => sub { 0 },
'/' => sub { 0 },
'fallback' => 1
;
sub TO_JSON { undef }
our $AUTOLOAD;
sub AUTOLOAD { shift }
1;
: Invalid operation '$_[3]' The ways in which you can use UnixTime objects is restricted"}
;
*TO_JSON = \&datetime;
sub unixtime { $_[0][0] || '' };
# Using $ENV{TZ} and the posix functions is ugly
t: Invalid operation '$_[3]' The ways in which you can use percent objects is restricted"}
;
*TO_JSON = \&format;
sub value {
return '' unless defined($_[0][0]);
return $_[0][0]
};
sub