Brian Katzung > Data-XHash-0.09 > Data::XHash::Splice

Download:
Data-XHash-0.09.tar.gz

Annotate this POD

View/Report Bugs
Source  

NAME ^

Data::XHash::Splice - Add splice to your XHash

VERSION ^

Version 0.09

SYNOPSIS ^

    $xhash->splice(\%options?, $offset, $length, @elements?);
    $xhash->spliceref(\%options?, $offset, $length, \@elements?);

DESCRIPTION ^

This module adds methods splice() and spliceref() to Data::XHash.

These are the only methods that deal explicitly with offsets rather than keys. Using them *might* mean that you have chosen the wrong data structure, but never say never. It's here if you need it.

METHODS ^

$xhash->splice(\%options?, $offset?, $length?, @elements?)

$xhash->spliceref(\%options?, $offset?, $length?, \@elements?)

Splice removes $length elements (to the end of the XHash if missing or undef) beginning at $offset (from the beginning of the XHash if missing or undef) and returns them (as an XHash by default).

The offset and/or length may be negative, in which case they are interpreted as being from the end of the XHash instead of the start.

If you specify new elements, they are put in place of the removed ones.

Options:

to => $destination

This option is passed to delete(), and controls how the deleted elements are returned.

nested => $boolean

This option is passed to pushref() and controls whether added elements are recursively converted to XHashes.

SEE ALSO ^

perldoc -f splice

AUTHOR ^

Brian Katzung, <briank at kappacs.com>

SUPPORT AND BUG TRACKING ^

See Data::XHash.

LICENSE AND COPYRIGHT ^

Copyright 2012 Brian Katzung.

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.

syntax highlighting: