Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
#! /usr/local/bin/perl -w # Copyright (c) 2001 Richard Nuttall richard@nuttall.uk.net # This uses the Depend::Module to generate a database of the dependenc +ies # of Perl Modules installed on your system. use strict; use File::Find; use Data::Dumper; # for debugging use DBI(); use Depend::Module; use Date::Manip; connect(droptable=>1,log=>1,user=>'root',password=>'sql'); find(\&wanted, @INC); do_module("/usr/local/lib/perl5/5.6.1/sun4-solaris/perllocal.pod"); populate_usedby(); cleanup(); ########## SUBROUTINES BELOW ######### sub wanted { my $module = $File::Find::name; return unless $module =~ /\.pm$/; return if $module =~ /^\./; #print "$_\n"; open(FILE, $module) || warn("Can't open [$module]") && return; my $package = undef; my $packagecount = 0; my @remember = (); my $line = 0; my $pod = 0; my $p = undef; report("\n$module"); while (<FILE>) { chomp; if (/^=cut/) { report("WARN: Found [$_]@ line [$line] outside pod") unless $ +pod; $pod = 0; next; } elsif (/^=/) { $pod++; next; } next if $pod; if (/^__END__/) { last; } elsif (/^package\s+([\w:_]+)/) { my $package = $1; next if $package eq 'main'; report(" package [$package][$packagecount]"); $p = Depend::Module::new($package, $module); $p->use(@remember); @remember = (); } elsif (/^(use|require)\s+([\w:_\d\.]+)/) { my $word = $1; my $used = $2; report(" ${word}s [$used]]"); if ($p) { $p->use($used); } else { push @remember, $used; } } elsif (/^\$VERSION\s*=\s*(\$VERSION\s*=\s*|)['"]*([\d\.]+)/) { my $version = $2; report(" version [$version]"); $p->set_version($version) if $p; report("WARN: Version [$version] but \$p not set in\n [$mod +ule]") unless $p; } # try to find RCSed versions elsif (/^\$VERSION\s*=\s.*\$Revision: ([\d\.]+)/) { my $version = $1; report(" version [$version]RCS"); $p->set_version($version) if $p; report("WARN: Version [$version] but \$p not set in\n [$mod +ule]") unless $p; } elsif (/^(use|require|package|\$VERSION)\b/) { report("WARN: Didn't match [$_] in\n [$module]"); } } close(FILE); } sub do_module { my $module = shift; open(FILE,$module) || croak("Can't open [$module]"); my $package = undef; my $packagecount = 0; my $version; my $date; my $exefiles; my $p; report("\n$module"); while (<FILE>) { chomp; if (/^=head2 (.+): C\<Module\> L\<(.+)\|/) { $date = UnixDate(ParseDate($1),"%Y-%m-%d"); report("Date -> [$date]"); $package = $2; $p = Depend::Module::new($package); $p->set_date($date); } elsif (/^C\<VERSION: (.+)\>$/) { $p->set_version($1); } elsif (/^C\<EXE_FILES: (.+)\>$/) { $p->set_exefiles(join('+',split(/ /,$1))); } } close(FILE); }

In reply to Module Dependencies by Brovnik

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2024-03-29 15:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found