[Maypole] New user (pt 2?)
Imran
junkmail@naweb.com
Sun, 27 Feb 2005 03:14:20 -0500
Hello again,
Quite a while ago I wrote a simple frontend to a simple db. I think all I did
was modify the beerdb example. my db was very similiar db wise. Got confused
with some bugs, I think. and then I couldn't figure out how to sort the
columns in my own order (it does it alphabetically).
Anyway, decided to do it again (2.09 or whatever is latest as of couple of
days ago) but use one table. I have a jokes section on my site, and wanted to
just create an admin for it. I'm using mod_perl. and proxying the app to
real server (didn't want restarts affecting real server).
Location for the PerlHandler is /perl/jokes/. doc root is /web/niazi, have
templates from the maypole distribution in /web/niazi/perl/jokes (no subdirs).
and the code is at the bottom. (After writing this email, adding this: My
questions are both 'what is the right answer', but also 'Where do the docs
show this answer?') First of all if I browse to /perl/jokes/ it shows the
'poorly configured' maypole page. All good so far. There is one link "List by
joke", since I only specified one table. But its a broken link:
http://www.niazi.net/perl/joke/list
What did I do wrong? It should be
"http://www.niazi.net/perl/jokes/joke/list". Or atleast that works. (ok, i
figured this out... forgot '/' at the end of uri_base. but in my defense i
was following the example).
Also the maypole.css was in the same dir as the template files. but the link
it points to is '/maypole.css' which is the webroot. the factory templates
shouldn't root the maypole.css. should be relative.
How do I figure out what different untaint_columns types there are? from the
documentation i mean. I think the only ones I could figure out from searching
the web or reading the example, or searching for untaint from all the manual
pages off of pod documentation) is the printable, integer and date. I guess
what i'm curious about is if there is an enum type or something. That
automagically does a pull down.
And of course, how DO i set the column sort type. and is that explained in
the docs... etc.
Oh, one more thing, shouldn't maypole ignore tables that don't appear in
display_tables, and no other relationships exist with those tables. Had to
put the table all by itself, to get the example to work.
After I get comfortable with this, i want to get a many-to-many relationship
to work. And then figure out to the good stuff.
Oh, also, the simple thing that I have working... its very slow. mod_perl+DBI
applications i've written are really fast. almost like I'm getting static
files. but maypole runs as fast as most cgi stuff runs. maybe even slightly
slower. I have a small script that uses class::dbi & template tookit to
generate my jokes pages (simple stuff I wrote to learn cdbi & tt), and thats
extremely slow to run (for what it does). But its a commandline thing that
generates pages, and I understand TT will run quicker persistently (since it
will compile the templates etc). Or is it just the example templates are
really slow? but not sure what would be different (or atleast what would be
less...)
Any example sites that are using maypole? Or even class::dbi + TT based
dynamic sites?
Thanks for reading and/or replying to this... :)
Imran
-------
package Naweb::JokesAdmin;
#use base 'Maypole::Application';
use Maypole::Application;
__PACKAGE__->setup("dbi:mysql:jokes","usr","pass");
__PACKAGE__->config->uri_base("http://www.niazi.net/perl/jokes");
__PACKAGE__->config->template_root("/web/niazi/perl/jokes");
__PACKAGE__->config->rows_per_page(20);
__PACKAGE__->config->display_tables([qw[joke]]);
Naweb::JokesAdmin::Joke->untaint_columns(
printable => [qw/joke_type rating credit title content answer/],
date => [ qw/date/ ] );