Hi All,

I guess I should chime in on this.

Robert Eden wrote:
> Has there been any progress on a windows PPM release?  (or fixing
> whatever problem the automated tool has)

Hmn!! Automated tool :) I wish we had one :)
Well, I have started something along the lines of an
automated tool. It is by far no means ready for production but
it kinda works.

It took some time (to write the script) but I was able 
to generate ppm's for the following:
(for perl 5.8.3)

04/14/2004  07:26a                 603 DateTime-0.21.ppd
04/14/2004  11:15a                 892 DateTime-Calendar-Chinese.ppd
04/14/2004  11:17a                 634 DateTime-Calendar-Christian.ppd
04/14/2004  10:36a                 516 DateTime-Calendar-Coptic.ppd
04/14/2004  10:04a                 564 DateTime-Calendar-FrenchRevolutionary
04/14/2004  11:14a                 531 DateTime-Calendar-Hebrew.ppd
04/14/2004  08:23a                 486 DateTime-Calendar-Hijri-0.00.ppd
04/14/2004  11:15a                 521 DateTime-Calendar-Japanese-Era.ppd
04/14/2004  11:15a                 738 DateTime-Calendar-Japanese.ppd
04/14/2004  11:15a                 473 DateTime-Calendar-Julian.ppd
04/14/2004  10:05a                 519 DateTime-Calendar-Mayan.ppd
04/14/2004  11:13a                 605 DateTime-Calendar-Pataphysical.ppd
04/14/2004  11:13a                 707 DateTime-Event-Chinese.ppd
04/14/2004  10:36a                 578 DateTime-Event-Cron.ppd
04/14/2004  11:13a                 639 DateTime-Event-Easter.ppd
04/14/2004  10:36a                 514 DateTime-Event-ICal.ppd
04/14/2004  11:17a                 740 DateTime-Event-Lunar.ppd
04/14/2004  11:13a                 681 DateTime-Event-NameDay.ppd
04/14/2004  08:29a                 512 DateTime-Event-Random-0.03.ppd
04/14/2004  11:22a                 514 DateTime-Event-Recurrence.ppd
04/14/2004  11:15a                 691 DateTime-Event-SolarTerm.ppd
04/14/2004  11:15a                 557 DateTime-Event-Sunrise.ppd
04/14/2004  11:15a                 549 DateTime-Fiction-JRRTolkien-Shire.ppd
04/14/2004  10:36a                 485 DateTime-Fiscal-Year.ppd
04/14/2004  11:15a                 508 DateTime-Format-Bork.ppd
04/14/2004  11:14a                 582 DateTime-Format-Builder.ppd
04/14/2004  11:16a                 521 DateTime-Format-DateManip.ppd
04/14/2004  10:03a                 513 DateTime-Format-DBI.ppd
04/14/2004  11:13a                 479 DateTime-Format-Epoch.ppd
04/14/2004  11:15a                 467 DateTime-Format-Excel.ppd
04/14/2004  11:13a                 497 DateTime-Format-HTTP.ppd
04/14/2004  11:16a                 710 DateTime-Format-ICal.ppd
04/14/2004  10:37a                 524 DateTime-Format-ISO8601.ppd
04/14/2004  11:15a                 709 DateTime-Format-Japanese.ppd
04/14/2004  10:04a                 531 DateTime-Format-Mail.ppd
04/14/2004  10:04a                 587 DateTime-Format-Pg.ppd
04/14/2004  11:13a                 528 DateTime-Format-Roman.ppd
04/14/2004  11:14a                 650 DateTime-Format-Strptime.ppd
04/14/2004  11:15a                 472 DateTime-Format-W3CDTF.ppd
04/14/2004  08:25a                 463 DateTime-Functions-0.01.ppd
04/14/2004  10:05a                 466 DateTime-HiRes.ppd
04/14/2004  10:04a                 575 DateTime-Incomplete.ppd
04/14/2004  10:38a                 421 DateTime-Locale.ppd
04/14/2004  10:03a                 398 DateTime-Precise.ppd
04/14/2004  08:30a                 485 DateTime-Set-0.16.ppd
04/14/2004  10:36a                 406 DateTime-Stringify.ppd
04/14/2004  10:36a                 528 DateTime-TimeZone-Alias.ppd
04/14/2004  10:36a                 459 DateTime-TimeZone-LMT.ppd
04/14/2004  11:16a                 498 DateTime-TimeZone.ppd
04/14/2004  08:00a                 597 DateTime-Util-Astro-0.02.ppd
04/14/2004  10:35a                 584 DateTime-Util-Calc.ppd
04/14/2004  11:22a                 407 DateTimeCron-Simple.ppd
04/14/2004  11:22a                 455 DateTimeFormat-Duration.ppd

Now, what can I do with these? I do not have a web page to put them
on. Grant it this needs a lot of work, but it is a start. Comments,
suggestions on how to proceed let me know.
(I'm tried :( )

Thanks

Ron Hill



the script
-------------------------------------------------------------
use strict;
use warnings;
use LWP::UserAgent;
use File::Basename;
use HTML::LinkExtor;
use URI::URL;
use PPM::Make;

#use Data::Dumper;

my $base_dir    = 'f:/datetime_dest';
my $dest_source = 'f:/datetime_dest/archive';
my $url         = "http://cpan.org/modules/01modules.index.html";;

my %module = get_datetime_modules($url);

my @source_modules = get_files($dest_source);

#get the difference between the two

foreach my $filename(@source_modules) {
    if ( exists( $module{$filename} ) ) {
        delete $module{$filename};
    }
}

#make the distro

while ( my ( $filename, $urlpath ) = each(%module) ) {

    my $ppm = PPM::Make->new(
      dist   => "$urlpath",
      vs     => 'yes',
      ignore => 'yes',
      upload => {
          ar  => $dest_source,
          ppd => $base_dir
      },
      vsr => 'yes',
    );
    eval { $ppm->make_ppm(); };
    next if $@;
}

sub get_datetime_modules {
    my ($url) = @_;
    my %module = ();
    my $ua     = LWP::UserAgent->new;

    # Set up a callback that collect image links
    our @ahref = ();

    sub callback {
        my ( $tag, %attr ) = @_;
        return if $tag ne 'a';
        foreach my $item( values %attr ) {
            push ( @ahref, $item ) if ( $item =~ /\/DateTime.*.tar.gz/ );
        }
    }

    my $p = HTML::LinkExtor->new( \&callback );

    my $res =
      $ua->request( HTTP::Request->new( GET => $url ),
      sub { $p->parse( $_[0] ) } );

    # Expand all image URLs to absolute ones
    my $base = $res->base;
    @ahref = map { $_ = url( $_, $base )->abs; } @ahref;

    foreach my $item(@ahref) {
        my ( $name, $dir, $ext ) = fileparse( $item, '\..*' );
        my $module_name = join ( '', $name, $ext );
        $module{$module_name} = $item;
    }

    return %module;
}

sub get_files {
    my ($dir) = @_;

    opendir( DIR, $dir ) or die "Can't open directory $dir: $!";

    my @listing = ();

    while ( defined( my $file = readdir(DIR) ) ) {
        next if $file =~ /^\.\.?$/;
        push ( @listing, $file );
    }
    return @listing;
}



Reply via email to