man Data::Compare () - compare perl data structures

NAME

Data::Compare - compare perl data structures

SYNOPSIS

    use Data::Compare;

    my $h = { 'foo' => [ 'bar', 'baz' ], 'FOO' => [ 'one', 'two' ] };
    my @a1 = ('one', 'two');
    my @a2 = ('bar', 'baz');
    my %v = ( 'FOO', \@a1, 'foo', \@a2 );

    # simple procedural interface
    print 'structures of $h and \%v are ',
      Compare($h, \%v) ? "" : "not ", "identical.\n";

    # OO usage
    my $c = new Data::Compare($h, \%v);
    print 'structures of $h and \%v are ',
      $c->Cmp ? "" : "not ", "identical.\n";
    # or
    my $c = new Data::Compare;
    print 'structures of $h and \%v are ',
      $c->Cmp($h, \%v) ? "" : "not ", "identical.\n";

DESCRIPTION

Compare two perl data structures recursively. Returns 0 if the structures differ, else returns 1.

BUGS

CWData::Compare cheats with REF, CODE and GLOB references. If such a reference is encountered in a structure being processed, the result is 0 unless references are equal.

Currently, there is no way to compare two compiled piece of code with perl so there is no hope to add a better CODE references support in CWData::Compare in a near future.

AUTHOR

Fabien Tassin fta@sofaraway.org

Copyright (c) 1999-2001 Fabien Tassin. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

VERSION

Version 0.02 (25 Apr 2001)

SEE ALSO