Skip to content
Snippets Groups Projects
Forked from 713 / Warden / Warden - archive
609 commits behind the upstream repository.
chck_modules_version.sh 605 B
#!/bin/bash
#
# The script automatically obtain Perl modules and their local version
# in set directory (recursively)
#

if [[ -z $1 || ! -d $1 ]]; then
	echo "Usage: ${0##*/} <directory>"
	echo
	echo "Example: ${0##*/} ../src/warden-server/"
	exit 1
fi

modules_file="/tmp/warden-modules.txt"
sed '/^use [A-Z]/!d; /Warden/d' `find $1 -type f` 2>/dev/null | cut -f 2 -d " " | sed 's/;//' | sort -u > $modules_file

for module in $(<$modules_file);
do
	perl -e "eval { require $module; }; if (\$@) { print \"$module: version not found\n\"; } else { print \"$module >= \$$module::VERSION\n\"}"
done

exit 0