On Dec 12, 2007 9:49 AM, Roman Daszczyszak <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I am trying to utilize Data::Compare to compare two data structures
> containing user names and account attributes from Windows XP systems.
> Using Win32API::Net, it returns an array of usernames, which can be
> looped through to pull a hash of each users' attributes. However,
> comparing these hashes over time always results in a false match due
> to the passwordAge attribute (value is # of seconds since epoch, so
> it's always different). I tried using the ignore_hash_keys parameter
> to ignore it, but it still never matches correctly. Is there a way to
> check if the attribute is actually being ignored? Am I using it
> wrong? (I copied the line directly from the sample code on CPAN and
> just changed the variables)
>
> Code below:
> $updateUsers = Compare(\%oldUsers, \%newUsers, {
> ignore_hash_keys => [qw(passwordAge)] });
>
> It always returns a '0' (false match).
> Any ideas?
> Roman
The code you quoted looks correct, but without seeing the data and the
rest of the code it is hard to say for certain. Construct a simple
case like
#!/usr/bin/perl
use strict;
use warnings;
use Data::Compare;
my %a = (foo => 10, bar => [1, 2, 3], baz => 4);
my %b = (foo => 10, bar => [1, 2, 3], baz => 5);
my $bool = Compare(\%a, \%b, {ignore_hash_keys => ['baz']});
print "got $bool\n";
to see if the module works correctly. If it does then start looking
at your data to see why it does not match.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/