App-module-version
view release on metacpan or search on metacpan
This document describes module-version version 1.004
DESCRIPTION
This script gets the version of a requested list of modules.
It also can check the version of perl, or of Strawberry Perl or
ActivePerl.
SYNOPSIS
module-version [ --help ] [ --usage ] [ --man ] [ --version ] [ -?]
[--prompt] [perl] [strawberry[perl]] [activeperl]
Module1::To::Check Module2::To::Check ...
Options:
-usage Gives a minimum amount of aid and comfort.
-help Gives aid and comfort.
-? Gives aid and comfort.
-man Gives maximum aid and comfort.
-version Gives the name, version and copyright of the script.
-prompt Prompts for module names to print the versions of.
perl Gives the version, $^O, and $Config{archname} of perl.
strawberryperl Gives the version, bitness and version of gcc of
Strawberry Perl.
activeperl Gives the version and build number of ActivePerl.
Module1::To::Check Module2::To::Check
Prints the version of the module if it exists and
is easily retrievable.
lib/App/module/version.pm view on Meta::CPAN
use File::Spec::Functions qw(splitpath catfile);
use Carp qw(carp);
# following recommendation from http://www.dagolden.com/index.php/369/version-numbers-should-be-boring/
our $VERSION = "1.004";
$VERSION = eval $VERSION;
sub new {
my $class = shift;
return bless {
prompt => 0,
prompted => [],
list => [],
}, $class;
}
sub parse_options {
my $self = shift;
my @a = @_;
GetOptionsFromArray(\@a,
'help|?' => sub { pod2usage(-exitstatus => 0, -verbose => 0); },
'man' => sub { pod2usage(-exitstatus => 0, -verbose => 2); },
'usage' => sub { _usage(); },
'version' => sub { _version(); exit(1); },
'prompt' => \$self->{prompt},
) or pod2usage(-verbose => 2);
if (0 == scalar @a) {
$self->{prompt} = 1;
}
else {
@{$self->{list}} = @a;
}
}
sub do_job {
my $self = shift;
if ($self->{prompt}) {
_version();
print "\nPlease type in a space-separated list of modules you want to find\nthe installed versions for below.\n> ";
my $cmd = <STDIN>;
@{$self->{prompted}} = split m{\s+}, $cmd;
}
print "\n";
my $version_info;
MODULE:
for my $module (@{$self->{list}}, @{$self->{prompted}}) {
if ('perl' eq lc($module)) {
print "The version of perl is $PERL_VERSION on $OSNAME ($Config{archname})\n";
next MODULE;
}
if ($module =~ m/\Astrawberry (?:perl)?\z/imsx) {
if (('MSWin32' ne $OSNAME) or ($Config{libperl} !~ m{\.a\z}msx)) {
print "This is not Strawberry Perl.\n";
}
lib/App/module/version.pm view on Meta::CPAN
} else {
print "$module is installed in " . $version_info->{dir} . ", but does not have a detectable version.\n";
}
} else {
print "$module could not be found.\n";
}
}
print "\n";
if ($self->{prompt}) {
require Term::ReadKey;
my $char = undef;
print "Press any key to exit.\n";
$char = Term::ReadKey::ReadKey(-1) until $char;
}
}
sub _version {
lib/App/module/version.pm view on Meta::CPAN
my $error = shift;
print "Error: $error\n\n" if (defined $error);
my (undef, undef, $script) = splitpath( $PROGRAM_NAME );
print <<"EOF";
This is $script, version $VERSION, which checks the
installed version of the modules named on the command line.
Usage: $script [ --help ] [ --usage ] [ --man ] [ --version ] [ -? ]
[--prompt] Module::To::Check ...
For more assistance, run $script --help.
EOF
exit(1);
}
1;
__END__
script/module-version view on Meta::CPAN
=head1 DESCRIPTION
This script gets the version of a requested list of modules.
It also can check the version of perl, or of Strawberry Perl or
ActivePerl.
=head1 SYNOPSIS
module-version [ --help ] [ --usage ] [ --man ] [ --version ] [ -?]
[--prompt] [perl] [strawberry[perl]] [activeperl]
Module1::To::Check Module2::To::Check ...
Options:
-usage Gives a minimum amount of aid and comfort.
-help Gives aid and comfort.
-? Gives aid and comfort.
-man Gives maximum aid and comfort.
-version Gives the name, version and copyright of the script.
-prompt Prompts for module names to print the versions of.
perl Gives the version, $^O, and $Config{archname} of perl.
strawberryperl Gives the version, bitness and version of gcc of
Strawberry Perl.
activeperl Gives the version and build number of ActivePerl.
Module1::To::Check Module2::To::Check
Prints the version of the module if it exists and
is easily retrievable.
( run in 0.624 second using v1.01-cache-2.11-cpan-0b5f733616e )