Module-Versions-Report-1.06/0000755000076500000240000000000011077354250014744 5ustar jessestaffModule-Versions-Report-1.06/ChangeLog0000644000076500000240000000136611077353042016522 0ustar jessestaffRevision history for Perl module Module::Versions::Report 2008-10-21 Jesse Vincent * Fix META.yml * Bump the package limit from 1k to 10k 2008-06-13 Jesse Vincent * Release 1.05 * Fix a problem with perl 5.8 introduced in 1.03 2008-06-05 Ruslan U. Zakirov * Release 1.03 * fix compatibility with perl 5.10 2007-05-21 Ruslan U. Zakirov * Release 1.03 * count modules instead of records in tables * update docs 2003-06-21 Sean M. Burke * Release 1.02: First public release (Before this it just sat around on my hard drive for a year, as I fiddled with its docs, and vacillated on which name to release it as.) Module-Versions-Report-1.06/lib/0000755000076500000240000000000011077354250015512 5ustar jessestaffModule-Versions-Report-1.06/lib/Module/0000755000076500000240000000000011077354250016737 5ustar jessestaffModule-Versions-Report-1.06/lib/Module/Versions/0000755000076500000240000000000011077354250020547 5ustar jessestaffModule-Versions-Report-1.06/lib/Module/Versions/Report.pm0000644000076500000240000001233011077352774022370 0ustar jessestaff require 5; package Module::Versions::Report; $VERSION = '1.06'; $PACKAGES_LIMIT = 10000; =head1 NAME Module::Versions::Report -- report versions of all modules in memory =head1 SYNOPSIS use Module::Versions::Report; ...and any code you want... This will run all your code normally, but then as the Perl interpreter is about to exit, it will print something like: Perl v5.6.1 under MSWin32. Modules in memory: attributes; AutoLoader v5.58; Carp; Config; DynaLoader v1.04; Exporter v5.562; Module::Versions::Report v1.01; HTML::Entities v1.22; HTML::HeadParser v2.15; HTML::Parser v3.25; [... and whatever other modules were loaded that session...] Consider its use from the command line: % perl -MModule::Versions::Report -MLWP -e 1 Perl v5.6.1 under MSWin32. Modules in memory: attributes; AutoLoader v5.58; [...] =head1 DESCRIPTION I often get email from someone reporting a bug in a module I've written. I email back, asking what version of the module it is, what version of Perl on what OS, and sometimes what version of some relevent third library (like XML::Parser). They reply, saying "Perl 5". I say "I need the exact version, as reported by C". They tell me. And I say "I, uh, also asked about the version of my module and XML::Parser [or whatever]". They say "Oh yeah. It's 2.27". "Is that my module or XML::Parser?" "XML::Parser." "OK, and what about my module's version?" "Ohyeah. That's 3.11." By this time, days have passed, and what should have been a simple operation -- reporting the version of Perl and relevent modules, has been needlessly complicated. This module is for simplifying that task. If you add "use Module::Versions::Report;" to a program (especially handy if your program is one that demonstrates a bug in some module), then when the program has finished running, you well get a report detailing the all modules in memory, and noting the version of each (for modules that defined a C<$VERSION>, at least). =head1 USING =head2 Importing If this package is imported then END block is set, and report printed to stdout on a program exit, so use C if you need a report on exit or C otherwise and call report or print_report functions yourself. =cut $Already = 0; sub import { # so "use Module::Versions::Report;" sets up the END block, but # a mere "use Module::Versions::Report ();" doesn't. unless($Already) { eval 'END { print_report(); }'; die "Extremely unexpected error in ", __PACKAGE__, ": $@" if $@; $Already = 1; } return; } =head2 report and print_report functions The first one returns preformatted report as a string, the latter outputs a report to stdout. =cut sub report { my @out; push @out, "\n\nPerl v", defined($^V) ? sprintf('%vd', $^V) : $], " under $^O ", (defined(&Win32::BuildNumber) and defined &Win32::BuildNumber()) ? ("(Win32::BuildNumber ", &Win32::BuildNumber(), ")") : (), (defined $MacPerl::Version) ? ("(MacPerl version $MacPerl::Version)") : (), "\n" ; # Ugly code to walk the symbol tables: my %v; my @stack = (''); # start out in %:: my $this; my $count = 0; my $pref; while(@stack) { $this = shift @stack; die "Too many packages?" if $count > $PACKAGES_LIMIT; next if exists $v{$this}; next if $this eq 'main'; # %main:: is %:: #print "Peeking at $this => ${$this . '::VERSION'}\n"; if(defined ${$this . '::VERSION'} ) { $v{$this} = ${$this . '::VERSION'}; $count++; } elsif( defined *{$this . '::ISA'} or defined &{$this . '::import'} # without perl version check on MacOS X's defualt perl things may seg fault # for example Request Tracker 3.8's make test target fails additional tests or ($this ne '' and grep { ($] < 5.010 or ref $_ eq 'GLOB') and defined *{$_}{'CODE'} } values %{$this . "::"}) # If it has an ISA, an import, or any subs... ) { # It's a class/module with no version. $v{$this} = undef; $count++; } else { # It's probably an unpopulated package. ## $v{$this} = '...'; } $pref = length($this) ? "$this\::" : ''; push @stack, map m/^(.+)::$/ ? "$pref$1" : (), keys %{$this . '::'}; #print "Stack: @stack\n"; } push @out, " Modules in memory:\n"; delete @v{'', ''}; foreach my $p (sort {lc($a) cmp lc($b)} keys %v) { #$indent = ' ' x (2 + ($p =~ tr/:/:/)); push @out, ' ', # $indent, $p, defined($v{$p}) ? " v$v{$p};\n" : ";\n"; } push @out, sprintf "[at %s (local) / %s (GMT)]\n", scalar(localtime), scalar(gmtime); return join '', @out; } sub print_report { print '', report(); } 1; =head1 COPYRIGHT AND DISCLAIMER Copyright 2001-2003 Sean M. Burke. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. =head1 MAINTAINER Ruslan U. Zakirov Eruz@bestpractical.comE =head1 AUTHOR Sean M. Burke, Esburke@cpan.orgE =cut __END__ Module-Versions-Report-1.06/Makefile.PL0000644000076500000240000000113411077354104016713 0ustar jessestaff# This -*- perl -*- script writes the Makefile for Module::Versions::Report # Time-stamp: "2003-06-21 23:27:37 AHDT" require 5.004; use strict; use ExtUtils::MakeMaker; WriteMakefile( NAME => 'Module-Versions-Report', VERSION_FROM => 'lib/Module/Versions/Report.pm', LICENSE => 'perl', ABSTRACT => 'report versions of all modules in memory', 'dist' => { COMPRESS => 'gzip -6f', SUFFIX => 'gz', }, ); package MY; sub libscan { # Determine things that should *not* be installed my($self, $path) = @_; return '' if $path =~ m/~/; $path; } __END__ Module-Versions-Report-1.06/MANIFEST0000644000076500000240000000024411024545322016067 0ustar jessestaffChangeLog lib/Module/Versions/Report.pm Makefile.PL MANIFEST MANIFEST.SKIP META.yml Module meta-data (added by MakeMaker) README SIGNATURE t/00about.t t/10load.t Module-Versions-Report-1.06/MANIFEST.SKIP0000644000076500000240000000006511022012167016627 0ustar jessestaff^MANIFEST\.bak$ Makefile(\.old)?$ \.rej$ CVS blib ~ Module-Versions-Report-1.06/META.yml0000644000076500000240000000073011077354250016215 0ustar jessestaff--- #YAML:1.0 name: Module-Versions-Report version: 1.06 abstract: report versions of all modules in memory author: [] license: perl distribution_type: module configure_requires: ExtUtils::MakeMaker: 0 requires: {} no_index: directory: - t - inc generated_by: ExtUtils::MakeMaker version 6.46 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 Module-Versions-Report-1.06/README0000644000076500000240000000721211022012167015612 0ustar jessestaffREADME for Module::Report::Versions Time-stamp: "2003-06-21 23:18:00 AHDT" NAME Module::Versions::Report -- report versions of all modules in memory SYNOPSIS use Module::Versions::Report; ...and any code you want... This will run all your code normally, but then as the Perl interpreter is about to exit, it will print something like: Perl v5.6.1 under MSWin32. Modules in memory: attributes; AutoLoader v5.58; Carp; Config; DynaLoader v1.04; Exporter v5.562; Module::Versions::Report v1.01; HTML::Entities v1.22; HTML::HeadParser v2.15; HTML::Parser v3.25; [... and whatever other modules were loaded that session...] Consider its use from the command line: % perl -MModule::Versions::Report -MLWP -e 1 Perl v5.6.1 under MSWin32. Modules in memory: attributes; AutoLoader v5.58; [...] DESCRIPTION I often get email from someone reporting a bug in a module I've written. I email back, asking what version of the module it is, what version of Perl on what OS, and sometimes what version of some relevent third library (like XML::Parser). They reply, saying "Perl 5". I say "I need the exact version, as reported by "perl -v"". They tell me. And I say "I, uh, also asked about the version of my module and XML::Parser [or whatever]". They say "Oh yeah. It's 2.27". "Is that my module or XML::Parser?" "XML::Parser." "OK, and what about my module's version?" "Ohyeah. That's 3.11." By this time, days have passed, and what should have been a simple operation -- reporting the version of Perl and relevent modules, has been needlessly complicated. This module is for simplifying that task. If you add "use Module::Versions::Report;" to a program (especially handy if your program is one that demonstrates a bug in some module), then when the program has finished running, you well get a report detailing the all modules in memory, and noting the version of each (for modules that defined a $VERSION, at least). COPYRIGHT AND DISCLAIMER Copyright 2001-2003 Sean M. Burke. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. AUTHOR Sean M. Burke, PREREQUISITES This suite requires Perl 5. INSTALLATION You install Module::Versions::Report, as you would install any Perl module distribution, by running these commands: perl Makefile.PL make make test make install If you want to install a private copy of Module::Versions::Report in your home directory, then you should try to produce the initial Makefile with something like this command: perl Makefile.PL LIB=~/perl See perldoc perlmodinstall for more information. DOCUMENTATION See the pod in Module::Versions::Report. SUPPORT Questions, bug reports, useful code bits, and suggestions for Worms should be sent to me at sburke@cpan.org AVAILABILITY The latest version of Module::Versions::Report is available from the Comprehensive Perl Archive Network (CPAN). Visit to find a CPAN site near you. COPYRIGHT Copyright 2001-2003, Sean M. Burke , all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. AUTHOR Sean M. Burke Module-Versions-Report-1.06/SIGNATURE0000644000076500000240000000235011077354234016232 0ustar jessestaffThis file contains message digests of all files listed in MANIFEST, signed via the Module::Signature module, version 0.55. To verify the content in this distribution, first make sure you have Module::Signature installed, then type: % cpansign -v It will check each file's integrity, as well as the signature's validity. If "==> Signature verified OK! <==" is not displayed, the distribution may already have been compromised, and you should not run its Makefile.PL or Build.PL. -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 SHA1 e6547a75bfa35b5f3ee0e9de3d130a7f5c948253 ChangeLog SHA1 5100a6effb9d891380cdef4568fd1b76256374a1 MANIFEST SHA1 b06a8885d1afbe56e1601b4950784b2dfc0a5208 MANIFEST.SKIP SHA1 ada2a8d90afd8d680c089047331f746c91be98e9 META.yml SHA1 8b2130262330b204bf5d85fc1bdc57e1844e4037 Makefile.PL SHA1 c1ef7c52be72b6f5c504fdc57bf5b8e438f80193 README SHA1 e262c899efaa4495925fe3c8b83954560d515638 lib/Module/Versions/Report.pm SHA1 a56f8e90792af5e6407d1fc1af7ad4a8c12f9cf7 t/00about.t SHA1 6f54aa87a5d212f92d04c44e632e46bfe6520ff5 t/10load.t -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (Darwin) iEYEARECAAYFAkj92JoACgkQEi9d9xCOQEYYOQCdHUj6DMaCFx5jRB2F2tgomZCm XrwAn2WSX4VeVh9bBYBiq3bgbnrd6ELE =eim6 -----END PGP SIGNATURE----- Module-Versions-Report-1.06/t/0000755000076500000240000000000011077354250015207 5ustar jessestaffModule-Versions-Report-1.06/t/00about.t0000644000076500000240000000125111022012167016631 0ustar jessestaff require 5; use Test; BEGIN { plan tests => 1; } use Module::Versions::Report (); print "#\n#\n", "# Module::Versions::Report v$Module::Versions::Report::VERSION\n", "#\n#\n", ; print "# Running under perl version $] for $^O", (chr(65) eq 'A') ? "\n" : " in a non-ASCII world\n"; print "# Win32::BuildNumber ", &Win32::BuildNumber(), "\n" if defined(&Win32::BuildNumber) and defined &Win32::BuildNumber(); print "# MacPerl verison $MacPerl::Version\n" if defined $MacPerl::Version; printf "# Current time local: %s\n# Current time GMT: %s\n", scalar( gmtime($^T)), scalar(localtime($^T)); print "# Using Test.pm v", $Test::VERSION || "?", "\n"; ok 1; Module-Versions-Report-1.06/t/10load.t0000644000076500000240000000201611022012167016437 0ustar jessestaff require 5; use strict; use Test; my @modules; BEGIN { @modules = # Modules that have a $VERSION each, and have been in core for ages qw( Fcntl File::Basename File::Copy File::Path FileHandle FindBin Getopt::Long IO::File POSIX Text::Tabs ); my $testcount = 2 + 3 * @modules; plan tests => $testcount; print "# ~ ~ ~ Expecting $testcount tests ~ ~ ~\n"; } use Module::Versions::Report (); ok 1; foreach my $m (@modules) { print "# requiring $m...\n"; eval "require $m;"; die "Can't require $m: $@\nAborting" if $@; ok 1; } my $out = Module::Versions::Report::report(); { my $o = $out; $o =~ s/^/# /mg; print "#\n#\n# Output:\n$o#\n"; } foreach my $m (@modules) { my $mq = quotemeta($m); my $mv = quotemeta(do { no strict 'refs'; ${"$m\::VERSION"} || 'WHA' } ); if($out =~ m/$mq/) { ok 1; } else { ok 0; print "# Can't find $mq in output\n"; } if($out =~ m/$mv/) { ok 1; } else { ok 0; print "# Can't find $mv in output\n"; } } print "# Byebye!\n"; ok 1;