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

NAME

PAR::Indexer - Scan a PAR distro for packages and scripts

SYNOPSIS

  use PAR::Indexer qw(scan_par_for_packages scan_par_for_scripts dependencies_from_meta_yml);
  my $pkgs_hash    = scan_par_for_packages($parfile);
  my $scripts_hash = scan_par_for_scripts($parfile);
  
  my $dependencies = dependencies_from_meta_yml(\%meta_yml_hash);

DESCRIPTION

This module contains code for scanning a PAR distribution for packages and scripts. The code was adapted from the PAUSE indexer.

This module is used by PAR::Repository for injection of new PAR distributions.

EXPORT

None by default, but you can choose to export subroutines with the typical Exporter semantics.

FUNCTIONS

scan_par_for_packages

First argument must be the path and file name of a PAR distribution. Scans that distribution for .pm files and scans those for packages and versions. Returns a hash of the package names as keys and hash refs as values. The hashes contain the path to the file in the PAR as the key "file" and (if found) the version of the package is the key "version".

Returns undef on error.

(The structure returned should be exactly what you get when you transform the provides section of a META.yml file into a Perl data structure using a YAML reader.)

scan_par_for_scripts

First argument must be the path and file name of a PAR distribution. Scans that distribution for executable files and scans those for versions. Returns a hash of the script names as keys and hash refs as values. The hashes contain the path to the file in the PAR as the key "file" and (if found) the version of the script as the key "version".

Returns undef on error.

dependencies_from_meta_yml

Determine the dependencies declared in META.yml. Expects a reference to a hash containing the parsed YAML tree as first argument.

Returns essentially the merged configure_requires, build_requires, and requires hashes from the META.yml. The order of precedence is <requires build_requires > configure_requires>>. If none of the three sections is found, the function returns false. If any one of them was found (even if empty), a hash reference will be returned.

AUTHOR

Steffen Mueller, <smueller@cpan.org>

The original code for scanning modules was taken from the PAUSE sources which were written by Andreas Koenig.

COPYRIGHT AND LICENSE

Copyright 2006-2009 by Steffen Mueller

Except for the code copied from the PAUSE scanner which is (C) Andreas Koenig.

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.