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