It rocks.
I have yet to find out how extensible it is as I am busy prototyping my father-in-law's website. Maypole allows me to knock together a nice UI to manage the objects and quickly change the application schema via my mysql login and emacs to update the handful of LoC required to power it.
So far my only immediate questions are :
I am sure the later two are answered somewhere in the documentation, just thought I would mention that they are the first questions I would ask once I had a basic site up (which I now have).
I also got a mail from 'zengargoyle' about maypole - he would have replied to my post but lost his password and mailed me instead :
it looks like Maypole is still at 1.4 which i've been playing with
for a month or so.
the URL handling is a bit screwy, the examples have you give the base_url as http://somwhere/with/trailing/slash/ and it won't work without the last / but the templates aren't consistent and you'll end up with links that have '//' in them which is ugly.
whichever you choose CGI::Maypole or Apache::MVC for your driver, the parse_location function handles munging the URL. i think the regex might be a bit off and changed it to:
$self->{path} =~ s/^($loc\/*)?//;
and fixed up the templates to always put their own slashes.
[% base %] / [% table %] / [% action %]
in the Class::DBI::AsForm module there's some sort of bug that causes TEXT objects (in mysql database) to not have their current values set as default. if you edit a row with a TEXT object, the textarea comes up empty while varchar/int/etc have their current values.
i changed this in the to_field function which cleared up the problem and doesn't seem to break anything else...
#my $class = ref $self || $self; my $class = $self;
for command line testing the Maypole::CLI docs are a bit off. this is my cli test script.
#!/usr/bin/perl use lib './lib'; use Maypole::CLI qw( Sharpe ); # Sharpe is my app @ARGV=( join('/', 'http://somewhere/path/to/sharpe', @ARGV) ); @r=Sharpe->handler; print "$Maypole::CLI::buffer\n@r\n";
other than that, Maypole has worked out rather nicely. i'm about a month away from having my app all finished up and hope to contribute some patches then.
oh, i have a working FCGI::Maypole for mod_fastcgi if you dislike mod_perl and mod_cgi isn't fast enough.
oh, and you'll have to hack a bit if you want to send cookies from the CGI implementations. the Apache::MVC uses Apache::Request which has a place to set cookies to be sent back to the user. the CGI::Simple based CGI::Maypole doesn't (nor a way to send a redirect).
i just added an extra request variables and overrode the send_output funtion.
sub send_output { my $r = shift; if ( $r->{redirect} ) { return print $r->{cgi}->redirect( $r->{redirect} ); } my @cookies = values %{ $r->{cookies} }; push @headers, -cookies => [ @cookies ] if @cookies; print $r->{cgi}->header( -type => $r->{content_type}, -content_length => length $r->{output}, @headers, ); print $r->{output}; }
cheers carl :)
the beerdb.css is included in the latest CVS. there are some pointers on the wiki where to get a copy (or from the web cvs interface) or
$ wget http://dsl81-hayter.usc.edu/maypole.css
* why no frontpage template in the factory directory - something like the apache default start page would be cool.
also fixed in CVS. i think he made some tweaks while writing all of the articles and is moving them back into the base module all proper like.
* how do I change the order fields appear on the form?
override App::Table::display_columns somewhere..
sub Sharpe::Site::display_columns {
( qw| name comments version urn url | )
}
* How do I change dropdowns to use a field other than name or id?
this is a function of Class::DBI proper. DBI::Loader makes some guesses (like 'name' is used for stringification if it's there). The pulldown automagic is from the Relations that have been created.
App->config->{loader}->relationship(
'beer has breweries'
);
create table beer (
id integer...,
name varchar...,
brewery integer..., ...
)
create table brewery (
id integer...,
name varchar..., ...
)
the has_a/has_many relationships that Class::DBI::Loader creates controll the pulldown creation.
without Loader or manual has_a/has_many setup:
# a brewery.id
BeerDB::Beer->retrieve(1)->brewery == 1
with Loader or manual has_a/has_many setup:
BeerDB::Beer->retrieve(1)->brewery == (a Brewery object)
if you don't follow simple-enough table schemas for the Loader to guess how it should setup the relations you can do them yourself and maypole will use them.