From 732af325bdf6fb16e808a15291e4aa823c2f5425 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sun, 16 Sep 2007 19:13:00 +0000 Subject: [PATCH] Added patch to fix some inconsistencies between examples and tutorial. --- .../patches/107_make-examples-consistent.diff | 160 ++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 161 insertions(+) create mode 100644 debian/patches/107_make-examples-consistent.diff diff --git a/debian/patches/107_make-examples-consistent.diff b/debian/patches/107_make-examples-consistent.diff new file mode 100644 index 0000000..1761627 --- /dev/null +++ b/debian/patches/107_make-examples-consistent.diff @@ -0,0 +1,160 @@ +--- trunk.orig/ex/fancy_example/BeerDB.pm ++++ trunk/ex/fancy_example/BeerDB.pm +@@ -6,11 +6,23 @@ + # This is the sample application. Change this to the path to your + # database. (or use mysql or something) + use constant DBI_DRIVER => 'SQLite'; +-use constant DATASOURCE => '/home/peter/Desktop/maypolebeer/beerdb'; ++use constant DATASOURCE => $ENV{BEERDB_DATASOURCE} || 't/beerdb.db'; + + BeerDB->config->model('BeerDB::Base'); + +-BeerDB->setup("dbi:mysql:beerdb",'root', ''); ++BEGIN { ++ my $dbi_driver = DBI_DRIVER; ++ if ($dbi_driver =~ /^SQLite/) { ++ die sprintf "SQLite datasource '%s' not found, correct the path or " ++ . "recreate the database by running Makefile.PL", DATASOURCE ++ unless -e DATASOURCE; ++ eval "require DBD::SQLite"; ++ if ($@) { ++ eval "require DBD::SQLite2" and $dbi_driver = 'SQLite2'; ++ } ++ } ++ BeerDB->setup(join ':', "dbi", $dbi_driver, DATASOURCE); ++} + + # Give it a name. + BeerDB->config->application_name('The Beer Database'); +@@ -20,7 +32,7 @@ + + # Change this to the htdoc root for your maypole application. + +-my @root= ('/home/peter/Desktop/maypolebeer/templates'); ++my @root= ('t/templates'); + push @root,$ENV{BEERDB_TEMPLATE_ROOT} if ($ENV{BEERDB_TEMPLATE_ROOT}); + BeerDB->config->template_root( [@root] ); + # Specify the rows per page in search results, lists, etc : 10 is a nice round number +@@ -37,7 +49,7 @@ + BeerDB::Brewery->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/], ++ printable => [qw/abv name price notes url/], + integer => [qw/style brewery score/], + date =>[ qw/tasted/], + ); +@@ -47,7 +59,7 @@ + + + # Required Fields +-BeerDB->config->{brewery}{required_cols} = [qw/name url/]; ++BeerDB->config->{brewery}{required_cols} = [qw/name/]; + BeerDB->config->{style}{required_cols} = [qw/name/]; + BeerDB->config->{beer}{required_cols} = [qw/brewery name price/]; + BeerDB->config->{pub}{required_cols} = [qw/name/]; +@@ -67,7 +79,7 @@ + + # For testing classmetadata + #sub BeerDB::Beer::classdata :Exported {}; +-sub BeerDB::Beer::list_columns { return qw/score name price style brewery/}; ++sub BeerDB::Beer::list_columns { return qw/score name price style brewery url/}; + + sub BeerDB::Handpump::stringify_self { + my $self = shift; +--- trunk.orig/ex/fancy_example/beerdb.sql ++++ trunk/ex/fancy_example/beerdb.sql +@@ -1,27 +1,28 @@ + CREATE TABLE style ( +- id integer primary key auto_increment, ++ id integer not null primary key auto_increment, + name varchar(60), + notes text + ); + + CREATE TABLE pub ( +- id integer primary key auto_increment, ++ id integer not null primary key auto_increment, + name varchar(60), + url varchar(120), + notes text + ); + + CREATE TABLE handpump ( +- id integer primary key auto_increment, ++ id integer not null primary key auto_increment, + beer integer, + pub integer + ); + + CREATE TABLE beer ( +- id integer primary key auto_increment, ++ id integer not null primary key auto_increment, + brewery integer, + style integer, + name varchar(30), ++ url varchar(120), + score integer(2), + price varchar(12), + abv varchar(10), +@@ -30,7 +31,7 @@ + ); + + CREATE TABLE brewery ( +- id integer primary key auto_increment, ++ id integer not null primary key auto_increment, + name varchar(30), + url varchar(50), + notes text +--- trunk.orig/lib/Maypole/Manual/About.pod ++++ trunk/lib/Maypole/Manual/About.pod +@@ -119,7 +119,8 @@ + score integer(2), + price varchar(12), + abv varchar(10), +- notes text ++ notes text, ++ tasted date + ); + + create table handpump ( +--- trunk.orig/ex/beerdb.sql ++++ trunk/ex/beerdb.sql +@@ -1,24 +1,24 @@ + CREATE TABLE style ( +- id integer primary key auto_increment, ++ id integer not null primary key auto_increment, + name varchar(60), + notes text + ); + + CREATE TABLE pub ( +- id integer primary key auto_increment, ++ id integer not null primary key auto_increment, + name varchar(60), + url varchar(120), + notes text + ); + + CREATE TABLE handpump ( +- id integer primary key auto_increment, ++ id integer not null primary key auto_increment, + beer integer, + pub integer + ); + + CREATE TABLE beer ( +- id integer primary key auto_increment, ++ id integer not null primary key auto_increment, + brewery integer, + style integer, + name varchar(30), +@@ -31,7 +31,7 @@ + ); + + CREATE TABLE brewery ( +- id integer primary key auto_increment, ++ id integer not null primary key auto_increment, + name varchar(30), + url varchar(50), + notes text diff --git a/debian/patches/series b/debian/patches/series index bac8b0a..53fd950 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -4,4 +4,5 @@ 104_add-cgi-error-status.diff 105_dont-use-warn-method.diff 106_fix-_column_info-clash.diff +107_make-examples-consistent.diff 201_no-file-mmagic-xs.diff -- 2.39.5