From 427f0f2ec634f60fa90e60f5d3a048b6e1fc5f8b Mon Sep 17 00:00:00 2001 From: Aaron Trevena Date: Mon, 16 Oct 2006 11:22:42 +0000 Subject: [PATCH] DFV model tested and working, new additional method in Maypole::Config, new warn method in Maypole git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@533 48953598-375a-da11-a14b-00016c27c3ee --- Changes | 2 ++ lib/Maypole.pm | 27 ++++++++++++++++++++------- lib/Maypole/Config.pm | 7 ++++++- 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/Changes b/Changes index be240c3..ff41b68 100644 --- a/Changes +++ b/Changes @@ -11,6 +11,8 @@ For information about current developments and future releases, see: new Class::DBI::DFV based model new test to check everything compiles Model inheritance re-organised + New config method : additional, for stashing additional info, especially from additional_data method + new warn method in maypole/request class/object, over-ridden by Apache::MVC, etc or own driver 2.11 Mon 31 July 2006 diff --git a/lib/Maypole.pm b/lib/Maypole.pm index 6656b9b..c970d01 100644 --- a/lib/Maypole.pm +++ b/lib/Maypole.pm @@ -381,13 +381,12 @@ sub new config => $class->config, }, $class; - $self->stash({}); - $self->params({}); - $self->query({}); - $self->template_args({}); - $self->args([]); - $self->objects([]); - + $self->stash({}); + $self->params({}); + $self->query({}); + $self->template_args({}); + $self->args([]); + $self->objects([]); return $self; } @@ -678,6 +677,20 @@ sub __call_process_view { return $status; } +=item warn + +$r->warn('its all gone pete tong'); + +Warn must be implemented by the backend, i.e. Apache::MVC +and warn to stderr or appropriate logfile. + +You can also over-ride this in your Maypole driver, should you +want to use something like Log::Log4perl instead. + +=cut + +sub warn { } + =item get_request You should only need to define this method if you are writing a new diff --git a/lib/Maypole/Config.pm b/lib/Maypole/Config.pm index a2660d7..2cf65da 100644 --- a/lib/Maypole/Config.pm +++ b/lib/Maypole/Config.pm @@ -11,7 +11,7 @@ our $VERSION = "1." . sprintf "%04d", q$Rev$ =~ /: (\d+)/; __PACKAGE__->mk_accessors( qw( view view_options uri_base template_root template_extension model loader display_tables ok_tables rows_per_page dsn user pass opts - application_name) + application_name additional) ); # Should only be modified by model. @@ -117,6 +117,11 @@ Username to log into the database with. =head2 Adding additional configuration data +You can use the 'additional' attribute for stashing additional info, especially from additional_data method, +i.e. $r->config->additional({foo=>bar}); + +Or.. + If your modules need to store additional configuration data for their own use or to make available to templates, add a line like this to your module: -- 2.39.2