ArangoDB2
view release on metacpan or search on metacpan
lib/ArangoDB2/Base.pm view on Meta::CPAN
package ArangoDB2::Base;
use strict;
use warnings;
use Carp qw(croak);
use Data::Dumper;
use JSON::XS;
use Scalar::Util qw(blessed weaken);
# new
#
# Arango organizes data hierarchically: Databases > Collections > Documents
#
# This constructor can build ArangoDB2::Database, Collection, Document, Edge,
# etc. objects which all follow the same pattern
sub new
lib/ArangoDB2/Base.pm view on Meta::CPAN
my $class = shift;
# new instance
my $self = {};
bless($self, $class);
# process args
while (my $arg = shift) {
# if arg is a ref it should be another
# ArangoDB::* object
if (ref $arg) {
# prevent circular ref
weaken $arg;
# create reference to parent object
$self->{$arg->_class} = $arg;
}
# if arg is a string then it is the "name"
# of this object
else {
$self->name($arg);
}
}
# if we have a name and can get then try it
lib/ArangoDB2/HTTP/Curl.pm view on Meta::CPAN
use strict;
use warnings;
use base qw(
ArangoDB2::HTTP
);
use Data::Dumper;
use HTTP::Response;
use JSON::XS;
use Scalar::Util qw(weaken);
use WWW::Curl::Easy;
my $JSON = JSON::XS->new->utf8;
sub new
{
my($class, $arango) = @_;
# we do not want to hold this reference if the
# parent goes out of scope
weaken $arango;
# create new instance
my $self = {
arango => $arango,
};
bless($self, $class);
# setup curl
my $curl = $self->{curl} = WWW::Curl::Easy->new;
# set authentication is username is specified
lib/ArangoDB2/HTTP/LWP.pm view on Meta::CPAN
use strict;
use warnings;
use base qw(
ArangoDB2::HTTP
);
use Data::Dumper;
use JSON::XS;
use LWP::UserAgent;
use Scalar::Util qw(weaken);
my $JSON = JSON::XS->new->utf8;
sub new
{
my($class, $arango) = @_;
# we do not want to hold this reference if the
# parent goes out of scope
weaken $arango;
# create new instance
my $self = {
arango => $arango,
};
bless($self, $class);
$self->{lwp} = LWP::UserAgent->new(
keep_alive => 1
);
( run in 0.465 second using v1.01-cache-2.11-cpan-65fba6d93b7 )