On Mon, Jun 03, 2002 at 04:05:52PM -0700, Joshua Chamas wrote:
> but having XMLSubs all go to includes is sometimes overkill.
>
> Obviously this points to a weakness in the system, to have to
> do these things. This might be better supported if all XMLSubs
> are handled by one default subroutine
> or have some config like XMLSubsHandler my::handler
>
> which would take as an argument the name of the XMLSubs tag
> as one of its arguments
That sounds like a potentially good idea. I can only see two problems
that would arise if Apache::ASP switched to that scheme: (1) backwards
compatibility, and (2) ending up juggling lots of files.
(1) shouldn't be a problem actually, by having a switch in httpd.conf
that determines whether to use the old way or the new way.
As for (2), I looked at one of my websites which uses XMLSubs to study
how I generally use it. It had 7 subroutines. 3 of them were just a
$main::Response->Include(). Then I had 2 short subroutines like this
one:
sub spacer {
my $attr = shift;
print qq{<img src="/images/spacer.gif" width=$attr->{width} height=$attr->{height}
alt="">};
}
and 2 longer subroutines that would have looked a bit nicer if they
were .inc files.
But, given that I can do, like you suggested:
for (qw(select text textarea)) {
eval "sub $_ { $main::Response->Include(\"$_.inc\", \@_) }"
}
having the XMLSubsHandler feature wouldn't be that important, though.
I could even make the above function readdir() and automatically
create a subroutine for every .inc file that exists in a certain
directory to ease administration.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]