tags:

views:

62

answers:

2

Since discovering perlbrew, I'm a happy CPAN user. But what I have never figured out is how to read changelogs of modules. For example, when looking at the outdated ones with "r" in the CPAN shell, I'd like to easily inspect the changelog to decide whether to upgrade or not.

Of course I can download the module, unpack it, and hunt around for a changelog. But I hope there is an easier way. How do you do it?

I'm using the old CPAN shell. If CPANPLUS or cpanminus support this, I'd consider switching.

+6  A: 

I just look on CPAN Search. The main page for each distribution links to the main files, and you can also browse the entire distribution. You don't have to download or unpack the distribution.

You can also use the cpan command's -C switch so you don't have to enter the CPAN.pm shell:

 $ cpan -C Some::Module

I don't know of anything that will show you the Changes file at once for all of the outdated modules though. That would probably be a bit of a mess in the terminal. You might be able to rig up something with the -O switch:

 $ cpan -O | perl -anle 'print $F[0] if $. > 9' | xargs cpan -C

That's $. > 9 bit is there to skip the CPAN.pm output and the table header. It's ugly for sure.

If you wanted to do something more fancy, you could make that last part of the pipe some script to run cpan -C individually and save the result to a file. Put all the files in a directory of Changes and Bob's your uncle. That's a lot more work than I care to do. I just update things and look at the Changes later if something breaks.

brian d foy
Thanks, I missed the -C flag as I always use the shell, and it's not exposed as a command there. That should be easy to implement, maybe I got myself a new project here :-)
Thomas Kappler
Also, I agree that seeing all changes at once would be too messy, I would only want it for a specific module.
Thomas Kappler
+2  A: 

cpan-outdated nearly does what you need out of the box:

$ cpan-outdated --compare-changes

Above produces a diff between all your Changes files and latest from CPAN for each out dated module you have. However this can be a bit long & messy to trawl through if you have a lot of out dated modules!

Fortunately it only took a few changes to add these options:

$ cpan-outdated --pkg Catalyst::View::TT --compare-changes

$ cpan-outdated --filter-pkg Catalyst --compare-changes

My update can be found on Github here: http://github.com/draegtun/cpan-outdated. Here is the diff of my changes to tokuhirom cpan-outdated

/I3az/

draegtun
This would be really cool to add to cpan(1). I'll have to "see what you did there" :)
brian d foy
@brian d foy: All kudos should go to Tokuhirom (http://github.com/tokuhirom) because my changes were very minimal.
draegtun
Excellent, this is exactly what I was looking for. Thanks!
Thomas Kappler