Skip to content

Instantly share code, notes, and snippets.

@hirose31
Created December 21, 2010 13:26
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hirose31/749928 to your computer and use it in GitHub Desktop.
Save hirose31/749928 to your computer and use it in GitHub Desktop.
pmver ()
{
do_cd=;
if [ "$1" = '-cd' ]; then
do_cd=1;
shift;
fi;
module=$1;
perl -M${module} -e "print \$${module}::VERSION,\"\n\"";
fullpath=$(
perldoc -ml ${module} 2>/dev/null
[ $? -eq 255 ] && perldoc -l ${module}
);
echo $fullpath;
if [ "$do_cd" = '1' ]; then
\cd $(dirname $fullpath);
fi
}
### こんなす
goa:10[~]$ pmver Acme::Hidek
40.0
/usr/local/lib/perl/5.8.8/Acme/Hidek.pm
### -cd つけるとソコにcdしまんす
goa:10[~]$ pmver -cd Acme::Hidek
40.0
/usr/local/lib/perl/5.8.8/Acme/Hidek.pm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment