doc/makedoc.pl
ex/BeerDB.pm
lib/Maypole/CLI.pm
+lib/Maypole/Constants.pm
lib/Maypole/Model/Base.pm
lib/Maypole/Model/CDBI.pm
+lib/Maypole/View/Base.pm
+lib/Maypole/View/Mason.pm
lib/Maypole/View/TT.pm
lib/Maypole/Workflow.pod
lib/Maypole.pm
=head1 The Beer Database, Twice
+We briefly introduced the "beer database" example in the L<About.pod>
+material;
+
=head2 The big beer problem
=head2 The easy way
<h2> Listing of all [% classmetadata.plural %]</h2>
[% END %]
+=head1 Customizing Generic CRUD Applications
args action template ));
__PACKAGE__->config({});
__PACKAGE__->init_done(0);
-
-# Ape Apache::Constants interface
-use constant OK => 0;
-use constant DECLINED => -1;
+use Maypole::Constants;
sub debug { 0 }
my $r = bless { config => $class->config }, $class;
$r->get_request();
$r->parse_location();
+ my $status = $r->handler_guts();
+ if ($status != OK) {
+ warn "NOT OK!";
+ return $status;
+ }
+ $r->send_output;
+ return $status;
+}
+sub handler_guts {
+ my $r = shift;
$r->model_class($r->config->{model}->class_of($r, $r->{table}));
my $status = $r->is_applicable;
if ($status == OK) {
$r->{path} =~ s{/}{}; # De-absolutify
$r->template($r->{path});
}
- $status = OK;
if (!$r->{output}) { # You might want to do it yourself
- $status = $r->view_object->process($r);
- }
- $r->send_output;
- return $status;
+ return $r->view_object->process($r);
+ } else { return OK; }
}
sub is_applicable {
--- /dev/null
+package Maypole::Constants;
+use base 'Exporter';
+use constant OK => 0;
+use constant DECLINED => -1;
+use constant ERROR => -1;
+our @EXPORT = qw(OK DECLINED ERROR);
+1;
# vim:ft=perl
use Test::More tests => 5;
use Maypole::CLI qw(BeerDB);
+use Maypole::Constants;
$ENV{MAYPOLE_TEMPLATES} = "t/templates";
isa_ok( (bless {},"BeerDB") , "Maypole");
@ARGV = ("http://localhost/beerdb/");
-is(BeerDB->handler, 200, "OK");
+is(BeerDB->handler, OK, "OK");
like($Maypole::CLI::buffer, qr/frontpage/, "Got the front page");
@ARGV = ("http://localhost/beerdb/beer/list");
-is(BeerDB->handler, 200, "OK");
+is(BeerDB->handler, OK, "OK");
like($Maypole::CLI::buffer, qr/Organic Best/, "Found a beer in the list");