[ic] Bad GlobalSub

Murray Gibbins interchange-users@lists.akopia.com
Fri Jul 6 11:52:00 2001


Richard Eicher II wrote:
> 
> Here what I get.
> 
> ---Command Line
> 
> [root@nemisis /root]# ./self_test.sh linkpt
> ./self_test.sh:
> @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";: No such file or directory
> No code specified for -e.
> ./self_test.sh:
> map{$s.=$_}grep{!/(?:^\s*globalsub\s*<<(.*)$)|(^\1)/i}<>;eval$s;print"\nGlobal
> Sub ",$@?" failed\n$@":"passed","\n\n";: No such
> file or directory
> [root@nemisis /root]#
> 
> ---Command Line
> 
> Here is my self_test.sh file.
> 
> ---BASH
> 
> #!/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
> /root/linkpt";
>         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";'
> 
> ---BASH
> 
> Side note: I cp linkpt to root just to test.
> I do not think that I have done the test right,
> as the out put tells me nothing. What have I done
> wrong. :)
> 
> Thank you for your time,
> Richard Eicher II
> 
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail
> http://personal.mail.yahoo.com/
> _______________________________________________
> Interchange-users mailing list
> Interchange-users@lists.akopia.com
> http://lists.akopia.com/mailman/listinfo/interchange-users

ahhh, looks like your mail reader has put some line breaks into the perl one
liner. The line starting with "cat" and ending with "\n\n";'" is _one_ line!

As is the one above it which was an earlyier test and was commented out. Sorry,
sometimes I forget that not every one knows there way around Unix :-)

Yours
Murray

PS here is me using it .....

------------------------------

[interch@handle shipd_mod]$ ./self_test.sh shipd_GLOBAL_SUB

Global Sub passed

[interch@handle shipd_mod]$ 

------------------------------
 
where  shipd_GLOBAL_SUB looks like this...


--snip

GlobalSub <<EOGS

    sub shipd{


       use lib qw(/etc/minivend/shipd_mod);    
        use strict;     
        use DBI ;
        use Sys::Syslog qw(:DEFAULT setlogsock); 
        use POSIX;
        
        use Get_zones;
        

        use Common_shipd   ;


	...more stuff ....

	return 0;
}
EOGS

--snip















-- 
  ____
  \__/    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