[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl-Porters] compile/install/test problem



At 18.10 -0600 2000.01.18, Matthew Langford wrote:
>On Tue, 18 Jan 2000, Paul Schinder wrote:
>
>> >Here's my blib structure:
><snip>
>> >Is this right?
>>
>> In a proper blib the architecture dependent things go in blib/arch,
>> but the way you have it looks like it will work.
>
>Oh.  I was basing the structure on other modules, like XML::Parser and
>Text::CSV, that I got from MMP.  Will installme.plx do the right thing if
>it encounters blib/arch?

I don't know.  What you have looks fine, and seems to be how I do it.


>More blue sky dreaming...
>Once I've gotten a module to compile, it doesn't take much work to pop in
>a new version and recompile.  I wonder if it's possible to use push
>technology (isn't XSV an XML-ized server push "channel"?) to subscribe to
>updates, automatically download, and recompile?

I wouldn't want anyone pushing compiled code, or Perl code to put in my
@INC, to my computer.


>Like an active "push" CPAN, which would ask if you wished to update
>modules X,Y,Z,... which had updates available.  Of course you can look for
>updates with CPAN, but already doing the search, and prompting for an
>automated update, might be handy.  Some provision would need to be made
>for modules the CPAN user wished to keep perpetually out of date (GD-Gif
>or Zlib, for example), to prevent the prompting from becoming a pest.

Well, just doing "r" in the CPAN shell tells you what needs to be updated.
So you are halfway there.  You can write your own program or module to use
that functionality.  Here is something to get you most of the rest of the
way:

#!/usr/bin/perl -w
# pudge@pobox.com, 2000.01.21
use strict;
use CPAN;
use Symbol;
use enum qw[NAME INST LATEST FILE];

# because r() prints to STDOUT: dup STDOUT to $fh, and
# tie STDOUT so we can capture it and parse it
my $fh = gensym;
open $fh, ">&STDOUT" or die $!;
my $out = tie *STDOUT, 'GetPrintData';
select((select($fh), $|++)[0]);  # unbuffer $fh

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;
  }
}


package 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;
}

__END__


-- 
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-porters-request@macperl.org