ziguzagu.org

CPAN Module のバージョン間 diff をコマンドラインでみる

CPAN Module の変更点をサクッと調べる方法

というエントリーに反応してみるテスト。

僕は CPAN Module のバージョン間の diff をとるのに、search.cpan.org にある diff 機能を使う以下のようなやっつけスクリプトを使ってる。

#!/usr/bin/env perl
use strict;
use warnings;

use LWP::Simple;

my ($pkg, $from, $to) = @ARGV;
$pkg =~ s/::/-/g;
my $content = get("http://search.cpan.org/diff/${pkg}-${from}-${pkg}-${to}.-w.diff")
    or die "oops. no content. try again!\n";
print $content;

たまに空のレスポンスが返ってきたりするけど….、これを less とか grep -A100 .pm とかなんとかにパイプしたりしなかったりしてコマンドラインで生 diff を確認。Cache::Memcached::Fast の 0.19 と 0.20 だったら以下の様な塩梅。

➜ cpandiff Cache::Memcached::Fast 0.19 0.20 | head -40
diff -Npurw Cache-Memcached-Fast-0.19/Changes Cache-Memcached-Fast-0.20/Changes
--- Cache-Memcached-Fast-0.19/Changes   2010-04-24 04:35:28.000000000 -0700
+++ Cache-Memcached-Fast-0.20/Changes   2013-04-03 10:35:44.000000000 -0700
@@ -1,6 +1,24 @@
 Revision history for Perl extension Cache::Memcached::Fast.


+0.20  2013-04-03
+        - finally fix magic.t failure.  Magic handling introduced in
+        0.18 wasn't correct until this release.  Upgrade if you use
+        Perl 'tie' feature or its derivatives like Readonly.
+
+        Changes since 0.19:
+
+        Fix RT#57150, RT#67106: magic.t failure.  Thanks to
+        <listposter@...> for instructions on how to reproduce the
+        problem.
+
+        Fix RT#77254: typo in POD documentation.  Tnanks to Alex
+        <alex112358@...>.
+
+        Fix RT#81782: Unnecessary string eval in constructor.  Thanks
+        to Andrew Holland for the patch.
+
+
 0.19  2010-04-24
         - revert SIGPIPE suppression change.  Upgrade if you couldn't
         build 0.18.
diff -Npurw Cache-Memcached-Fast-0.19/Fast.xs Cache-Memcached-Fast-0.20/Fast.xs
--- Cache-Memcached-Fast-0.19/Fast.xs   2010-04-24 04:35:28.000000000 -0700
+++ Cache-Memcached-Fast-0.20/Fast.xs   2013-04-03 10:35:44.000000000 -0700
@@ -631,6 +631,26 @@ embedded_store(void *arg, void *opaque,
 }


+/*
+  When SvPV() is called on a magic SV the result of mg_get() is cached
+  in PV slot.  Since we pass around pointers to this storage we have
+  to avoid value refetch and reallocation that would happen if
+  mg_get() is called again.  Because any magic SV may be put to the

パッケージまるごとの diff なので README とか、MANIFEST とかの差分もはいっててノイズがまぁまぁあるといえばあるけど、目 grep で除外…。

metacpan っていまだによくわかってないけど(汗)、同じようなのあるかしら。