GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Genezzo::Block::RDBlkA(3) User Contributed Perl Documentation Genezzo::Block::RDBlkA(3)

Genezzo::Block::RDBlkA.pm - Row Directory Block Adjunct tied hash class. This class adds array-like splice capabilities to Genezzo::Block::RDBlock. Genezzo::Block::RDBArray uses this class as the basis of a tied array.

Note: Like its parent RDBlock, this class is almost, but not quite, a pushhash.

 use Genezzo::Block::RDBlkA;
 use Genezzo::Block::Std;

 local $Genezzo::Block::Std::DEFBLOCKSIZE = 500;

 my $buff = "\0" x 500; # construct an empty byte buffer

 my %tied_hash = ();

 my $tie_val = 
    tie %tied_hash, 'Genezzo::Block::RDBlkA', (refbufstr => \$buff);

 # pushhash style 
 # (note that the "PUSH" pseudo key is not supported)...
 my $newkey = $tie_val->HPush("this is a test");

 # or array style, your choice
 my $pushcount = $tie_val->PUSH(qw(push lots of data));

 $tied_hash{$newkey} = "update this entry";

 # a hash that supports array style FETCHSIZE
 my $getcount = $tie_val->FETCHSIZE(); # Note: not HCount

 # splice it
 my $err_str;

 my @a1 = $tie_val->HeSplice(\$err_str, 5, 3, qw(more stuff to splice));

RDBlkA adds array-like splice capabilities to RDBlock, violating the standard hash abstraction. Splicing values resets hash keys, treating them more like array offsets. If you want to use a hash, use RDBlock or "Genezzo::Row::RSBlock". If you want to use an array, use "Genezzo::Block::RDBArray".

RDBlkA support all standard hash operations, with the exception that you cannot create or insert a user key -- you must push new entries and use the generated key or basic iteration to retrieve your data.

In addition to the RDBlock standard public methods, RDBlkA adds HSplice and HeSplice.

HSplice this, offset, length, LIST
Perform the equivalent of "splice" on the array.

offset is optional and defaults to zero, negative values count back from the end of the array.

length is optional and defaults to rest of the array.

LIST may be empty.

Returns a list of the original length elements at offset.

HeSplice this, error_ref, offset, length, LIST
error_ref is a string ref. Normally set to undef, set to error string on failure.

The effort to convert a set of potentially sparse hash keys to array indexes is O(n), which ain't cheap. See Genezzo::Block::RDBlk_NN as an alternative -- imposing certain restrictions on the array contents and usage makes it possible to perform this conversion at O(1).

none

HSplice: offset calculation must match offset2hkey in RDBlock. Special handling needed if inherited by RDBlk_NN?

Jeffrey I. Cohen, jcohen@genezzo.com

perl(1).

Copyright (c) 2003, 2004 Jeffrey I Cohen. All rights reserved.

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

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

Address bug reports and comments to: jcohen@genezzo.com

For more information, please visit the Genezzo homepage at <http://www.genezzo.com>

2005-07-19 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.