X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=lib%2FMaypole.pm;h=dd9ff770a1827ca393dd4361509222461135f1b7;hb=193575767582376e4a70c5d4af176dab84b2b0ee;hp=d0ba118a5863609d80187bf08c3e521653d65c84;hpb=ff62bc5d741a81146439183b3e3555fc0d5d6847;p=maypole.git diff --git a/lib/Maypole.pm b/lib/Maypole.pm index d0ba118..dd9ff77 100644 --- a/lib/Maypole.pm +++ b/lib/Maypole.pm @@ -1,15 +1,15 @@ package Maypole; -use base qw(Class::Accessor::FAST Class::Data::Inheritable); +use base qw(Class::Accessor::Fast Class::Data::Inheritable); use attributes (); use UNIVERSAL::require; use strict; use warnings; use Maypole::Config; -our $VERSION = "1.8"; +our $VERSION = '2.0'; __PACKAGE__->mk_classdata($_) for qw( config init_done view_object ); __PACKAGE__->mk_accessors( - qw( ar params query objects model_class - args action template ) + qw( ar params query objects model_class template_args output path + args action template error document_encoding content_type table) ); __PACKAGE__->config( Maypole::Config->new() ); __PACKAGE__->init_done(0); @@ -45,8 +45,9 @@ sub init { my $config = $class->config; $config->view || $config->view("Maypole::View::TT"); $config->view->require; - die "Couldn't load the view class ".$config->view.": $@" if $@; - $config->display_tables || $config->display_tables([ $class->config->tables ]); + die "Couldn't load the view class " . $config->view . ": $@" if $@; + $config->display_tables + || $config->display_tables( [ $class->config->tables ] ); $class->view_object( $class->config->view->new ); $class->init_done(1); @@ -66,6 +67,7 @@ sub handler { return $status; } +# The root of all evil sub handler_guts { my $r = shift; $r->model_class( $r->config->model->class_of( $r, $r->{table} ) ); @@ -111,7 +113,7 @@ sub handler_guts { if ( my $error = $@ ) { $status = $r->call_exception($error); if ( $status != OK ) { - warn "caught view error: $error"; + warn "caught view error: $error" if $r->debug; return $r->debug ? $r->view_object->error( $r, $error ) : ERROR; } } @@ -123,8 +125,8 @@ sub handler_guts { sub is_applicable { my $self = shift; my $config = $self->config; - $config->ok_tables || $config->ok_tables($config->display_tables); - $config->ok_tables ({ map { $_ => 1 } @{ $config->ok_tables } }) + $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})" if $self->debug @@ -342,8 +344,8 @@ Simon Cozens, C =head1 THANK YOU -Jesse Scheidlower, Jody Belka, Marcus Ramberg, Mickael Joanne, Simon Flack, -Veljko Vidovic and all the others who've helped. +Danijel Milicevic, Jesse Scheidlower, Jody Belka, Marcus Ramberg, +Mickael Joanne, Simon Flack, Veljko Vidovic and all the others who've helped. =head1 LICENSE