X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=lib%2FMaypole.pm;h=9a86489b8127d7cbb0914409d88ca0a415948415;hb=74800a709376d0ce878cabd9db6b3578c002606c;hp=4e551eb45d241151495907c4fa0a8ca1a9c2ea78;hpb=6d2982560f68030ec5153d40e444575745640688;p=maypole.git diff --git a/lib/Maypole.pm b/lib/Maypole.pm index 4e551eb..9a86489 100644 --- a/lib/Maypole.pm +++ b/lib/Maypole.pm @@ -5,7 +5,7 @@ use UNIVERSAL::require; use Apache::Constants ":common"; use strict; use warnings; -our $VERSION = "1.0"; +our $VERSION = "1.1"; __PACKAGE__->mk_classdata($_) for qw( config init_done view_object ); __PACKAGE__->mk_accessors ( qw( ar params query objects model_class args action template )); @@ -62,6 +62,7 @@ sub handler { $r->model_class->process($r); } else { # Otherwise, it's just a plain template. + $r->call_authenticate; # No harm in it delete $r->{model_class}; $r->{path} =~ s{/}{}; # De-absolutify $r->template($r->{path}); @@ -73,18 +74,18 @@ sub is_applicable { my $self = shift; my $config = $self->config; $config->{ok_tables} = {map {$_ => 1} @{$config->{display_tables}}}; - warn "We don't have that table ($self->{table})" - unless $config->{ok_tables}{$self->{table}}; + #warn "We don't have that table ($self->{table})" + # unless $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})" unless $cv; + #warn "We don't have that action ($self->{action})" unless $cv; return DECLINED() unless $cv; # Is it exported? $self->{method_attribs} = join " ", attributes::get($cv); - do { warn "$self->{action} not exported"; + do { # warn "$self->{action} not exported"; return DECLINED() } unless $self->{method_attribs} =~ /\bExported\b/i; return OK(); @@ -133,7 +134,7 @@ for the designers to customize, and then write an Apache handler like this: package ProductDatabase; - use base 'Maypole'; + use base 'Apache::MVC'; __PACKAGE__->set_database("dbi:mysql:products"); ProductDatabase->config->{uri_base} = "http://your.site/catalogue/"; ProductDatabase::Product->has_a("category" => ProductDatabase::Category);