The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

PPM::Make::Search - search for info to make ppm packages

SYNOPSIS

use PPM::Make::Search;
my $search = PPM::Make::Search->new();

my @query = qw(Net::FTP Math::Complex);
$search->search(\@query, mode => 'mod') or $search->search_error();
my $results = $search->{mod_results};
# print results

DESCRIPTION

This module either queries a remote SOAP server (if SOAP::Lite is available), uses CPAN.pm, if configured, or uses LWP::Simple for a connection to http://cpan.uwinnipeg.ca/ to provide information on either modules or distributions needed to make a ppm package. The basic object is created as

my $search = PPM::Make::Search->new();

with searches being performed as

my @query = qw(Net::FTP Math::Complex);
$search->search(\@query, mode => 'mod') or $search->search_error();

The first argument to the search method is either a string containing the name of the module or distribution, or else an array reference containing module or distribution names. The results are contained in $search->{mod_results}, for module queries, or $search->{dist_results}, for distribution queries. Supported values of mode are

mode => 'mod'

This is used to search for modules. The query term must match exactly, in a case sensitive manner. The results are returned as a hash reference, the keys being the module name, and the associated values containing the information in the form:

my @query = qw(Net::FTP Math::Complex);
$search->search(\@query, mode => 'mod') or $search->search_error();
my $results = $search->{mod_results};
foreach my $m(keys %$results) {
  my $info = $results->{$m};
  print <<"END"
For module $m:
 Module: $info->{mod_name}
  Version: $info->{mod_vers}
  Description: $info->{mod_abs}
  Author: $info->{author}
  CPANID: $info->{cpanid}
  CPAN file: $info->{dist_file}
  Distribution: $info->{dist_name}
END
}
mode => 'dist'

This is used to search for distributions. The query term must match exactly, in a case sensitive manner. The results are returned as a hash reference, the keys being the distribution name, and the associated values containing the information in the form:

my @d = qw(Math-Complex libnet);
$search->search(\@d, mode => 'dist') or $search->search_error();
my $results = $search->{dist_results};
foreach my $d(keys %$results) {
  my $info = $results->{$d};
  print <<"END";
 For distribution $d:
  Distribution: $info->{dist_name}
  Version: $info->{dist_vers}
  Description: $info->{dist_abs}
  Author: $info->{author}
  CPAN file: $info->{dist_file}
END
  my @mods = @{$info->{mods}};
  foreach (@mods) {
    print "Contains module $_->{mod_name}: Version: $_->{mod_vers}\n";
  }
}

COPYRIGHT

This program is copyright, 2008 by Randy Kobes <r.kobes@uwinnipeg.ca>. It is distributed under the same terms as Perl itself.

SEE ALSO

PPM.