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 =
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