[HPADM] FW: Need Perl help

From: Binkley Robert - rbinkl (Robert.Binkley@acxiom.com)
Date: Fri May 09 2003 - 08:50:27 EDT


-----Original Message-----
From: Binkley Robert - rbinkl [mailto:Robert.Binkley@acxiom.com]
Sent: Thursday, May 08, 2003 3:13 PM
To: 'Beginners-Cgi@perl.org'
Subject: Need Perl help

Hello Everyone
What I am trying to accomplish
1: install everything that is outdated on my disk:
2: install my favorite programs if necessary:
3: install my favorite programs if necessary:
4: Keep all modules from previous versions available for use with new
version perl.

The reason this came about is that we have various customer running perl,
and when we upgrade we loose the customer configured modules, And I looking
for a way to upgrade perl and keep all the customers modules intact or
reinstall if needed..

Please advise..
I know if we upgraded your version of perl and lost your configured modules
you'd be upset correct..
that's why I am doing this..

 

#!/usr/bin/perl
use CPAN;
# install everything that is outdated on my disk:

print $fh "Getting packages that might need to be reinstalled ...\n";
CPAN::Shell->r;

select $fh; # get real STDOUT back
my(%packages, $seen);
for (@$out) {
  $seen++, next if /^Package namespace/;
  next unless $seen;
  last if /\d+ installed modules/;
  chomp;
  my @data = split /\s+/;
  $packages{$data[0]} = \@data;
}

for (sort keys %packages) {
  my $p = $packages{$_};
  print "\nThe latest version of $p->[NAME] (in $p->[FILE]) is $p->[LATEST].
You have $p->[INST] installed. Install latest version? [n]";

  chomp(my $r = <>);
  if ($r =~ /^y/i) {
    CPAN::Shell->install($_);
  } elsif ($r =~ /^[qe]/i) { # quit, exit
    last;
  }
}

ckage GetPrintData;

sub new {
  my($self, $fh);
  tie $fh, $self;
}

sub TIEHANDLE {
  my($self, $fh) = @_;
  bless [], $self;
}

sub PRINT {
  my($self, @data) = @_;
  push @{$self}, @data;
  1;
}

**********************************************************************
The information contained in this communication is
confidential, is intended only for the use of the recipient
named above, and may be legally privileged.
If the reader of this message is not the intended
recipient, you are hereby notified that any dissemination,
distribution, or copying of this communication is strictly
prohibited.
If you have received this communication in error,
please re-send this communication to the sender and
delete the original message or any copy of it from your
computer system. Thank You.

-- 
To unsubscribe, e-mail: beginners-cgi-unsubscribe@perl.org
For additional commands, e-mail: beginners-cgi-help@perl.org
--
             ---> Please post QUESTIONS and SUMMARIES only!! <---
        To subscribe/unsubscribe to this list, contact majordomo@dutchworks.nl
       Name: hpux-admin@dutchworks.nl     Owner: owner-hpux-admin@dutchworks.nl
 
 Archives:  ftp.dutchworks.nl:/pub/digests/hpux-admin       (FTP, browse only)
            http://www.dutchworks.nl/htbin/hpsysadmin   (Web, browse & search)


This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 11:02:29 EDT