The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

PAR::Repository::DBM - DBM tools for PAR::Repository

SYNOPSIS

  use PAR::Repository;

DESCRIPTION

This module is for internal use only. It contains code for accessing the DBM files of a PAR repository.

EXPORT

None.

GLOBALS

This package has a few constants:

MODULES_DBM_FILE, SYMLINKS_DBM_FILE, and SCRIPTS_DBM_FILE, DEPENDENCIES_DBM_FILE, and DBM_CHECKSUMS_FILE. They are accessible as functions via PAR::Repository::DBM::.... They indicate the file names of the DBM databases and the DBM checksums file.

DATABASE STRUCTURE

This section outlines the structure of the DBM::Deep database files used by PAR::Repository.

If you need to care about this, you should be a PAR::Repository developer.

MODULES-DISTS DBM

The DBM file is a hash at top level.

It associates namespaces (keys) with a number of file names and versions. The values of the top level hash are hashes again. These contain file names as keys and corresponding versions as values.

Example:

  {
    'Math::Symbolic::Derivative' => {
      'Math-Symbolic-0.502-x86_64-linux-gnu-thread-multi-5.8.7.par' => '0.502',
      'Math-Symbolic-0.200-x86_64-linux-gnu-thread-multi-5.8.6.par' => '0.200',
    },
  }

This example means that the Math::Symbolic::Derivative module can be found in the two listed distribution files in the repository with the listed versions. Note that the distribution version needs not be the same as the module version. The module version is the one separately indicated.

The DBM file is a hash at top level.

It associates real files in the repository (keys) with a number of symbolic links. The values of the top level hash are arrays of distribution file names which are symlinks.

Example: (with some extra linebreaks to keep the text width down)

  {
    'Math-Symbolic-0.502-x86_64-linux-gnu-thread-multi-5.8.7.par'
       => [
            'Math-Symbolic-0.502-any_arch-5.8.7.par',
            'Math-Symbolic-0.502-x86_64-linux-gnu-thread-multi-'
            .'any_version.par',
            'Math-Symbolic-0.502-any_arch-any_version.par'
          ],
  }

In the example, the first file is the real file and the paths/file names in the value array are the names of the symbolic links.

SCRIPTS-DISTS DBM

This DBM file is a hash at top level. It associates script (executable) names with distributions much like the modules_dists.dbm file.

Example:

  {
    'parrepo' => {
      'PAR-Repository-0.03-x86_64--5.8.7.par'        => '0.02',
      'PAR-Repository-0.02-any_arch-any_version.par' => '0.01',
    },
  }

DEPENDENCIES DBM

This DBM file stores distribution names and associates them with names of modules it depends on and their minimum versions. It does not differentiate between the various types of dependencies that can be found in a CPAN META.yml file.

Example:

 {
   'Distname-0.03-x86_64-any_version.par' => {
      'Module::It::Depends::On' => '1.00',
   },
 }

METHODS

Following is a list of class and instance methods. (Instance methods until otherwise mentioned.)

There is no PAR::Repository::DBM object. PAR::Repository inherits from this class.

modules_dbm

Opens the modules_dists.dbm.zip file in the repository and returns a tied hash reference to that file. Second return value is the file name.

If the file does not exist, it returns the empty list.

You should know what you are doing when you use this method.

Opens the symlinks.dbm.zip file in the repository and returns a tied hash reference to that file. Second return value is the file name.

If the file does not exist, it returns the empty list.

You should know what you are doing when you use this method.

scripts_dbm

Opens the scripts_dists.dbm.zip file in the repository and returns a tied hash reference to that file. Second return value is the file name.

If the file does not exist, it returns the empty list.

You should know what you are doing when you use this method.

dependencies_dbm

Opens the dependencies.dbm.zip file in the repository and returns a tied hash reference to that file. Second return value is the file name.

If the file does not exist, it returns the empty list.

You should know what you are doing when you use this method.

close_modules_dbm

Closes the modules_dists.dbm file committing any changes and then zips it back into modules_dists.dbm.zip.

This is called when the object is destroyed.

The same as close_modules_dbm() but for the file symlinks.dbm.zip.

Also called on object destruction.

close_scripts_dbm

Closes the scripts_dists.dbm file committing any changes and then zips it back into scripts_dists.dbm.zip.

This is called when the object is destroyed.

close_dependencies_dbm

Closes the dependencies.dbm file committing any changes and then zips it back into dependencies.dbm.zip.

This is called when the object is destroyed.

update_dbm_checksums

Updates the DBM checksums file dbm_checksums.txt with the checksums of the currently existing zipped DBM files.

This is called when the PAR::Repository object is destroyed.

Maintainer note: Very similar code lives in the PAR::Repository::Client::DBM::_calculate_cache_local_checksums method. Keep in sync or refactor.

_open_dbm

Opens the zipped dbm file given as first argument.

This is only for internal use.

_create_dbm

Creates a zipped dbm file given as first argument.

This is only for internal use.

AUTHOR

Steffen Müller, <smueller@cpan.org>

COPYRIGHT AND LICENSE

Copyright 2006-2009 by Steffen Müller

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.