you need to write for a simple database front-end:
package BeerDB;
- use base 'Apache::MVC';
+ use Maypole::Application;
BeerDB->setup("dbi:SQLite:t/beerdb.db");
- BeerDB->config->{uri_base} = "http://localhost/beerdb/";
+ BeerDB->config->{uri_base} = "http://localhost/beerdb";
+ BeerDB->config->{template_root} = "/path/to/templates";
BeerDB->config->{rows_per_page} = 10;
BeerDB->config->{display_tables} = [qw[beer brewery pub style]];
BeerDB::Brewery->untaint_columns( printable => [qw/name notes url/] );
that lets you add them.
If you have any problems getting to this point, you might want to look
-at L<http://wiki.simon-cozens.org/index.cgi?InstallationIssues>.
+at L<http://maypole.perl.org>.
Play about with the site. Add some beers. Maybe go out and buy some beers
to review if you need some inspiration. Don't be ill on my carpet.
it; it looks like this.
package BeerDB;
- use base 'Apache::MVC';
+ use Maypole::Application;
BeerDB->set_database("dbi:SQLite:t/beerdb.db");
- BeerDB->config->{uri_base} = "http://localhost/beerdb/";
+ BeerDB->config->{uri_base} = "http://localhost/beerdb";
+ BeerDB->config->{template_root} = "/path/to/templates";
BeerDB->config->{rows_per_page} = 10;
BeerDB->config->{display_tables} = [qw[beer brewery pub style]];
BeerDB::Brewery->untaint_columns( printable => [qw/name notes url/] );
Here's the first section:
package BeerDB;
- use base 'Apache::MVC';
+ use Maypole::Application;
BeerDB->setup("dbi:SQLite:t/beerdb.db");
This is actually all you need for a functional database front-end. Everything
it's a relatively small class which defines how the whole application is
going to run.
-The second line says that our front-end is going to be C<Apache::MVC>,
-which is the Apache C<mod_perl> based version of Maypole; there's also
-a CGI version, C<CGI::Maypole>, and a command-line version for
-debugging, C<Maypole::CLI>, but C<Apache::MVC> is usually the one you
-want.
+The second line says that our front-end is going to be
+C<Maypole::Application>, it automatically detects if you're using
+mod_perl or CGI and loads everything neccessary for you.
Thirdly we're going to need to set up our database with the given DBI
connection string. Now the core of Maypole itself doesn't know about
This leads naturally to the following driver code:
package Portal;
- use base 'Apache::MVC';
+ use Maypole::Application;
Portal->setup("dbi:mysql:ibsportal");
use Class::DBI::Loader::Relationship;
Portal->config->{loader}->relationship($_) for (