[ic] Subroutines and ActionMaps
Mark Gibson
interchange-users@icdevgroup.org
Mon Jan 27 11:40:01 2003
On Monday 27 Jan 2003 2:53 pm, Mike Heins wrote:
> One more note on this --- you can also call the Sub via:
>
> Sub <<EOF
> sub do_stuff {
> ...
> return $myresult;
> }
> EOF
>
> ActionMap myaction <<EOF
> sub {
> ...
> my $stuff = $Config->{Sub}{do_stuff}->();
> ...
> }
> EOF
I'm having another problem regarding 'Sub', they don't seem to work in
[perl] blocks.
Lets assume we have defined the do_stuff() sub as above.
The following doesn't work (within an HTML page):
[perl] return do_stuff(); [/perl]
I keep getting (in global error log):
Safe: Undefined subroutine &main::do_stuff called at (tag 'perl') line 1.
>
> return do_stuff();
>
BUT, the following works fine:
[perl] return $Config->{Sub}{do_stuff}->(); [/perl]
Have I missed something, or is this a bug?
I think it would be a useful feature if 'Sub' routines could be called from
anywhere in the catalogue, (ie. ActionMaps, UserTags, other Subs, [perl],
[calc], [mvasp], etc.)
as there doesn't seem to be anywhere else to place reuseable functions
(or again, have I overlooked something?)
Cheers
--
Mark Gibson <gibsonm@cromwell-tools.co.uk>
Web Developer
Cromwell Group Holdings Ltd