]> git.decadent.org.uk Git - maypole.git/blob - debian/patches/202_fix-example-references.diff
Updated patches for 2.13.
[maypole.git] / debian / patches / 202_fix-example-references.diff
1 --- maypole.orig/examples/BeerDB.pm
2 +++ maypole/examples/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 --- maypole.orig/examples/fancy_example/BeerDB.pm
26 +++ maypole/examples/fancy_example/BeerDB.pm
27 @@ -14,7 +14,7 @@
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";
33         }            
34         eval "require DBD::SQLite";
35          if ($@) {
36 @@ -31,8 +31,11 @@
37  BeerDB->config->uri_base( $ENV{BEERDB_BASE} || "http://localhost/beerdb/" );
38  
39  # Change this to the htdoc root for your maypole application.
40 -my @root=  ('t/templates');
41 +my @root;
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'
45 +    unless @root;
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
51 @@ -141,15 +141,15 @@
52          notes text
53      );
54  
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.
58 -
59  =head2 Setting up Maypole
60  
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>
71  or C<wwwrun>).
72 @@ -188,17 +188,29 @@
73          "a pub has beers on handpumps");
74      1;
75  
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
80 -about it:
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:
84 +
85 +=over
86 +
87 +=item *
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/>
90 +
91 +=item *
92 +Set the database path in F<BeerDB.pm>
93 +
94 +=item *
95 +Add the following to the Apache configuration:
96  
97      <Location /beerdb>
98          SetHandler perl-script
99          PerlHandler BeerDB
100      </Location>
101  
102 +=back
103 +
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>:
106  
107 @@ -214,10 +226,8 @@
108  
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.
111 -We're going to copy
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/>
116 +directory.
117  
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/>