Hub::Data::Data - Interface for storing and retrieving web-content
Part of the Hub Library
use Hub; my $data = Hub::mkinst( 'Data' );
$data->store( $hash ); # stores data by implicit address $data->store_at( $addr, $hash ); # stores data at address $addr $data->get( $addr ); # returns data at address
$data->commit(); # writes to disk
This class provides interfaces for storing and retrieving data.
attach | define_id | init | refreshmeta | store |
commit | delete_at | new | resort | store_at |
cp | get | packdata | set | touch |
create_id | get_root | refresh | set_root |
Usage: attach this data object to an existing HashFile instance
write to disk
get (return a copy) information
create id
define id
remove data
Usage: get information
Usage: get_root
Get the root of the data
Usage: initialize myself and load the disk files
constructor
Usage: packdata HASHREF
From the bottom up, pack each variable's data.
reload from disk and reset any instance data
Usage: refreshmeta ID
Refresh the meta variables (which already exist) at point ID
Usage: resort( $address )
Before calling this method, set '_sort2' to a *number* on the subhashes which have priority. This method will clear that property.
Resorts the items which are peers at the given address. If no address is given, we will resort all root items. The sort value is stored in the subkey: '_sort'.
Usage: set information
Usage: set_root HASH
Set the root of the data!
Usage: store information in the embedded hashfile
examples
1) store( { _id => 'user1', name => 'Ryan', height => '5\'9\"', } );
%user1{ name == Ryan height == 5'9" }
2) store( { name => "Ryan", height => "5\'9\"", } );
name == Ryan height == 5'9"
2) store( { user1:name => "Ryan", user1:height => "5\'9\"", } );
name == Ryan height == 5'9"
store information at the specified address
Usage: touch($hashref) Usage: touch($address)
Update meta-data. See touch()
in Meta.pm for what gets modified.
Example:
touch( { a => "aye", b => "bee" } ) touch( "file:data" )
Will:
update the hash provided update the item at address 'file:data' if it is a hash
Ryan Gies
Copyright (c) 2006 Livesite Networks, LLC. All rights reserved.
Copyright (c) 2000-2005 Ryan Gies. All rights reserved.
This file created by on at