| 1 | ## -*- Mode: CPerl -*- | ||
| 2 | ## File: DTA::CAB.pm | ||
| 3 | ## Author: Bryan Jurish <moocow@cpan.org> | ||
| 4 | ## Description: robust morphological analysis: top-level | ||
| 5 | |||
| 6 | package DTA::CAB; | ||
| 7 | |||
| 8 | 1 | ▶ | use DTA::CAB::Version; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 0 | ▶ | use DTA::CAB::Common; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 10 | |||
| 11 | #use DTA::CAB::Analyzer; ##-- DEBUG | ||
| 12 | #use DTA::CAB::Analyzer::Common; ##-- DEBUG | ||
| 13 | #use DTA::CAB::Analyzer::Extra; ##-- DEBUG | ||
| 14 | eval "use DTA::CAB::Analyzer::Common"; | ||
| 15 | |||
| 16 | #eval "use DTA::CAB::Server::HTTP"; | ||
| 17 | #eval "use DTA::CAB::Client::HTTP"; | ||
| 18 | |||
| 19 | #eval "use DTA::CAB::Server::XmlRpc"; | ||
| 20 | #eval "use DTA::CAB::Client::XmlRpc"; | ||
| 21 | |||
| 22 | use strict; | ||
| 23 | |||
| 24 | ##============================================================================== | ||
| 25 | ## Constants | ||
| 26 | ##============================================================================== | ||
| 27 | |||
| 28 | our @ISA = qw(DTA::CAB::Logger); ##-- for compatibility | ||
| 29 | |||
| 30 | ##============================================================================== | ||
| 31 | ## Version Information | ||
| 32 | |||
| 33 | ## \%moduleVersions => DTA::CAB->moduleVersions(%opts) | ||
| 34 | ## + checks all loaded modules in %::INC for $VERSION | ||
| 35 | ## + known %opts: | ||
| 36 | ## ( | ||
| 37 | ## moduleMatch => $regex, ##-- only report modules matching $regex | ||
| 38 | ## moduleIgnore => $regex, ##-- ignore modules matching $regex | ||
| 39 | ## ) | ||
| 40 | sub moduleVersions { | ||
| 41 | no strict 'refs'; | ||
| 42 | my $that = UNIVERSAL::isa($_[0],__PACKAGE__) ? shift : __PACKAGE__; | ||
| 43 | my %opts = @_; | ||
| 44 | my $re_match = $opts{moduleMatch}; | ||
| 45 | my $re_ignore = $opts{moduleIgnore}; | ||
| 46 | $re_match = qr{$re_match} if (defined($re_match) && !ref($re_match)); | ||
| 47 | $re_ignore = qr{$re_ignore} if (defined($re_ignore) && !ref($re_ignore)); | ||
| 48 | my ($inc,$pkg,$ver,%versions); | ||
| 49 | foreach $inc (sort keys %::INC) { | ||
| 50 | next if ($inc !~ m/\.pm$/i); | ||
| 51 | $pkg = $inc; | ||
| 52 | $pkg =~ s{/}{::}g; | ||
| 53 | $pkg =~ s{\.pm$}{}i; | ||
| 54 | next if (($re_match && $pkg !~ m{$re_match}) || ($re_ignore && $pkg =~ m{$re_ignore})); | ||
| 55 | next if ( !($ver = ${"${pkg}::VERSION"}) ); | ||
| 56 | $versions{$pkg} = "$ver"; | ||
| 57 | } | ||
| 58 | return \%versions; | ||
| 59 | } | ||
| 60 | |||
| 61 | |||
| 62 | |||
| 63 | |||
| 64 | 1; ##-- be happy | ||
| 65 | |||
| 66 | __END__ | ||