#!/bin/sh

## Find all the Perl modules here and below
find . -name "*.pm" | \
# Turn them into absolute pathnames; this is necessary because the tags file
# must have absolute pathnames for this to work
perl -pnle 's!^!$ENV{PWD}/!' | \
## Run ctags on all of them, and output to ~/.subversion/tags
xargs ctags -o ~/.subversion/tags

# Now add a link to the new ctags file in every dir (with exceptions) below
# this one
for i in $(find . -type d)
do
	## Filter pattern, we obviously don't want .backup and .svn to have tags!
	if echo "$i" | egrep -q '(\.svn|\.backup)'
	then
		continue
	fi
	## Add the link
	ln -s ~/.subversion/tags "$i"
done
