Search many PPM’s (ActivePerl packages) and printing multi line results into a file

I want to search many PPM’s (ActivePerl packages) and printing multi line results into a file.

This is Windows XP PC, using ActivePerl 5.10.0 Build 1004.

So I have the file “require_for_padre.txt” which contains all the Perl modules needed for Padre.

I took the names from:
http://svn.perlide.org/padre/trunk/Padre/Makefile.PL

and put each after the search query of ActiveState PPM, as follows:
(Note – this is for running from DOS):

ppm search App::Ack
ppm search Carp
ppm search Class::Adapter
...
ppm search Test::Exception
ppm search Test::NoWarnings
ppm search Test::NeedsDisplay

Now I wand to read all the above –  and put the output –  which is multi line per each search – into a text file.

Here’s the way:

=======================================

#!/usr/bin/perl -w
use strict;
use Cwd;
use File:: Path;

my $cur_dir = getcwd();
my $pkg_file = "require_for_padre.txt";
my $dest_file = "ppm_output_for_padre.txt";

my $line = "";
my $ppm_search_line = "";
my $total_lines = 0;
my $actual_lines = 0;

## my $cur_line = 0;

## Get the answer for the  ppm search:
  my $get_ppm_search_answer = "";

opendir(DIRHANDLE, "$cur_dir") or die "couldn't open $cur_dir: $!";

print "Openned  $cur_dirn";

  open (PKG_FILE, "$pkg_file") or die "couldn't open $pkg_file: $!";

  print "Openned  $pkg_filen";
  print "----------------------------------------------------------n";

  # create a blank file
  open (DST_FILE, ">$dest_file");
  close (DST_FILE);

  print "tttcreated $dest_filen";
  print "----------------------------------------------------------n";

  open (DST_FILE, ">$dest_file");

  while (<PKG_FILE>) {
       $total_lines = $total_lines +1 ;
       ##    $cur_line = 0;
       my $ppm_search_line = $_;
       #print "nnnn$line $total_lines :t $linen";

       print "$ppm_search_line";

       #system("$ppm_search_line");

       print for qx{$ppm_search_line};
       }

        close (DST_FILE);
  close (PKG_FILE);

closedir(DIRHANDLE);

print "$total_lines are: $total_lines n";

=======================================

That’s it

How to run?

Well… :

N:OrenMperl_ppm>ppms_padre001.pl   ppm_output_for_padre.txt