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