PodAdz a tool for hacking on your POD

This got started while I was working on a new release of 8 distributions with 21 Perl modules which had accumulated various contact, license, and copyright info over the years, as well as having changed my mind about keeping the "Changes" section inline to the main code. By breaking the pod sections into individual pieces, a few simple shell commands allow you to edit all of them simultaneously without attempting a difficult and fragile multi-line search/replace.

So, let's take a look at what it would take to set your current e-mail address, regardless of how many times it has changed in how many modules. The find command on line 2 is assumed to be able to find all of the *.pm files of interest. If need be, you could make a list in some other way, but most authors have their files laid-out somewhat predictably. Note also that the package-name ($p) creation is completely optional, but you need to somehow get the slashes out of your filename list, so I chose to use the standard Package::Name form here.

  $ mkdir /tmp/pods
  $ find */trunk/lib/ -iname '*.pm' > /tmp/pm_list
  $ for f in $(cat /tmp/pm_list)
  do p=$(echo $f | perl -pe 's#.*/lib/##;s/\.pm//; s#/#::#g;')
  podadz breakout $f /tmp/pods/$p
  done
  $ md5sum /tmp/pods/*/*head1_AUTHOR | sort

That last command will dump a list of files and group them by their fingerprints. This is more useful in something like the copyright section where you might have 6 modules from one timeframe and 8 from another.

Now put your contact info in a snippet of pod in a file such as /tmp/the_author. You may want to copy one of the existing /tmp/pods/*/*head1_AUTHOR files to get this.

  $ for i in /tmp/cd_pods/*/*head1_AUTHOR
  do rm $i; ln -s /tmp/the_author $i
  done

And then just reassemble...

  $ for f in $(find */trunk/lib/ -iname '*.pm')
  do p=$(echo $f | perl -pe 's#.*/lib/##;s/\.pm//; s#/#::#g;')
  podadz assemble $f /tmp/pods/$p
  done

Deleting a given section is even easier.

  $ rm /tmp/pods/*/*Changes

The podadz definition still needs a little work. Let me know if you have any suggestions. The code currently lives here.


All material Copyright © 2005-2009 Scratch Computing.