From: Marcus Ramberg Date: Wed, 13 Oct 2004 12:37:29 +0000 (+0000) Subject: All POD::Coverage tests now succeed. X-Git-Tag: 2.10~138 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=7dda5e1451220612c6ad749746d84e4c090e330c;p=maypole.git All POD::Coverage tests now succeed. git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@224 48953598-375a-da11-a14b-00016c27c3ee --- diff --git a/lib/CGI/Maypole.pm b/lib/CGI/Maypole.pm index ac0a4ba..db8cc75 100644 --- a/lib/CGI/Maypole.pm +++ b/lib/CGI/Maypole.pm @@ -82,6 +82,35 @@ CGI::Maypole - CGI-based front-end to Maypole This is a handler for Maypole which will use the CGI instead of Apache's C 1.x. This handler can also be used for Apache 2.0. +=head1 METHODS + +=over + +=item run + +Call this from your CGI script to start the Maypole application. + +=back + +=head1 Implementation + +This class overrides a set of methods in the base Maypole class to provide it's +functionality. See L for these: + +=over + +=item get_request + +=item get_template_root + +=item parse_args + +=item parse_location + +=item send_output + +=back + =head1 AUTHORS Dave Ranney C diff --git a/lib/Maypole.pm b/lib/Maypole.pm index 4c66a67..e4c0f73 100644 --- a/lib/Maypole.pm +++ b/lib/Maypole.pm @@ -303,6 +303,13 @@ You should only need to define this method if you are writing a new Maypole backend. Otherwise, see L +=head3 get_request + +You should only need to define this method if you are writing a new +Maypole backend. It should return something that looks like an Apache +or CGI request object, it defaults to blank. + + =head3 is_applicable Returns a Maypole::Constant to indicate whether the request is valid. @@ -387,6 +394,33 @@ Get/set the output content type. Default: text/html Sends the output and additional headers to the user. +=head3 call_authenticate + +This method first checks if the relevant model class +can authenticate the user, or falls back to the default +authenticate method of your Maypole application. + + +=head3 call_exception + +This model is called to catch exceptions, first after authenticate +,then after processing the model class, and finally to check for +exceptions from the view class. + +This method first checks if the relevant model class +can handle exceptions the user, or falls back to the default +exception method of your Maypole application. + + +=head3 handler + +This method sets up the class if it's not done yet, sets some +defaults and leaves the dirty work to handler_guts. + +=head3 handler_guts + +This is the core of maypole. You don't want to know. + =head1 SEE ALSO There's more documentation, examples, and a wiki at the Maypole web diff --git a/lib/Maypole/CLI.pm b/lib/Maypole/CLI.pm index 70fb201..81a2fd5 100644 --- a/lib/Maypole/CLI.pm +++ b/lib/Maypole/CLI.pm @@ -9,6 +9,13 @@ use warnings; my $package; our $buffer; +# Command line action +CHECK { + if ( ( caller(0) )[1] eq "-e" ) { + $package->handler() == OK and print $buffer; + } +} + sub import { $package = $_[1]; $package->require; @@ -17,7 +24,6 @@ sub import { unshift @{ $package . "::ISA" }, "Maypole::CLI"; } -sub get_request { } sub get_template_root { $ENV{MAYPOLE_TEMPLATES} || "." } sub parse_location { @@ -44,12 +50,6 @@ sub call_url { $package->handler() == OK and return $buffer; } -# Do it! -CHECK { - if ( ( caller(0) )[1] eq "-e" ) { - $package->handler() == OK and print $buffer; - } -} 1; @@ -98,7 +98,7 @@ more easily. For instance, a test script could look like this: - use Test::More tests => 5; + use Test::More tests => 3; use Maypole::CLI qw(BeerDB); use Maypole::Constants; $ENV{MAYPOLE_TEMPLATES} = "t/templates"; @@ -106,11 +106,36 @@ For instance, a test script could look like this: # Hack because isa_ok only supports object isa not class isa isa_ok( (bless {},"BeerDB") , "Maypole"); - @ARGV = ("http://localhost/beerdb/"); - is(BeerDB->handler, OK, "OK"); - like($Maypole::CLI::buffer, qr/frontpage/, "Got the front page"); + like(BeerDB->call_url("http://localhost/beerdb/"), qr/frontpage/, "Got the front page"); + + like(BeerDB->call_url("http://localhost/beerdb/beer/list"), qr/Organic Best/, "Found a beer in the list"); + +=head1 METHODS + +=over + +=item call_url + +for use in scripts. takes an url as argument, and returns the buffer. + +=back + + +=head1 Implementation + +This class overrides a set of methods in the base Maypole class to provide it's +functionality. See L for these: + +=over + +=item get_template_root + +=item parse_args + +=item parse_location + +=item send_output - @ARGV = ("http://localhost/beerdb/beer/list"); - is(BeerDB->handler, OK, "OK"); - like($Maypole::CLI::buffer, qr/Organic Best/, "Found a beer in the list"); +=back +=cut diff --git a/lib/Maypole/Model/CDBI.pm b/lib/Maypole/Model/CDBI.pm index bba1c5c..f409fff 100644 --- a/lib/Maypole/Model/CDBI.pm +++ b/lib/Maypole/Model/CDBI.pm @@ -51,14 +51,26 @@ Surprisingly, this command causes a database record to be forever lost. =item search +The search action + +=back + =head1 Helper Methods +=over + =item order =item stringify_column =item do_pager +=item related_class + +Given an accessor name as a method, this function returns the class this accessor returns. + +=back + =cut sub related { diff --git a/lib/Maypole/View/Base.pm b/lib/Maypole/View/Base.pm index e7bf299..95c8d9d 100644 --- a/lib/Maypole/View/Base.pm +++ b/lib/Maypole/View/Base.pm @@ -109,3 +109,53 @@ EOF sub template { die shift() . " didn't define a decent template method!" } 1; + + +=head1 NAME + +Maypole::View::Base - Base cl + +=head1 DESCRIPTION + +This is the base class for Maypole view classes. This is an abstract class +meant to define the interface, and can't be used directly. + +=head2 process + +This is the engine of this module. It populates all the relevant variables +and calls the requested action. + +Anyone subclassing this for a different database abstraction mechanism +needs to provide the following methods: + +=head2 template + +In this method you do the actual processing of your template. it should use L +to search for components, and provide the templates with easy access to the contents +of L. It should put the result in $r->{output} and return OK if processing was +sucessfull, or populate $r->{error} and return ERROR if it fails. + +=head1 Other overrides + +Additionally, individual derived model classes may want to override the + +=head2 new + +The default constructor does nothing. You can override this to perform actions +during view initialization. + +=head2 paths + +Returns search paths for templates. the default method returns factory, custom and + under the configured template root. + +=head2 vars + +returns a hash of data the template should have access to. The default one populates +classmetadata if there is a class, as well as setting the data objects by name if +there is one or more objects available. + +=head2 error + + +=cut