ethrbunny has asked for the wisdom of the Perl Monks concerning the following question:

Im hoping to use PPM::InstallPackage to maintain a set of client machines vs a 'source' server. On the server I have the file PPM.pm which has the necessary apis. I ran 'ppm3.bat install PPM' on the clients but didn't end up with this file. I did get the rest of the /perl/site/lib directory but not this one part. Where did I go awry? Is there a better solution for programmatically installing packages?

<edit>I found some information about this - turns out that this file has been removed from later versions of the PPM install. Apparently there is a new(er) api PPM::Installer. Im trying to find documentation on this but not turning up much yet. </edit>

Replies are listed 'Best First'.
Re: hoping to use PPM::InstallPackage
by Anonymous Monk on Jun 07, 2007 at 04:39 UTC
    PPM 2.x is not compatible with PPM 3.x, for ppm3 see PPM::UI
      FWIW here is some code that will show you which repositories a given package is available from.
      use strict; use PPM::UI; my $target_list = PPM::UI::target_list(); my $rep_list = PPM::UI::repository_list(); my $list = PPM::UI::search( $rep_list->result, $target_list->result->[ +0], "Win32-FileOp", 1 ); my @arr = $list->{ "result" }; my $piece; foreach $piece ( @arr ) { my $piece0; foreach $piece0 ( @$piece) { print $piece0->{ "reps" }->[0]->{ "url_base" }; print "\n"; } }
      I don't understand all the nuances yet. Not by a long shot.

      Ill work on getting the PPM::Installer to be useful.
      Here is a bit that uses PPM::Installer to .. well.. install..
      use strict; use PPM::UI; my $target_list = PPM::UI::target_list(); my $rep_list = PPM::UI::repository_list(); PPM::UI::install( $rep_list->{ "result" }, $target_list->result->[0], +"XML::Tiny", {"dryrun" => 0}, \&status_callback)); sub status_callback { my($name, $version, $tname, $something, $p0, $p1, $p2) = @_; print "$name \t $version \t $tname \t $something \t $p0 \t $p1 \t + $p2 \n"; }
      There are some $opts for the install call - "from", "force", "follow" and "dryrun". The first 3 are as-is from PPM3.bat. "dryrun" is just what it says - show you what its going to do without actually doing it.
Re: hoping to use PPM::InstallPackage
by Anonymous Monk on Jun 07, 2007 at 04:40 UTC
    This should always work system qw' ppm install Foo/or/url/to.ppd ';
      Is there a way to coax the full path to a package from ppm search? I was running into problems when there were several packages available. Rather than installing one it would return a list.