Pcapstore - Simple file storage library built for PCAP web/database use
use lib '/lab/share/dev/lib'; use Pcapstore;
my $sto = new Pcapstore;
The following functions for creating, looking up and testing for the existence of objects are called as simple functions without an object reference.
$objhandle = new Pcapstore;
Creator method. Call as a function.
$objhandle = Pcapstore::lookup( $id );
Looks up a previously stored object from the ID number $id
.
$boolean = Pcapstore::exists( $oid );
Returns 1 if an object exists for the given object ID $oid
or
undef
otherwise.
This section describes object methods which operate on specific objects and are called via an object reference.
$oid = $sto->id();
Returns the ID string for the given object. Note that the ID is only defined once an object has been committed. So a brand new object has no valid ID.
$fh = $sto->gethandle();
Returns a filehandle for the given object.
$scalar = $sto->getstring();
$hashref = $sto->getpropset();
Returns property set for given object. Note that property names will be restricted to lower-case letters and the hyphen ('-').
$propertyvalue = $sto->getprop( $propname );
Returns property value named by $propname
.
$objhandle = $sto->commit( -cgi => $cgiparam ); $objhandle = $sto->commit( -pathname => $path ); $objhandle = $sto->commit( -string => $stringvalue, -pathname => $p, -basename => $b, -mimetype => $m ); $objhandle = $sto->commit( -handle => $filehandle, -pathname => $p, -basename => $b, -mimetype => $m );
Stores an object defined by the arguments.
Objects may be provided as a simple string, a CGI parameter from CGI.pm (i.e. $cgiobject->param( 'paramname' )
), a pathname, or an I/O handle.
The first two arguments are expected to be a tag identifying the object type of the second argument, optionally followed by property names and values