]> git.decadent.org.uk Git - maypole.git/blobdiff - lib/Maypole.pm
removed warnings about calling standard templates
[maypole.git] / lib / Maypole.pm
index 6ab5bc029860121331a1285467ef68d961f4a2ec..f7699c3c259adc050d701d1a20d7a30be154aa46 100644 (file)
@@ -1,11 +1,13 @@
 package Maypole;
 use base qw(Class::Accessor::Fast Class::Data::Inheritable);
 package Maypole;
 use base qw(Class::Accessor::Fast Class::Data::Inheritable);
-use attributes ();
 use UNIVERSAL::require;
 use strict;
 use warnings;
 use Maypole::Config;
 use UNIVERSAL::require;
 use strict;
 use warnings;
 use Maypole::Config;
+use Maypole::Constants;
+
 our $VERSION = '2.0';
 our $VERSION = '2.0';
+
 __PACKAGE__->mk_classdata($_) for qw( config init_done view_object );
 __PACKAGE__->mk_accessors(
     qw( ar params query objects model_class template_args output path
 __PACKAGE__->mk_classdata($_) for qw( config init_done view_object );
 __PACKAGE__->mk_accessors(
     qw( ar params query objects model_class template_args output path
@@ -13,7 +15,6 @@ __PACKAGE__->mk_accessors(
 );
 __PACKAGE__->config( Maypole::Config->new() );
 __PACKAGE__->init_done(0);
 );
 __PACKAGE__->config( Maypole::Config->new() );
 __PACKAGE__->init_done(0);
-use Maypole::Constants;
 
 sub debug { 0 }
 
 
 sub debug { 0 }
 
@@ -61,6 +62,7 @@ sub handler {
     my $r = bless { config => $class->config }, $class;
     $r->get_request($req);
     $r->parse_location();
     my $r = bless { config => $class->config }, $class;
     $r->get_request($req);
     $r->parse_location();
+    warn "Request path: $r->{path}" if $r->debug;
     my $status = $r->handler_guts();
     return $status unless $status == OK;
     $r->send_output;
     my $status = $r->handler_guts();
     return $status unless $status == OK;
     $r->send_output;
@@ -128,23 +130,16 @@ sub is_applicable {
     $config->ok_tables || $config->ok_tables( $config->display_tables );
     $config->ok_tables( { map { $_ => 1 } @{ $config->ok_tables } } )
       if ref $config->ok_tables eq "ARRAY";
     $config->ok_tables || $config->ok_tables( $config->display_tables );
     $config->ok_tables( { map { $_ => 1 } @{ $config->ok_tables } } )
       if ref $config->ok_tables eq "ARRAY";
-    warn "We don't have that table ($self->{table})"
+    warn "We don't have that table ($self->{table}).\n"
+      . "Available tables are: "
+      . join( ",", @{ $config->{display_tables} } )
       if $self->debug
       if $self->debug
-      and not $config->ok_tables->{ $self->{table} };
+      and not $config->ok_tables->{ $self->{table} }
+      and $self->{action};
     return DECLINED() unless exists $config->ok_tables->{ $self->{table} };
 
     return DECLINED() unless exists $config->ok_tables->{ $self->{table} };
 
-    # Does the action method exist?
-    my $cv = $self->model_class->can( $self->{action} );
-    warn "We don't have that action ($self->{action})"
-      if $self->debug and not $cv;
-    return DECLINED() unless $cv;
-
-    # Is it exported?
-    $self->{method_attribs} = join " ", attributes::get($cv);
-    do {
-        warn "$self->{action} not exported" if $self->debug;
-        return DECLINED();
-    } unless $self->{method_attribs} =~ /\bExported\b/i;
+    # Is it public?
+    return DECLINED unless $self->model_class->is_public( $self->{action} );
     return OK();
 }
 
     return OK();
 }
 
@@ -211,7 +206,7 @@ See L<Maypole::Application>.
 =head1 DESCRIPTION
 
 This documents the Maypole request object. For user documentation, see
 =head1 DESCRIPTION
 
 This documents the Maypole request object. For user documentation, see
-L<Maypole::Tutorial>.
+L<Maypole::Manual>.
 
 =head2 CLASS METHODS
 
 
 =head2 CLASS METHODS
 
@@ -221,11 +216,10 @@ Returns the L<Maypole::Config> object
 
 =head3 setup
 
 
 =head3 setup
 
-    My::App->setup();
+    My::App->setup($data_source, $user, $password, \%attr);
 
 
-    Initialise the maypole application and model classes. Your
-    application should
-    call this after setting configuration via L<"config">
+Initialise the maypole application and model classes. Your application should
+call this after setting configuration via L<"config">
 
 =head3 init
 
 
 =head3 init
 
@@ -241,9 +235,8 @@ Get/set the Maypole::View object
 
     sub My::App::debug {1}
 
 
     sub My::App::debug {1}
 
-    Returns the debugging flag. Override this in your application class
-    to
-    enable/disable debugging.
+Returns the debugging flag. Override this in your application class to
+enable/disable debugging.
 
 =head2 INSTANCE METHODS
 
 
 =head2 INSTANCE METHODS
 
@@ -311,6 +304,13 @@ You should only need to define this method if you are writing a new
 Maypole
 backend. Otherwise, see L<Maypole::Config/"template_root">
 
 Maypole
 backend. Otherwise, see L<Maypole::Config/"template_root">
 
+=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.
 =head3 is_applicable
 
 Returns a Maypole::Constant to indicate whether the request is valid.
@@ -355,7 +355,7 @@ C<objects> list. See L<Maypole::Model> for more information.
 
     $r->template_args->{foo} = 'bar';
 
 
     $r->template_args->{foo} = 'bar';
 
-    Get/set a hash of template variables.
+Get/set a hash of template variables.
 
 =head3 template
 
 
 =head3 template
 
@@ -395,6 +395,33 @@ Get/set the output content type. Default: text/html
 
 Sends the output and additional headers to the user.
 
 
 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
 =head1 SEE ALSO
 
 There's more documentation, examples, and a wiki at the Maypole web
@@ -404,17 +431,17 @@ http://maypole.perl.org/
 
 L<Maypole::Application>,L<Apache::MVC>, L<CGI::Maypole>.
 
 
 L<Maypole::Application>,L<Apache::MVC>, L<CGI::Maypole>.
 
-=head1 MAINTAINER
+=head1 AUTHOR
 
 Sebastian Riedel, c<sri@oook.de>
 
 
 Sebastian Riedel, c<sri@oook.de>
 
-=head1 AUTHOR
+=head1 AUTHOR EMERITUS
 
 Simon Cozens, C<simon@cpan.org>
 
 
 Simon Cozens, C<simon@cpan.org>
 
-=head1 THANK YOU
+=head1 THANKS TO
 
 
-Danijel Milicevic, Jesse Scheidlower, Jody Belka, Marcus Ramberg,
+Danijel Milicevic, Dave Slack, Jesse Sheidlower, Jody Belka, Marcus Ramberg,
 Mickael Joanne, Simon Flack, Veljko Vidovic and all the others who've
 helped.
 
 Mickael Joanne, Simon Flack, Veljko Vidovic and all the others who've
 helped.