On Fri, Feb 07, 2003 at 06:00:46PM +0000, Colin Goodier wrote:
> Hi,
>
> Is there any way to abstract the PerForm callback code out of the XSP
> pages, in the interests of keeping things tidy? A lot of our pages have
> substantial amounts of call-back code in there, which makes maintenance
> a little more problematic, especially for non-Perl people.
In my modules I use @EXPORT or @EXPORT_OK and in my xsp I use
<xsp:structure>
<xsp:import>Module</xsp:import>
<!-- or <xsp:import>Module qw(func1 funct2)</xsp:import> -->
</xsp:structure>
Another useful trick to keep from having to write every single validate
or load is to do some thing like.
@EXPORT = qw(
validate_first_name validate_middle_name validate_last_name
);
sub validate_name {
# do stuff
}
*validate_first_name = \&validate_name;
*validate_middle_name = \&validate_name;
*validate_last_name = \&validate_name;
These methods are prone to human error since perform will just keep
on working if it doesn't have a callback .... so be sure to check
your work.
Ed
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]