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');
} else {
- *log_info = sub { warn @_ };
+ *log_info = sub (&) { warn $_[0]->() };
}
}
use File::Find qw(find);
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;
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
$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;
}
# 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 $@;
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
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 <kwilliams@cpan.org>, Randy W. Sims <RandyS@ThePierianSpring.org>
+Released as Module::Metadata by Matt S Trout (mst) <mst@shadowcat.co.uk> with
+assistance from David Golden (xdg) <dagolden@cpan.org>
=head1 COPYRIGHT
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<Module::Metadata>(3)
+perl(1), L<Module::Build::ModuleInfo>(3)
=cut