Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
use Win32; use PPM; use Win32::TieRegistry ( Delimiter=>"/", ArrayValues=>1, SplitMultis => 1, AllowLoad => 1, qw( :REG_ KEY_READ KEY_WRITE KEY_ALL_ACCESS )); use Win32::Service; use constant TRUE => 1; use constant FALSE => 0; my ($me) = $0; $me =~ s/.*(\\|\/)([a-zA-Z0-9\.]+)$/$2/; my ($banner) = <<"EOT"; ********************************************************************** +********* $me ********************************************************************** +********* EOT print $banner; my $ASppm = "http://www.activestate.com/PPMPackages/5.6/"; my $ASppmpl = "http://www.activestate.com/PPMPackages/5.6plus/"; my $ROTHppm = "http://www.roth.net/perl/packages"; my %modules = ( "Win32::Perms" => $ROTHppm, "Win32::GUI" => $ASppm, "Win32::daemon" => $ROTHppm, "Win32::AdminMisc" => $ROTHppm, "Win32::TieRegistry" => $ASppm, "Win32::Process" => $ASppm, "Win32::Console" => $ASppm, "Win32::NetResource" => $ASppm, "Win32::FileSecurity" => $ASppm, "Win32::EventLog::Message" => $ROTHppm, "Getopt::Long" => $ASppm, "LWP::UserAgent" => $ASppm, "HTTP::Request" => $ASppm, "HTTP::Response" => $ASppm, "HTTP::Cookies" => $ASppm, "HTTP::Headers" => $ASppm, "Time::HiRes" => $ASppm, "Time::Local" => $ASppm, "Net::SMTP" => $ASppm, "DB_File" => $ASppm, "Win32::Perms" => $ROTHppm, "GD" => $ASppm, "GD::Graph" => $ASppmpl . "GDGraph.ppd", "Mail-Sendmail" => $ASppmpl, ); foreach my $module (keys %modules) { my $package = $module; $package =~ s/::/-/g; my $location = $modules{$module}; $location = Win32::ExpandEnvironmentStrings($location); printf "Module %-25s ",$module; my $code = "use $module;"; eval "$code" ; if ( $@ ) { print "- to install\n"; # Try to install.... if ( $location =~ m/:([\\\/].).*\.ppd$/ ) { # + If $location identifiles a ppd file if(PPM::InstallPackage(package => "$location")) { #use this form for installation print "\t - installed OK\n"; }else{ printf "\t - install failed (%s)\n",$PPM::PPMERR; printf " \tLocation %s\ +n", $location; } }else{ # otherwise u +se this if(PPM::InstallPackage(package => "$package", location => "$location")) { print "\t - installed OK\n"; }else{ printf "\t - install failed (%s)\n",$PPM::PPMERR; printf " \tLocation %s\ +n", $location; } } }else{ print "- installed - "; my $status = PPM::VerifyPackage(package => $package, upgrade => 0, + force => 0); if (defined $status) { if ($status eq "0") { print "module is up to date.\n"; } else { my $status = PPM::VerifyPackage(package => $package, upgrade => 1, force => 0); if ( $status == 0 ) { print "upgraded ok\n"; }else{ print "failed to upgrade\n"; } } }else{ # Couldn't find a PPD to compare it with. print "$PPM::PPMERR\n"; print " (Location: $location)\n" if ( $PPM::PPMERR =~ /Could not locate a PPD file/); } } }

In reply to ppminst.pl by DaveRoberts

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others lurking in the Monastery: (5)
    As of 2014-12-26 01:53 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Is guessing a good strategy for surviving in the IT business?





      Results (163 votes), past polls