[ic] New help with global subs
Murray Gibbins
Murray@scotweb.ltd.uk
Thu, 22 Mar 2001 15:39:30 +0000
If you are writing a Global sub for interchange and you want to test and/or
debug it then you could do worse than to put it into a file and pass it though
this ....
--------------------------
#!/bin/bash
# self_test.sh
# Test a minivend/interchange Global subroutine
# Usage ./self_test.sh <file with only global sub in it>
if [ $# = 0 ]
then
echo "Syntax = ./self_test.sh <file with only global sub in it>";
exit 1;
fi ;
cat $1 | perl -e
'@l=map{/^\s*Global.*<<(.*)/?$GL=$1:1;$_}<>;map{$str.=$_}grep{!/(?:^\s*globalsub\s*<<)|(^$GL)/i}@l;eval
$str;print"\n\nGlobal Sub ",$@?" failed\n\n$@":" passed\n\n";'
--------------------------
for files of the form....
GlobalSub <<EOGA
sub gen_hash {
.....
}
EOGA
YMMV, but I thought I would share :-)
--
____
\__/ Murray Gibbins murray@scotweb.ltd.uk
/ \ Programmer
_ \__/ _ ================================================
\\ || // Scotweb Limited, info@scotweb.ltd.uk
\\||// 13a Albert Terrace, http://www.scotweb.ltd.uk
\||/ Edinburgh EH10 5EA Tel: +44 (0) 131 270 82 33
|| Scotland. Europe. Fax: +44 (0) 7020 93 49 04