Dirgest

 view release on metacpan or  search on metacpan

lib/Digest/Directory/API.pm  view on Meta::CPAN

=cut

######################################################################

sub compare
{
    my($self, $link, $user, $pass, $file, $nodetails, $nosummary, $showequal) = @_;

    print "COMPARING\n"
        if (!$self->{'quiet'});

    if ($link)
    {
        $self->{'dirgest'}->fetch($link, $user, $pass)
            || return 0;
    }
    else
    {
        $self->{'dirgest'}->compute()
            || return 0;
    }

    my $dirgest = Digest::Directory::BASE->new();
    $dirgest->quiet($self->{'quiet'});
    $dirgest->load($file)
        || return 0;

    my ($result) = $self->{'dirgest'}->compare($dirgest,
        $nodetails, $nosummary, $showequal);

    return $result;
}


######################################################################

=item B<$result = $dirgest-E<gt>update( $link, $user, $pass, $file, $nodetails, $nosummary, $showequal )>

Update a dirgest from a resource back to resource;

$link => the link to fetch dirgests from;

$user => the http username to use with $link;

$pass => the http password to use with $link;

$file => the file to save dirgests to;

$nodetails => don't show detail dirgests during activity;

$nosummary => don't show summary dirgest during activity;

$showequal => show equal dirgests during activity;

return => '1' on success, or '0' on failure;

=cut

######################################################################

sub update
{
    my($self, $link, $user, $pass, $file, $nodetails, $nosummary, $showequal) = @_;

    print "UPDATING\n"
        if (!$self->{'quiet'});

    if ($link)
    {
        $self->{'dirgest'}->fetch($link, $user, $pass)
            || return 0;
    }
    else
    {
        $self->{'dirgest'}->compute()
            || return 0;
    }

    my $dirgest = Digest::Directory::BASE->new;
    $dirgest->quiet($self->{'quiet'});
    $file && $dirgest->load($file)
        || return 0;

    my ($result) = $self->{'dirgest'}->compare($dirgest,
        $nodetails, $nosummary, $showequal);

    $file && $self->{'dirgest'}->save($file)
        || return 0;

    return 1;
}


######################################################################

=back

=head1 AUTHOR

Matthew Gream (MGREAM) <matthew.gream@pobox.com>

=head1 VERSION

Version 0.90.

=head1 RIGHTS

Copyright 2002 Matthew Gream. All Rights Reserved.

This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.

=cut

######################################################################

1;



( run in 2.094 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )