]> git.decadent.org.uk Git - maypole.git/blob - debian/patches/202_fix-example-references.diff
e35ec87611ff2449300f822af28e3a734a9f7ac3
[maypole.git] / debian / patches / 202_fix-example-references.diff
1 --- trunk.orig/ex/BeerDB.pm
2 +++ trunk/ex/BeerDB.pm
3 @@ -13,7 +13,7 @@
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
9              unless -e DATASOURCE;
10          eval "require DBD::SQLite";
11          if ($@) {
12 @@ -31,8 +31,10 @@
13  
14  # Change this to the htdoc root for your maypole application.
15  
16 -my @root=  ('t/templates'); 
17 -push @root,$ENV{BEERDB_TEMPLATE_ROOT} if ($ENV{BEERDB_TEMPLATE_ROOT});
18 +my @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
27 @@ -14,7 +14,7 @@
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
33              unless -e DATASOURCE;
34          eval "require DBD::SQLite";
35          if ($@) {
36 @@ -32,8 +32,11 @@
37  
38  # Change this to the htdoc root for your maypole application.
39  
40 -my @root=  ('t/templates'); 
41 -push @root,$ENV{BEERDB_TEMPLATE_ROOT} if ($ENV{BEERDB_TEMPLATE_ROOT});
42 +my @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'
46 +    unless @root;
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
52 @@ -142,15 +142,15 @@
53          notes text
54      );
55  
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.
59 -
60  =head2 Setting up Maypole
61  
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>
72  or C<wwwrun>).
73 @@ -189,17 +189,29 @@
74          "a pub has beers on handpumps");
75      1;
76  
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
81 -about it:
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:
85 +
86 +=over
87 +
88 +=item *
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/>
91 +
92 +=item *
93 +Set the database path in F<BeerDB.pm>
94 +
95 +=item *
96 +Add the following to the Apache configuration:
97  
98      <Location /beerdb>
99          SetHandler perl-script
100          PerlHandler BeerDB
101      </Location>
102  
103 +=back
104 +
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>:
107  
108 @@ -215,10 +227,8 @@
109  
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.
112 -We're going to copy
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/>
117 +directory.
118  
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/>