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

using ExtUtils: : Packlist to uninstall Padre 0.26

I tried to upgrade my Padre (the Perl IDE) on MS-Windows and broke it – so now I want to remove Padre.

There is a Perl module named: “ExtUtils : : Packlist” – used for manage .packlist files.

There is an example – used remove ALL installed modules.

I mada a slight change – to remove only a specified module – for example Padre.

(Don’t worry – I’m going to re-install it later).

Here is the code:

————————————————————

#!/usr/local/bin/perl -w

 use strict;
 use IO:: Dir;
 use ExtUtils:: Packlist;
 use ExtUtils:: Installed;

 sub emptydir($) {
  my ($dir) = @_;
  my $dh = IO:: Dir->new($dir) || return(0);
  my @count = $dh->read();
  $dh->close();
  return(@count == 2 ? 1 : 0);
 }

 # Find all the installed packages
 print("Finding all installed modules...n");
 my $installed = ExtUtils::Installed->new();

 foreach my $module (grep(/^Padre/, $installed->modules())) {
 my $version = $installed->version($module) || "???";
 print("Found module $module Version $versionn");
 print("Do you want to delete $module? [n] ");
 my $r = <STDIN>; chomp($r);
 if ($r && $r =~ /^y/i) {
 # Remove all the files
 foreach my $file (sort($installed->files($module))) {
  print("rm $filen");
  unlink($file);
 }
 my $pf = $installed->packlist($module)->packlist_file();
 print("rm $pfn");
 unlink($pf);
 foreach my $dir (sort($installed->directory_tree($module))) {
   if (emptydir($dir)) {
    print("rmdir $dirn");
    rmdir($dir);
    }
   }
  }
 }

————————————————————

Yes! At last – Padre on Ms-Windows with ActivePerl 5.10.0 Build 1004

I’ve just succeeded to install Padre 0.25 on the Ms-Windows PC I have at work.

It wasn’t easy at all…

This PC is Windows XP with ActivePerl 5.10.0 Build 1004.

All the times that I tried in the past – I had many problems, including complicated needs to do compilation.

Now I have on it Microsoft Visual C++ 6.0 – maybe it helped solving dependency on modules that need local compilation.

Other things that I have just made and helped:

  1. upgrading last version of Encode – using ppm ,
  2. upgrade of Wx – also by using ppm ,
  3. installing Alien-wxWidgets (the same way),
  4. And now – again with ppm:
ppm install  --force Alien-wxWidgets-dev

(I use the PPM from DOS “command line” :-/)

And now – here are a few pictures of my Padre 0.25:

Padre 0.25 main Window
Padre 0.25 main Window
Padre 0.25 - menu
Padre 0.25 - menu
Padre 0.25 - menu
Padre 0.25 - menu

padre_0250900

Please note the reversed English letters on the help:

Padre 0.25 - Help
Padre 0.25 - Help
Padre 0.25 - About
Padre 0.25 - About