use strict; use warnings; use CPAN; use CPAN::Config; use ExtUtils::Manifest; use Cwd; BEGIN { no warnings 'redefine'; *CPAN::Shell::myprint = sub{}; } $| = 1; exit main( @ARGV ); sub main { our $startdir = cwd(); our @packages = grep $_, map CPAN::Shell->expandany( $_ ), keys %{{ map +(parse_packages( $_ ), undef), pms() }}; for my $pkg ( @packages ) { # Using $_ here causes the object to be destroyed. $pkg->get; } our @dirs = map +(File::Spec->splitpath( $_ ))[2], glob File::Spec->catfile( $CPAN::Config->{'build_dir'}, '*' ); for my $file ( map $_->cpan_file, @packages ) { my $dir = File::Spec->catdir( $CPAN::Config->{'build_dir'}, grep $file =~ /\Q$_/, @dirs ); my $cmd = "diff -ru $dir $startdir"; print "$cmd\n"; system $cmd; } return 0; } sub parse_packages { # This is stolen directly from cron/mldistwatch of pause release 4 +57 my $pmfile = shift; open my $fh, "<", $pmfile or die "Couldn't open $pmfile for read: +$!"; local $/ = "\n"; local $_; my $inpod = 0; my @pkgs; PLINE: while (<$fh>) { chomp; my $pline = $_; $inpod = $pline =~ /^=(?!cut)/ ? 1 : $pline =~ /^=cut/ ? 0 : $inpod; next if $inpod; next if substr($pline,0,4) eq "=cut"; $pline =~ s/\#.*//; next if $pline =~ /^\s*$/; last PLINE if $pline =~ /\b__(END|DATA)__\b/; my $pkg; if ( $pline =~ m{ (.*) \bpackage\s+ ([\w\:\']+) \s* ( $ | [\}\;] ) }x) { $pkg = $2; } if ($pkg) { # Found something # from package $pkg =~ s/\'/::/; next PLINE unless $pkg =~ /^[A-Za-z]/; next PLINE unless $pkg =~ /\w$/; next PLINE if $pkg eq "main"; next PLINE if length($pkg) > 64; #64 #restriction push @pkgs, $pkg; } } close $fh; return @pkgs; } sub pms { return grep /\.pm$/i, keys %{ ExtUtils::Manifest::manifind() }; }

In reply to cpandiff - diff local source against CPAN by diotalevi

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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.