NAME

Data::Validate::Structure - handle a structure in custom ways

SYNOPSIS

use Data::Validate::Structure;

my $structure = Structure->new( $data );

# Check sub structures matches exactly
$structure == $structure2

# Check sub structures matches equaly (array order not important)
$structure eq $structure

# Check structure contains all of structure2 at least
$structure >= $structure2

# Check structure2 contains all of structure at least
$structure <= $structure2

# structure much contain structure2 but not equal it
$structure > $structure2

# structure2 must contain structure but not equal it
$structure < $structure2

# Make sure structure does not exactly match structure2
$structure != $structure2

# Remove all parts of structure2 from structure
$structure - $structure2
$structure -= $structure2

# Merge two structures together
$structure + $structure2
$structure += $structure2

DESCRIPTION

Take a structure and attempt to allow some basic structure
to structure testing.

METHODS

$class->new( $structure )

Create a new structure.

$structure->disabled()

Internal method, wht to do when a function is disabled.

$structure->equal( $otherstructure )

Test that structure is the same as other structure.

$structure->notequal( $otherstructure )

Test that structure is not the same as other structure.

$structure->_equal( $otherstructure )

Internal method for testing structural equiverlance.

$structure->identical( $otherstructure )

Return true if structure is identical.

$structure->notidentical( $otherstructure )

Return true if structure is not identical.

$structure->_identical( $otherstructure )

Return true if structure is identical (internal).

$structure->_autoself()

Return true if the caller was internal.

$structure->autovalue()

Return the structure

$structure->autoname()

Return the structure name

$structure->autobool()

Returns the truth of the structure

$structure->structure()

Return the structure directly

$structure->name()

Return the name directly

$structure->_eq( $otherstructure, %p )

Return true if other structure is equle.

$structure->_eq_hash( $otherhash, %p )

Return true if other hash is equle.

$structure->_eq_array( $otherarray )

Return true if other array is equle.

$structure->plus( $otherstructure )

Return the current structure plus another structure

$structure->pluseq( $otherstructure )

Append another structure.

$structure->_plus( $otherstructure )

Internal method for merging two structures.

$structure->_pluseq( $otherstructure )

Internal method for returning two structures.

$structure->_plus_hash( $otherstructure )

Return the current hash plus another hash

$structure->_plus_array( $otherstructure )

Return the current array plus another array

$structure->_plus_scalar( $otherstructure )

Deal with conflicting scalar data (atm we ignore)

$structure->subtract( $otherstructure )

Return the current structure minus a sub structure

$structure->subeq( $otherstructure )

Remove a sub structure from the current structure.

$structure->_sub_array( $otherstructure )

Remove array elements using structure (NOT FINISHED).

$structure->_sub_hash( $otherstructure )

Return the current hash minus a sub hash

$structure->_sub_scalar( $otherstructure )

Remove a scalar so long as it's eq

$structure->_sctref( $otherstructure )

Get the structure reference and the object.

$structure->_clone( $otherstructure )

Make a clone of a structure.

$structure->_sctclone( $otherstructure )

Make a structure object clone.

$structure->_sctdeal( $otherstructure )

Sort out each request so that it goes to the right place
and so that the comparisons are fair.

AUTHOR

Copyright, Martin Owens 2005-2008, Affero General Public License (AGPL)

http://www.fsf.org/licensing/licenses/agpl-3.0.html