NAME
Win32::TieRegistry::PMVersionInfo - store in Win32 Registry PM $VERSION info
SYNOPSIS
use Win32::TieRegistry::PMVersionInfo 0.2;
my $reg = new Win32::TieRegistry::PMVersionInfo (
file_root => "D:/src/pl/spc2xml/version5/",
ignore_dirs => ["Commercial/bin/",
"Commercial/SPC/XSLT/SourceForge",
"Commercial/SPC/XSLT/CSS",
"Commercial/SPC/XSLT/imgs",],
reg_root => 'LMachine/Software/LittleBits/',
strip_path => $strip_path,
chat=>1,
);
$reg->get;
$reg->store;
exit;
DESCRIPTION
This module mirrors to the Win32 registry version information from a perl module's heirachy.
It offers no support for reading the information - for that use the Win32::TieRegistry
module on which this module is based.
Version information is ascertained using the same method as in ExtUtils::MakeMaker
version 5.45. To quote that module's manpage:
The first line in the file that contains the regular expression
/([\$*])(([\w\:\']*)\bVERSION)\b.*\=/
will be evaluated with eval() and the value of the named variable
after the eval() will be assigned to the VERSION attribute of the
MakeMaker object. The following lines will be parsed o.k.:
$VERSION = '1.00';
*VERSION = \'1.01';
( $VERSION ) = '$Revision: 1.222 $ ' =~ /\$Revision:\s+([^\s]+)/;
$FOO::VERSION = '1.10';
*FOO::VERSION = \'1.11';
our $VERSION = 1.2.3; # new for perl5.6.0
but these will fail:
my $VERSION = '1.01';
local $VERSION = '1.02';
local $FOO::VERSION = '1.30';
(Putting "my" or "local" on the preceding line will work o.k.)
DEPENDENCIES
Win32::TieRegistry.
CONSTRUCTOR
Expects a class name, and optionally a list of arguments in a hash-like structure, a hash or pointer to a hash. Options are keys in a the blessed hash reference that is the object, and as such may be directly accessed anytime.
Options are:
- file_root
-
The root at which to be begin parsing files.
- ignore_dirs
-
An array of directories above the
file_root
not to process. If any directory encountered matches at the beginning of one of these strings, it will not be processed. - strip_path
-
The text to strip from left-hand side of paths when storing in the registry.
- reg_root
-
The branch at which to root the mirror of the directory structure.
- dirname_pattern
-
A positve regular expressions used when reading a directory, which the module encloses within the bracket 'grouping' operator and anchors to the begining and end of the string being matched. The
.
and..
directories are excluded. - filename_pattern
-
As
dirname_pattern
above, but applies to filenames, and defaults to.*
. - extension
-
Set to anything to retain the file extension when mapping to the registry (the default); expilcitly set to
undef
to strip from the filename everything after the last full-stop.
METHOD get
Accepts an object reference, and optionally a directory to parse. Stores the names of all the files in the passed directory (or the calling object's file_root
slot), and recurses (calls itself) on all sub-directories. Incidentally returns the path to the directory operated upon.
Will return without reiterating if the directory passed matches at the beginning of any string in the ignore_dirs
list (ie. the value in the object's file_root
plus @{$self-
{ignore_dirs}}> slot).
See "CONSTRUCTOR" for details of how to effect exclusion of file and directory names.
See also "DESCRIPTION" above for details of how the version is ascertained.
METHOD get_from_MANIFEST
As the get
method, but only gets information from files listed in a MANIFEST
file, the path to which should be passed as the first argument.
Additionally, the name of a MANIFEST.SKIP
file may be passed as a further argument, in which case no information will be garthered from files listed therein.
METHOD store
Accepts an object-reference and optionally a registry path to act as a root at which to secure the $VERSION
info from every file in the object's tree
slot. If no 'root' is supplied, the calling object's reg_root
slot is used. Incidentally returns the root used after making changes to the registry.
CAVEATS
Be sure to pass all directories with a trailing '/'.
On Win32, it seems the
sub get
has problems with the-d
operator detecting whether a file is not a directory.
SEE ALSO
ExtUtils::MakeMaker, Win32::TieRegistry.
KEYWORDS
Windows registry, perl module, version information, versions, recursion .
AUTHOR
Lee Goddard <lgoddard@cpan.org>
COPYRIGHT
Copyright 2001, Lee Goddard. All rights reserved.
Available for public use under the same terms as Perl itself. This was developed as part of a private project, and is made available without promise of adding anything useful to it.
2 POD Errors
The following errors were encountered while parsing the POD:
- Around line 307:
Unknown directive: =over4
- Around line 309:
'=item' outside of any '=over'