Try this:
#! /usr/bin/perl use strict; use warnings; use CPANPLUS::Backend; # this will need to be more clever in the general case # (cross platform paths, odd locations, generated code, etc.) sub find_pod { my ( $dir, $module_name ) = @_; my $module_path = join '/', split /::/, $module_name; foreach my $extension ( qw( pod pm ) ) { my $file = "$dir/lib/$module_path.$extension"; return $file if -e $file; } return; } sub get_description_from_pod { my ( $filename, $module_name ) = @_; open my $fh, "<", $filename or die "open failed ($!)\n"; while ( my $line = <$fh> ) { chomp $line; return $1 if $line =~ m/^$module_name\s+-\s+(.*)$/s; } return; } sub description { my $module = shift; return $module->description if $module->description; $module->fetch or die CPANPLUS::Error->stack_as_string; my $dir = $module->extract or die CPANPLUS::Error->stack_as_string +; return 'unknown' unless my $pod_file = find_pod( $dir, $module->na +me ); return get_description_from_pod( $pod_file, $module->name ) or 'unknown'; } my $cb = CPANPLUS::Backend->new; my @modules = $cb->search( type => 'module', allow => [ qr/\ACatalyst: +:Plugin/ ] ); print $_->name, " : ", description( $_ ), "\n" foreach @modules
In reply to Re^7: Searching for Modules and Descriptions on CPAN Remotely
by adrianh
in thread Searching for Modules and Descriptions on CPAN Remotely
by ghenry
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |