]> git.decadent.org.uk Git - maypole.git/blob - ex/BeerDB.pm
64f69541ba97aa4cf398a664dd0f438b1c5eb2b6
[maypole.git] / ex / BeerDB.pm
1 package BeerDB;
2 use Maypole::Application qw/-Debug/;
3 use Class::DBI::Loader::Relationship;
4
5 BEGIN {
6 # This is the sample application. Change this to the path to your
7 # database. (or use mysql or something)
8 BeerDB->setup("dbi:SQLite:t/beerdb.db");
9 }
10
11 # Give it a name.
12 BeerDB->config->application_name('The Beer Database');
13
14 # Change this to the root of the web space.
15 BeerDB->config->uri_base("http://localhost/beerdb/");
16 #BeerDB->config->{uri_base} = "http://neo.trinity-house.org.uk/beerdb/";
17
18 BeerDB->config->rows_per_page(10);
19
20 # Handpumps should not show up.
21 BeerDB->config->{display_tables} = [qw[beer brewery pub style]];
22 BeerDB::Brewery->untaint_columns( printable => [qw/name notes url/] );
23 BeerDB::Style->untaint_columns( printable => [qw/name notes/] );
24 BeerDB::Beer->untaint_columns(
25     printable => [qw/abv name price notes url/],
26     integer => [qw/style brewery score/],
27     date =>[ qw/date/],
28 );
29 BeerDB->config->{loader}->relationship($_) for (
30     "a brewery produces beers",
31     "a style defines beers",
32     "a pub has beers on handpumps");
33
34 # For testing classmetadata
35 sub BeerDB::Beer::classdata :Exported {};
36 sub BeerDB::Beer::list_columns  { return qw/score name price style brewery url/};
37
38 1;