Couchbase
view release on metacpan or search on metacpan
eg/durability.pl view on Meta::CPAN
use strict;
use warnings;
use blib;
use Data::Printer;
use Couchbase::Document;
use Couchbase::Bucket;
use Time::HiRes qw(time);
my $begin;
sub mark_begin($) {
my $msg = shift;
$begin = time();
print "$msg\n";
}
sub mark_end {
my $now = time();
my $duration = $now - $begin;
printf("Duration: %0.4fs\n\n", $duration);
}
lib/Couchbase.pm view on Meta::CPAN
our @ERRMAP = ();
our $VERSION = $Couchbase::Core::VERSION;
package Couchbase::Cluster;
use strict;
use warnings;
use URI;
use Couchbase::Bucket;
sub q2hash($) {
my $s = shift || '';
my %rv = ();
foreach my $pair (split('&', $s)) {
my ($k,$v) = split('=', $pair);
$rv{$k} = $v;
}
return \%rv;
}
sub parse_connstr($) {
# Parses a connection string into its constituent parts
my $uri = URI->new(shift);
my %h = ();
$h{scheme} = $uri->scheme;
$h{hosts} = [ split(/,/, $uri->authority) ];
$h{options} = q2hash($uri->query);
$h{bucket} = $uri->path;
$h{bucket} =~ s,^/+,,g;
return \%h;
( run in 2.199 seconds using v1.01-cache-2.11-cpan-65fba6d93b7 )