On 13 Jan 2004, at 14:35, Frej Rasmussen wrote:

Maybe a stupid question. But i couldn't figure it out.
The perform taglib states:
"Starting with AxKit 1.6.1 it is possible to specify a class which your
XSP page inherits from. All the validate, load, submit and cancel
functions can be in the class you inherit from, reducing code
duplication, memory usage, and complexity."

But i would really like to see a code example.

Yeah, I'd like to document this better too...


The basic premise is to add an attribute: base-class="My::XSP::Page" to your <xsp:page> root tag. Then you define a package/class:

  package My::XSP::Page;
  use base qw(Apache::AxKit::Language::XSP::Page);


1;


Then in that package you can put your perform functions. If more than one XSP page inherits from that class they get to share the code.

Just put that class as a .pm file in your perl modules directory and it all should "just work". Better still, add a line:

PerlModule My::XSP::Page

into your httpd.conf and that module gets loaded at startup and its memory shared across all perl interpreters.

Someone might want to add a Wiki page about this - the original design is at http://axkit.org/wiki/view/AxKit/XSPInheritance but it's not really linked from anywhere, and is more of a design than a guide to using XSP inheritance - I'd be happy for someone to replace that page with something more akin to what I've written above, and link to it from somewhere.

Matt.


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to