]> git.decadent.org.uk Git - maypole.git/blob - Makefile.PL
changed template path ordering, no longer return empty paths in TT view
[maypole.git] / Makefile.PL
1 use 5.006;
2 use ExtUtils::MakeMaker;
3
4 # See lib/ExtUtils/MakeMaker.pm for details of how to influence
5 # the contents of the Makefile that is written.
6 WriteMakefile(
7     NAME         => 'Maypole',
8     VERSION_FROM => 'lib/Maypole.pm',    # finds $VERSION
9     PREREQ_PM    => {
10         Class::DBI::Loader               => '0.02',
11         Class::DBI::AbstractSearch       => 0,
12         Class::DBI::Pager                => 0,
13         Class::DBI::Plugin::RetrieveAll  => 0,
14         Class::DBI::Loader::Relationship => 0,
15         Class::DBI                       => 0.96,
16         Class::DBI::SQLite               => 0.08,
17         CGI::Untaint                     => 1.26,
18         CGI::Untaint::date               => 0,
19         CGI::Untaint::email              => 0,
20         UNIVERSAL::moniker               => 0,
21         UNIVERSAL::require               => 0,
22         URI                              => 0,
23         URI::QueryParam                  => 0,
24         CGI::Simple                      => 0,
25         HTTP::Body                       => 0.5,
26         HTML::Element                    => 0,
27         HTTP::Headers                    => 1.59,
28         Template                         => 0,
29         Template::Plugin::Class          => 0,
30         Test::MockModule                 => 0,
31         Digest::MD5                      => 0,
32         File::MMagic::XS                 => 0.08,
33         Class::DBI::Plugin::Type         => 0,
34         Class::C3                        => 0.14,
35     },    # e.g., Module::Name => 1.1
36     (
37         $] >= 5.005
38         ?    ## Add these new keywords supported since 5.005
39           (
40             ABSTRACT_FROM => 'lib/Maypole.pm',   # retrieve abstract from module
41             AUTHOR => 'Aaron TEEJAY Trevena <aaron@aarontrevena.co.uk>'
42           )
43         : ()
44     ),
45 );
46
47 sub has_module {
48     my ($module, $version) = @_;
49     (my $file = "$module.pm") =~ s/::/\//g;
50     eval {require $file} or return;
51     return ($module->VERSION || 0) >= $version;
52 }
53
54 if ( !-e "t/beerdb.db" ) {
55     print "Making SQLite DB\n";
56     my $driver = 'SQLite';
57     eval { require DBD::SQLite } or do {
58         print "Error loading DBD::SQLite, trying DBD::SQLite2\n";
59         eval {require DBD::SQLite2} ? $driver = 'SQLite2'
60             : die "DBD::SQLite2 is not installed";
61     };
62     require DBI;
63     my $dbh = DBI->connect("dbi:$driver:dbname=t/beerdb.db");
64     my $sql = join( '', (<DATA>) );
65
66     for my $statement ( split /;/, $sql ) {
67         $statement =~ s/\#.*$//mg;           # strip # comments
68         $statement =~ s/auto_increment//g;
69         next unless $statement =~ /\S/;
70         eval { $dbh->do($statement) };
71         die "$@: $statement" if $@;
72     }
73 }
74
75 __DATA__
76
77 create table brewery (
78     id integer auto_increment primary key,
79     name varchar(30),
80     url varchar(50),
81     notes text
82 );
83
84 create table beer (
85     id integer auto_increment primary key,
86     brewery integer,
87     style integer,
88     name varchar(30),
89     url varchar(120),
90     tasted date,
91     score integer(2),
92     price varchar(12),
93     abv varchar(10),
94     notes text
95 );
96
97 create table handpump (
98     id integer auto_increment primary key,
99     beer integer,
100     pub integer
101 );
102
103 create table pub (
104     id integer auto_increment primary key,
105     name varchar(60),
106     url varchar(120),
107     notes text
108 );
109
110 create table style (
111     id integer auto_increment primary key,
112     name varchar(60),
113     notes text
114 );
115
116 INSERT INTO beer (id, brewery, name, abv) VALUES
117     (1, 1, "Organic Best Bitter", "4.1");
118 INSERT INTO brewery (id, name, url) VALUES
119     (1, "St Peter's Brewery", "http://www.stpetersbrewery.co.uk/");
120 INSERT INTO pub (id, name) VALUES (1, "Turf Tavern");
121 INSERT INTO handpump (id, pub, beer) VALUES (1, 1,1);
122