The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::FluidDB - A Perl interface to FluidDB

SYNOPSIS

 use Net::FluidDB;

 # Predefined FluidDB client for playing around, points
 # to the sandbox with user test/test
 $fdb = Net::FluidDB->new_for_testing;
 $fdb = Net::FluidDB->new_for_testing(trace_http => 1);

 # FluidDB client pointing to production
 $fdb = Net::FluidDB->new(username => 'username', password => 'password');

 # FluidDB taking credentials from environment variables
 # FLUIDDB_USERNAME and FLUIDDB_PASSWORD
 $fdb = Net::FluidDB->new;

 # Content-MD5 headers with checksums for requests with payload
 $fdb = Net::FluidDB->new(md5 => 1)

 # Resource getters
 $object     = $fdb->get_object_by_id($id, about => 1);
 $object     = $fdb->get_object_by_about($about);
 $ns         = $fdb->get_namespace($path, description => 1);
 $tag        = $fdb->get_tag($path, description => 1);
 $policy     = $fdb->get_policy($user, $category, $action);
 $permission = $fdb->get_permission($category, $path, $action);
 $user       = $fdb->get_user($username);

 # Object search
 @ids = $fdb->search("has fxn/rating");

DESCRIPTION

Net::FluidDB provides an interface to the FluidDB API.

The documentation of Net::FluidDB does not explain FluidDB, though there are links to relevant pages in the documentation of each class.

If you want to get familiar with FluidDB please check these pages:

FluidDB high-level description

http://doc.fluidinfo.com/fluidDB/

FluidDB API documentation

http://doc.fluidinfo.com/fluidDB/api/

FluidDB API specification

http://api.fluidinfo.com/fluidDB/api/*/*/*

FluidDB Essence blog posts

http://blogs.fluidinfo.com/fluidDB/category/essence/

USAGE

Class Methods

Net::FluidDB->new(%attrs)

Returns an object for communicating with FluidDB.

This is a wrapper around LWP::UserAgent and does not validate credentials in the very constructor. If they are wrong requests will fail when performed.

Attributes and options are:

username

Your username in FluidDB. If not present uses the value of the environment variable FLUIDDB_USERNAME.

password

Your password in FluidDB. If not present uses the value of the environment variable FLUIDDB_PASSWORD.

protocol

Either 'HTTP' or 'HTTPS'. Defaults to 'HTTP'.

host

The FluidDB host. Defaults to fluiddb.fluidinfo.com.

md5

If this flag is true requests with payload get a Content-MD5 header with a checksum.

trace_http_requests

A flag, logs all HTTP requests if true.

trace_http_responses

A flag, logs all HTTP responses if true.

trace_http

A flag, logs all HTTP requests and responses if true. (Shorthand for enabling the two above.)

Net::FluidDB->new_for_testing

Returns a Net::FluidDB instance pointing to the sandbox with "test"/"test". The host of the sandbox can be checked in the package variable $Net::FluidDB::SANDBOX_HOST.

Instance Methods

$fdb->username
$fdb->username($username)

Gets/sets the username.

$fdb->password
$fdb->password($password)

Gets/sets the password.

$fdb->protocol
$fdb->protocol($protocol)

Gets/sets the protocol, either 'HTTP' or 'HTTPS'.

$fdb->ua

Returns the instance of LWP::UserAgent used to communicate with FluidDB.

$fdb->user

Returns the user on behalf of whom fdb is doing calls. This attribute is lazy loaded.

$fdb->get_object_by_id

Convenience shortcut for Net::FluidDB::Object::get_by_id, see Net::FluidDB::Object.

$fdb->get_object_by_about

Convenience shortcut for Net::FluidDB::Object::get_by_about, see Net::FluidDB::Object.

$fdb->search

Convenience shortcut for Net::FluidDB::Object::search, see Net::FluidDB::Object.

$fdb->get_namespace

Convenience shortcut for Net::FluidDB::Namespace::get, see Net::FluidDB::Namespace.

$fdb->get_tag

Convenience shortcut for Net::FluidDB::Tag::get, see Net::FluidDB::Tag.

$fdb->get_policy

Convenience shortcut for Net::FluidDB::Policy::get, see Net::FluidDB::Policy.

$fdb->get_permission

Convenience shortcut for Net::FluidDB::Permission::get, see Net::FluidDB::Permission.

$fdb->get_user

Convenience shortcut for Net::FluidDB::User::get, see Net::FluidDB::User.

AUTHOR

Xavier Noria (FXN), <fxn@cpan.org>

COPYRIGHT AND LICENSE

Copyright (C) 2009-2011 Xavier Noria

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 260:

You forgot a '=back' before '=head1'