X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FModule%2FMetadata.pm;h=f292114599de3e7a25d3eed02b02f669b5f80a3b;hb=4850170cc2e0c6bd6e9e1381da5be4b6b6b079c2;hp=6bfe11c6ac670e25fa6d196bfb1a1a9eb8d95518;hpb=e6ddd76509b1b36e888c88848f78f6f829cc9c1e;p=p5sagit%2FModule-Metadata.git diff --git a/lib/Module/Metadata.pm b/lib/Module/Metadata.pm index 6bfe11c..f292114 100644 --- a/lib/Module/Metadata.pm +++ b/lib/Module/Metadata.pm @@ -11,12 +11,12 @@ package Module::Metadata; use strict; use vars qw($VERSION); -$VERSION = '0.36_04'; +$VERSION = '1.000001'; $VERSION = eval $VERSION; use File::Spec; use IO::File; -use Module::Metadata::Version; +use version 0.87; BEGIN { if ($INC{'Log/Contextual.pm'}) { Log::Contextual->import('log_info'); @@ -84,8 +84,8 @@ sub new_from_module { my $compare_versions = sub { my ($v1, $op, $v2) = @_; - $v1 = Module::Metadata::Version->new($v1) - unless UNIVERSAL::isa($v1,'Module::Metadata::Version'); + $v1 = version->new($v1) + unless UNIVERSAL::isa($v1,'version'); my $eval_str = "\$v1 $op \$v2"; my $result = eval $eval_str; @@ -99,8 +99,7 @@ sub new_from_module { if ( $version =~ /[=<>!,]/ ) { # logic, not just version # take as is without modification } - elsif ( ref $version eq 'version' || - ref $version eq 'Module::Metadata::Version' ) { # version objects + elsif ( ref $version eq 'version' ) { # version objects $version = $version->is_qv ? $version->normal : $version->stringify; } elsif ( $version =~ /^[^v][^.]*\.[^.]+\./ ) { # no leading v, multiple dots @@ -515,7 +514,7 @@ sub _evaluate_version_line { $pn++; # everybody gets their own package my $eval = qq{BEGIN { q# Hide from _packages_inside() #; package Module::Metadata::_version::p$pn; - use Module::Metadata::Version; + use version; no strict; local $sigil$var; @@ -553,7 +552,7 @@ sub _evaluate_version_line { } # Bless it into our own version class - eval { $result = Module::Metadata::Version->new($result) }; + eval { $result = version->new($result) }; die "Version '$result' from $self->{filename} does not appear to be valid:\n$eval\n\nThe fatal error was: $@\n" if $@; @@ -597,14 +596,9 @@ sub pod { 1; -__END__ - -=for :stopwords ModuleInfo - =head1 NAME -ModuleInfo - Gather package and POD information from a perl module file - +Module::Metadata - Gather package and POD information from perl module files =head1 DESCRIPTION @@ -675,13 +669,33 @@ optional parameter, otherwise @INC is searched. Can be called as either an object or a class method. -=back +=item package_versions_from_directory($dir, \@files?) + +Scans C<$dir> for .pm files (unless C<@files> is given, in which case looks +for those files in C<$dir> - and reads each file for packages and versions, +returning a hashref of the form: + { + 'Package::Name' => { + version => '0.123', + file => 'Package/Name.pm' + }, + 'OtherPackage::Name' => ... + } + +=item log_info (internal) + +Used internally to perform logging; imported from Log::Contextual if +Log::Contextual has already been loaded, otherwise simply calls warn. + +=back =head1 AUTHOR Ken Williams , Randy W. Sims +Released as Module::Metadata by Matt S Trout (mst) with +assistance from David Golden (xdg) =head1 COPYRIGHT @@ -690,10 +704,9 @@ Copyright (c) 2001-2006 Ken Williams. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. - =head1 SEE ALSO -perl(1), L(3) +perl(1), L(3) =cut