----- Original Message ----- 
From: "Lyle Kopnicky" <[EMAIL PROTECTED]>
To: "perl-win32-users" <[email protected]>
Sent: Wednesday, March 01, 2006 2:00 PM
Subject: PPM object interface?


> Hi folks,
>
> I know how to use PPM from the command line, but I want to call it from
> Perl, preferably without spawning separate processes.  There seems to be
> a PPM3 module installed in ActivePerl, but how do I access it?  E.g., I
> would like to write something like:
>
>     use PPM;
>     my $ppm = new PPM;
>     $ppm->install('http://blahblah.net/Package.ppd') or die "Failed to
> install package.";
>     my @search_packages = $ppm->search('FunPackage');
>     print (map "$_->name\n", @search_packages);
>

On my MinGW-built perl, I have a fairly old version of PPM that I got from
CPAN. I don't know what version it is:

D:\pscrpt>perl -MPPM -e "print $PPM::VERSION"

D:\pscrpt>

Anyway, with it, I can do really nice things like run the following script:

use PPM;

$location = 'http://theoryx5.uwinnipeg.ca/ppms/';
$package = 'Digest-MD2';
$root = '';

PPM::InstallPackage("package" => $package, "location" => $location, "root"
=> $root);

print "DONE";

That produces:

D:\pscrpt>perl try.pl
Installing D:\perl58_M\site\5.8.8\lib\auto\Digest\MD2\MD2.bs
Installing D:\perl58_M\site\5.8.8\lib\auto\Digest\MD2\MD2.dll
Installing D:\perl58_M\site\5.8.8\lib\auto\Digest\MD2\MD2.exp
Installing D:\perl58_M\site\5.8.8\lib\auto\Digest\MD2\MD2.lib
Installing D:\perl58_M\5.8.8\html\site\lib\Digest\MD2.html
Files found in blib\arch: installing files in blib\lib into architecture
dependent library tree
Installing D:\perl58_M\site\5.8.8\lib\Digest\MD2.pm
Writing D:\perl58_M\site\5.8.8\lib\auto\Digest\MD2\.packlist
DONE

With AS build 815, however, any attempt to load a module called PPM or PPM3
or PPM-3 etc. simply results in an error message:

E:\pscrpt>perl -MPPM -e "print \"ok\""
Can't locate PPM.pm in @INC (@INC contains: E:/Perl815/lib
E:/Perl815/site/lib .).
BEGIN failed--compilation aborted.

You could maybe get the latest version of PPM from CPAN (2.1.7) and install
it - it might provide the same nice interface to scripting that my old
version of PPM provides .... however, that script that installed Digest::MD2
for me, may well have spawned a new process to perform the task, faik.

Actually - I've just taken a look at the documentation of the CPAN version
of PPM - and it's very similar to the documentation for the old CPAN version
that I have. See http://search.cpan.org/~murray/PPM-2.1.7/lib/PPM.pm

Cheers,
Rob

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to