1 --- trunk.orig/ex/BeerDB.pm
4 my $dbi_driver = DBI_DRIVER;
5 if ($dbi_driver =~ /^SQLite/) {
6 die sprintf "SQLite datasource '%s' not found, correct the path or "
7 - . "recreate the database by running Makefile.PL", DATASOURCE
8 + . "recreate the database using beerdb.sql", DATASOURCE
10 eval "require DBD::SQLite";
14 # Change this to the htdoc root for your maypole application.
16 -my @root= ('t/templates');
17 -push @root,$ENV{BEERDB_TEMPLATE_ROOT} if ($ENV{BEERDB_TEMPLATE_ROOT});
19 +push @root, 't/templates' if (-d 't/templates');
20 +push @root, $ENV{BEERDB_TEMPLATE_ROOT} if ($ENV{BEERDB_TEMPLATE_ROOT});
21 +push @root, '/usr/share/doc/libmaypole-perl/ex/templates' unless @root;
22 BeerDB->config->template_root( [@root] );
23 # Specify the rows per page in search results, lists, etc : 10 is a nice round number
24 BeerDB->config->rows_per_page(10);
25 --- trunk.orig/ex/fancy_example/BeerDB.pm
26 +++ trunk/ex/fancy_example/BeerDB.pm
28 my $dbi_driver = DBI_DRIVER;
29 if ($dbi_driver =~ /^SQLite/) {
30 die sprintf "SQLite datasource '%s' not found, correct the path or "
31 - . "recreate the database by running Makefile.PL", DATASOURCE
32 + . "recreate the database using beerdb.sql", DATASOURCE
34 eval "require DBD::SQLite";
38 # Change this to the htdoc root for your maypole application.
40 -my @root= ('t/templates');
41 -push @root,$ENV{BEERDB_TEMPLATE_ROOT} if ($ENV{BEERDB_TEMPLATE_ROOT});
43 +push @root, 't/templates' if (-d 't/templates');
44 +push @root, $ENV{BEERDB_TEMPLATE_ROOT} if ($ENV{BEERDB_TEMPLATE_ROOT});
45 +push @root, '/usr/share/doc/libmaypole-perl/ex/fancy_example/templates'
47 BeerDB->config->template_root( [@root] );
48 # Specify the rows per page in search results, lists, etc : 10 is a nice round number
49 BeerDB->config->rows_per_page(10);
50 --- trunk.orig/lib/Maypole/Manual/About.pod
51 +++ trunk/lib/Maypole/Manual/About.pod
56 -If you have C<DBD::SQLite> available, then a database like this will
57 -be created when Maypole was installed. Let's now see how to set it up
58 -with a web interface.
60 =head2 Setting up Maypole
62 The first thing we need for a Maypole interface to a database is to
63 have a database. If you don't have one, now would be a good time to
64 -create one, using the schema above. If you're creating a database
65 +create one, using the schema in
66 +F</usr/share/doc/libmaypole-perl/ex/beerdb.sql> (similar to the
67 +above). To use it with SQLite you must change C<auto_increment> to
68 +C<autoincrement>; with PostgreSQL you must use C<serial>.
69 +If you're creating a database
70 by hand, don't forget to grant permissions for your Apache server to
71 access it as well as yourself (typically a user name like C<www-data>
74 "a pub has beers on handpumps");
77 -There's a version of this program in the F<ex/> directory in the Maypole
78 -files that you downloaded in the F<~root/.cpan/> build area.
79 -This defines the C<BeerDB> application.
80 -To set it up as a mod_perl handler, just tell the Apache configuration
82 +There's a version of this program in the
83 +F</usr/share/doc/libmaypole-perl/ex/> directory. This defines the
84 +C<BeerDB> application. To set it up as a mod_perl handler:
89 +Copy F<BeerDB.pm> and the F<BeerDB/> directory into
90 +F</usr/local/lib/perl/C<$version>/> or F</usr/local/lib/site_perl/>
93 +Set the database path in F<BeerDB.pm>
96 +Add the following to the Apache configuration:
99 SetHandler perl-script
105 To use it as a CGI script, put it in your F<cgi-bin> directory,
106 together with a small file called F<beer.cgi>:
110 And now we need some templates. As we'll see in the chapter on
111 L<views|Maypole::Manual::View>, there are several types of template.
113 -the whole lot from the F<templates/> directory of the Maypole source
114 -package into the F</beerdb> directory under our web root.
115 -Make the C<template_root> in C<BeerDB> agree with your path.
116 +These are found in the F</usr/share/doc/libmaypole-perl/ex/templates/>
119 And that's it. We should now be able to go to C<http://localhost/beerdb/>
120 or C<http://localhost/cgi-bin/beer.cgi/>