#!/bin/sh - perl=/usr/bin/perl cpan=/usr/bin/cpan libs= #se Finance::Quote; # for gnucash #se Crypt::SSLeay; # for Finance::Quote::Tiaacref # ckperl - rough test that all Perl modules are present for HOME # Steve Kinzler, kinzler@cs.indiana.edu, May 04/May 08 # http://www.cs.indiana.edu/~kinzler/home.html#homedir case "$1" in -h) cat <&2 usage: $0 [ -u ] [ -c | -p ] -u include perl lib in home directory -c output just cpan install commands for missing modules -p output just single cpan shell command for missing modules To attempt an install of all missing modules at once, run: $0 -p | sh -x EOF exit 1;; -u) libs="$libs -I$HOME/libp/perl"; shift;; esac greph '[u#]se.*;' | $perl -ne "s/[';\s].*//, print if s/^.*:\s*(eval\s+'\s*)?[u#]se\s+(.+)('\s*)?;.*/\$2\\n/" | grep . | sort -u | $perl -pe "s,^,$perl $libs -e 'use ,; s/$/'/" | case "$1" in -c) sh 2>&1 | sed -n 's/.*Can.t locate \([^ ]*\).*/\1/p' | sed 's/\.p.$//; s/\//::/g; s/^/install /';; -p) sh 2>&1 | sed -n 's/.*Can.t locate \([^ ]*\).*/\1/p' | sed 's/\.p.$//; s/\//::/g' | perl -e 'chomp(@_ = <>); print "'"$cpan"'\t", join(" \\\n\t", @_), "\n"';; *) sh -x;; esac rm -f smallprof.out