[Maypole] maypole design questions

From: Todd W (toddrw69 at excite.com)
Date: Tue Jan 11 2005 - 16:07:20 GMT


I don't know where to start, exactly. Like I read in another thread, web
platform designs are much more philosophical than technical.

I need several things.

Apache 1/mod_perl 1 centric with the ability/extensibility to run even from
the command line.

runs on *nix and windows

cored to Class::DBI and Template::Toolkit

easily handle multiple applications connecting to different datasources

Feature specific logic stays out of the platform and is implemented as
plugins.

This is Maypole.

My search for a web app platform started out about 3 years ago. What I have
found myself always doing is researching CPAN to find modules in the target
problem space. Installing them, tinkering, seeing who is best
documented/supported/actively maintained. Then I set about writing my own
implementation just to see how I would do it. After I code myself into a
corner, I go back to CPAN and see who best addressed the corner I just coded
myself into.

First was configuration. I ended up using XML formatted config files using
XML::XPath/XML::Writer/XML::LibXSLT to interface.

Then, I worked with templating. It was easy to decide right away to go with
the template toolkit.

Then was relational/oo mapping. Alzabo/Tangram/SPOPS/Class::DBI. Then I
wrote what boiled down to a code generator that queried database schema and
generated source files for the relational/oo mapping. The corner I
eventually coded myself into was how to make foreign keys map to records in
other databases. Bingo, Class::DBI.

Then, logging. Here, I'm still stuck with an implementation of my own.
Logging calls to the logger boil down to XML::Writer calls. At the beginning
of a HTTP request the logger is instantiated. As the interpreter traverses
my code, calls to the logger maintain a stack of function calls and
messages. At the end of the request, the document is written out to disk.
Then I wrote a Log::Reader that applies an xslt stylesheet to the log file,
and out comes a treeview looking html document of user sessions.

Which brings me to the application server itself. I researched
poop.sourceforge.net and took a look at what was out there. Installed
OI/AxKit/Apache::ASP/Maypole. The most important feature to me that I
haven't found simplistically supported in an application server is multiple
views. So I start hacking away on an application server. Here's what I ended
up with:

To achieve device independence (multiple views) the client must specify what
format it would like. For example:

Request: /BeerDB/index.html

The code in a PerlFixupHandler checks to see if BeerDB::index.pm is in %INC.
If it is, the file residing at /BeerDB/index.html is a template to be
processed. To accomplish this, the logic then calls:

$r->handler( 'perl-script' );
$r->push_handlers( PerlHandler => \&Apache::Template::handler );

And then a custom Template::Service::Apache module adds a "page" object to
the data hash.

Very simple. very clean. If a customer wants to see the BeerDB on their
T-Mobile SideKick, I just create a new wrapper template and a template
called /BeerDB/index.tsk, and tell the user to bookmark it on their device.
Another benefit is templates and static files can live next to eachother
anywhere in the document_root. This is something I have been annoyed by for
years.

To further accommodate this, If the request does NOT map to a file but DOES
map to an entry in %INC, it is assumed to be a PerlHandler. This eliminates
the need for mucking about with httpd.conf, and the ->handler function gets
passed the application object, complete with session, log, user, and
request objects.

I have achieved filesystem location independence and file extension
independence along with device interface independence.

So, to the corner I'm now coded in: A standard way to authorize, accept,
validate, and store data from the user.

>From what I have seen from the demo apps I installed from the docs, maypole
has this. Can someone offer some discussion on this?

How well could my methodology above integrate with maypole? Could I
implement it via subclasses, or would I have to modify maypole source?

Can I use existing Class::DBI classes? I already have many Class::DBI
classes set up. How would I go about, for example, making them work with the
default templates?

Looking at http://maypole.perl.org/?About, it looks like I can just inherit
from Apache::MVC in my Application::DBI class that all table specific
Class::DBI classes inherit from, and leave the ->connection() call instead
of calling ->setup()?

If someone could tell me how to start reusing existing Class::DBI classes,
I'm sure I'll figure the rest of the system out as a side effect.

If this works out, I hope to become a member of the Maypole development
team, or at least develop distributable custom plugins. I believe I have a
lot to offer. My next goal after the input mechanism: role based
authorization.

Thanks for any input.

Todd W.

_______________________________________________
maypole mailing list
maypole at lists.netthink.co.uk
http://lists.netthink.co.uk/listinfo/maypole



This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:57 GMT