[ic] Cleaning up my code?

marc.brevoort interchange-users@icdevgroup.org
Wed Sep 11 12:36:02 2002


On Wednesday 11 September 2002 16:59, you wrote:

> This is not true. A sub defined is in scope for the entire page, and
> in fact in any point forward in time from that, even in an AutoEnd.
> It is defined in the Safe compartment and will not go away.

In that case, "I stand corrected". 

> I use include, or global UserTag routines with external library
> modules. And you can make a library in catalog.cfg:

As I will have different library routines in different files, I came up with 
the following variation to the same theme. What I ended up doing is:

* Creating a directory 'lib' in the store root
* In this lib dir, I created two files in this libary directory:

> Sub library <<EOR
> sub {
> 	sub foo { return 'foo' }
> }
> EOR

> Sub library <<EOR
> sub {
> 	sub bar { return 'bar' }
> }
> EOR

Then in catalog.cfg, I added the lines

include lib/foo
include lib/bar

and restarted the interchange server.

> Then in the page:
>
>     [perl]
> 	return foo() . bar();
>     [/perl]

Works like a charm! Thanks for the help!

Regards,

Marc Brevoort