Scott Chapman wrote:
> This userid/password page is a module that I'd like to be able to
> drop into any project that needs this functionality.
Scott,
Just my two cents on your scenario...
You can achieve a high degree of modularity using EmbperlObject as it
stands. For instance, let's say you have a module which performs user
validation, as in your example. You can put this into a common library
area, say /www/lib/perl/. You then put some code in your base.epl file
(EMBPERL_OBJECT_BASE): (omitting obvious code)
/base.epl
[-
$subs = Execute ({object => 'subs.epl'});
if (!$subs->handle())
{
Execute ({inputfile => '*', package => __PACKAGE__});
}
-]
/subs.epl
[!
sub handle
{
my ($self) = @_;
return 0;
}
!]
So, by default the behavior is for handle() to return 0, which means
that the requested page ('*') will be called. Now, in a subdirectory
where you want to have your page handled by the module, you put a
subs.epl something like this:
/subdir/subs.epl
[! Execute ({isa => '/www/lib/perl/Auth.epl'}) !]
You can then redefine the subroutine handle() in Auth.epl, so that it
does something (i.e. handles the request) and then returns 1. This gets
rid of the need for exit() in the way that you are describing, I think -
whenever you want to use a module, you simply make a subdirectory as a
'stub' for that module, and place a subs.epl like the one above there.
Then, you direct the browser to that location, and it will automatically
be handled by your module. For finer control, you could pass in as a
parameter to handle() the uri of the calling page. The handle() module
could then use this to construct the final destination, using a
redirect. An additional parameter could be passed to indicate a finer
level of granularity within the calling module. This parameter could
then be passed back to the original module from Auth.epl in a CGI
parameter, so that it's available in %fdat. This could then be used to
determine the current state.
Of course what you are looking for is a way to make all this
transparent, which I can understand. But just throwing an idea out
there.
HTH
-Neil
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]