NAME

PAR::Repository::Client::DBM - Contains all the DBM access functions

SYNOPSIS

use PAR::Repository::Client;

DESCRIPTION

This module implements access to the underlying DBMs.

All of the methods described here shouldn't be used frivolously in user code even if some of them are part of the API and are guaranteed not to change.

need_dbm_update

Takes one or no arguments. Without arguments, all DBM files are checked. With an argument, only the specified DBM file will be checked.

Returns true if either one of the following conditions match:

  • The repository does not support checksums.

  • The checksums (and thus also the DBM files) haven't been downloaded yet.

  • The local copies of the checksums do not match those of the repository.

In cases two and three above, the return value is actually the hash reference of checksums that was fetched from the repository.

Returns the empty list if the local checksums match those of the repository exactly.

You don't usually need to call this directly. By default, DBM files are only fetched from the repository if necessary.

modules_dbm

Fetches the modules_dists.dbm database from the repository, ties it to a DBM::Deep object and returns a tied hash reference or the empty list on failure. Second return value is the name of the local temporary file.

In case of failure, an error message is available via the error() method.

The method uses the _fetch_dbm_file() method which must be implemented in a subclass such as PAR::Repository::Client::HTTP.

scripts_dbm

Fetches the scripts_dists.dbm database from the repository, ties it to a DBM::Deep object and returns a tied hash reference or the empty list on failure. Second return value is the name of the local temporary file.

In case of failure, an error message is available via the error() method.

The method uses the _fetch_dbm_file() method which must be implemented in a subclass such as PAR::Repository::Client::HTTP.

dependencies_dbm

Fetches the dependencies.dbm database from the repository, ties it to a DBM::Deep object and returns a tied hash reference or the empty list on failure. Second return value is the name of the local temporary file.

In case of failure, an error message is available via the error() method.

The method uses the _fetch_dbm_file() method which must be implemented in a subclass such as PAR::Repository::Client::HTTP.

close_modules_dbm

Closes the modules_dists.dbm file and does all necessary cleaning up.

This is called when the object is destroyed.

close_scripts_dbm

Closes the scripts_dists.dbm file and does all necessary cleaning up.

This is called when the object is destroyed.

close_dependencies_dbm

Closes the dependencies.dbm file and does all necessary cleaning up.

This is called when the object is destroyed.

PRIVATE METHODS

These private methods should not be relied upon from the outside of the module.

_get_a_dbm

This is a private method.

Generic method returning a dbm. Requires two arguments. The type of the DBM (modules, scripts, dependencies), and the name of the remote DBM file. The latter should be taken from one of the package constants.

_parse_dbm_checksums

This is a private method.

Given a reference to a file handle, a reference to a string or a file name, this method parses a checksum file and returns a hash reference associating file names with their base64 encoded MD5 hashes.

If passed a ref to a string, the contents of the string will be assumed to contain the checksum data.

_calculate_cache_local_checksums

This is a private method.

Calculates the checksums of the DBMs in the local cache directory. If the repository client isn't using a private cache directory, this short circuits and does not actually try to calculate any checksums of potentially modified files.

Returns the checksums hash just like the checksum fetching routine.

Maintainer note: Essentially the same code lives in PAR::Repository's DBM code for calculating the repository checksums in the first place.

SEE ALSO

This module is directly related to the PAR project. You need to have basic familiarity with it. Its homepage is at http://par.perl.org/

See PAR, PAR::Dist, PAR::Repository, etc.

PAR::Repository::Query implements the querying interface. The methods described in that module's documentation can be called on PAR::Repository::Client objects.

PAR::Repository implements the server side creation and manipulation of PAR repositories.

PAR::WebStart is doing something similar but is otherwise unrelated.

AUTHOR

Steffen Mueller, <smueller@cpan.org>

COPYRIGHT AND LICENSE

Copyright 2006-2009 by Steffen Mueller

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.6 or, at your option, any later version of Perl 5 you may have available.