From fcd546d12f9569c1acbab120b8e7c141bec8a0c2 Mon Sep 17 00:00:00 2001 From: David Baird Date: Fri, 4 Nov 2005 16:42:06 +0000 Subject: [PATCH] Moved the BeerDB example to Maypole.pm git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@414 48953598-375a-da11-a14b-00016c27c3ee --- lib/Maypole.pm | 47 +++++++++++++++++++++++++++++++++++--- lib/Maypole/Application.pm | 43 ---------------------------------- 2 files changed, 44 insertions(+), 46 deletions(-) diff --git a/lib/Maypole.pm b/lib/Maypole.pm index d8e893d..b5de0c5 100644 --- a/lib/Maypole.pm +++ b/lib/Maypole.pm @@ -22,7 +22,45 @@ Maypole - MVC web application framework =head1 SYNOPSIS -See L. +The canonical example used in the Maypole documentation is the beer database: + + package BeerDB; + use strict; + use warnings; + + # choose a frontend, initialise the config object, and load a plugin + use Maypole::Application qw/Relationship/; + + # get the empty config object created by Maypole::Application + my $config = __PACKAGE__->config; + + # basic settings + $config->uri_base("http://localhost/beerdb"); + $config->template_root("/path/to/templates"); + $config->rows_per_page(10); + $config->display_tables([qw[beer brewery pub style]]); + + # table relationships + $config->relationships([ + "a brewery produces beers", + "a style defines beers", + "a pub has beers on handpumps", + ]); + + # validation + BeerDB::Brewery->untaint_columns( printable => [qw/name notes url/] ); + BeerDB::Pub->untaint_columns( printable => [qw/name notes url/] ); + BeerDB::Style->untaint_columns( printable => [qw/name notes/] ); + BeerDB::Beer->untaint_columns( + printable => [qw/abv name price notes/], + integer => [qw/style brewery score/], + date => [ qw/date/], + ); + + # set everything up + __PACKAGE__->setup("dbi:SQLite:t/beerdb.db"); + + 1; =head1 DESCRIPTION @@ -1233,7 +1271,7 @@ calls during processing of a request. This is a brief summary: =head1 SEE ALSO -There's more documentation, examples, and a information on our mailing lists +There's more documentation, examples, and information on our mailing lists at the Maypole web site: L @@ -1242,12 +1280,15 @@ L, L, L. =head1 AUTHOR -Maypole is currently maintained by Aaron Trevena +Maypole is currently maintained by Aaron Trevena, David Baird, Dave Howorth and +Peter Speltz. =head1 AUTHOR EMERITUS Simon Cozens, C +Simon Flack maintained Maypole from 2.05 to 2.09 + Sebastian Riedel, C maintained Maypole from 1.99_01 to 2.04 =head1 THANKS TO diff --git a/lib/Maypole/Application.pm b/lib/Maypole/Application.pm index 38b1ec5..6804cde 100644 --- a/lib/Maypole/Application.pm +++ b/lib/Maypole/Application.pm @@ -164,49 +164,6 @@ You can specify a higher debug level by saying C<-Debug2> etc. =back -=head1 BeerDB - -The canonical example used in the Maypole documentation is the beer database, -which starts like this: - - package BeerDB; - use strict; - use warnings; - - # choose a frontend, initialise the config object, and load a plugin - use Maypole::Application qw/Relationship/; - - # get the empty config object created by Maypole::Application - my $config = __PACKAGE__->config; - - # basic settings - $config->uri_base("http://localhost/beerdb"); - $config->template_root("/path/to/templates"); - $config->rows_per_page(10); - $config->display_tables([qw[beer brewery pub style]]); - - # table relationships - $config->relationships([ - "a brewery produces beers", - "a style defines beers", - "a pub has beers on handpumps", - ]); - - # validation - BeerDB::Brewery->untaint_columns( printable => [qw/name notes url/] ); - BeerDB::Pub->untaint_columns( printable => [qw/name notes url/] ); - BeerDB::Style->untaint_columns( printable => [qw/name notes/] ); - BeerDB::Beer->untaint_columns( - printable => [qw/abv name price notes/], - integer => [qw/style brewery score/], - date => [ qw/date/], - ); - - # set everything up - __PACKAGE__->setup("dbi:SQLite:t/beerdb.db"); - - 1; - =head1 AUTHOR Sebastian Riedel, C -- 2.39.2