Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: lspm - list names and descriptions of Perl modules in a directory

by jwkrahn (Monsignor)
on Jul 16, 2006 at 10:25 UTC ( #561541=note: print w/replies, xml ) Need Help??

in reply to lspm ó list names and descriptions of Perl modules in a directory

Some modules use more than one hyphen to separate the name from the description so change:
110 if( s{\A.*? - \s*}{} ) {
110 if( s{\A.*? -+ \s*}{} ) {

Replies are listed 'Best First'.
Re^2: lspm - list names and descriptions of Perl modules in a directory
by Aristotle (Chancellor) on Jul 16, 2006 at 11:07 UTC

    Thatís not a clear win. Because much CPAN-related infrastructure insists on a single dash, almost all modules have a single hyphen, which means the more fastidious form picks up nearly all descriptions correctly. If you allow multiple hyphens, you recover some false negatives, at the cost of some false positives, where the description of the module is malformed but thereís a line with multiple hyphens somewhere nearby. Matching ' --? ' at that point has a couple fewer false positives and still almost no false negatives.

    But because of the effect of CPANís rules, itís hardly worth bothering either way, and I prefer to get output thatís consistent with other tools.

    Makeshifts last the longest.

      I also noticed that if a module has a corresponding POD file (for example: and POSIX.pod) the description is in the POD file and won't get picked up at all. I applied this patch which seems to fix this (it also prevents from appearing twice in the resulting list):
      202,204c202,206 < return unless /\.p(?:m|od)\z/; < s/\.pod\z/.pm/; # if it's POD, parse t +he corresponding code < return if not -f; --- > return unless -f and /\A(.+)\.pm\z/; > my $module = $1; > my $version = get_module_version( "$mo" ) || -e "$module.pod" && get_module_version( + "$module.pod" ); > my $desc = get_module_description( +"$", $opt_limit ) || -e "$module.pod" && get_module_descript +ion( "$module.pod", $opt_limit ); > 207,209c209,211 < get_module_version( $_ ), < get_module_description( $_, $o +pt_limit ), < $opt_path ? $File::Find::name +: undef, --- > $version, > $desc, > $opt_path ? $File::Find::name +: undef

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://561541]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (2)
As of 2022-01-26 14:45 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (69 votes). Check out past polls.