Debian Codegraph @

t/0_versions.t

raw
1 # $Id: 0_versions.t,v 1.6 2013-11-19 03:33:28 Martin Exp $
2
3 use strict;
4 use warnings;
5
6 use Config;
7 use Test::More tests => 1;
8
9 # Create a list of modules we're interested in:
10 my @asModule = qw( Date::Manip File::Copy File::Find File::Spec Getopt::Long HTML::Parser HTML::TreeBuilder HTTP::Cookies LWP::UserAgent MIME::Lite Net::Domain Pod::Parser Pod::Tests Pod::Usage Test::Inline URI User );
11
12 # Extract the version number from each module:
13 my %hsvVersion;
14 foreach my $sModule (@asModule)
15 {
16 eval " require $sModule; ";
17 unless($@)
18 {
19 no strict 'refs';
20 $hsvVersion{$sModule} = ${$sModule .'::VERSION'} || "unknown";
21 } # unless
22 } # foreach
23
24 # Also look up the version number of perl itself:
25 $hsvVersion{perl} = $Config{version} || $];
26
27 # Print on STDERR details of installed modules:
28 diag('');
29 diag(sprintf("\r# %-30s %s\n", 'Module', 'Version'));
30 foreach my $sModule (sort keys %hsvVersion)
31 {
32 $hsvVersion{$sModule} = 'Not Installed' unless(defined($hsvVersion{$sModule}));
33 diag(sprintf(" %-30s %s\n", $sModule, $hsvVersion{$sModule}));
34 } # foreach
35
36 # Make sure this file passes at least one test:
37 pass;
38 exit 0;
39 __END__