From: Sebastian Riedel Date: Thu, 28 Oct 2004 18:39:36 +0000 (+0000) Subject: some fixes for Maypole::Config, Maypole::Model::Base and X-Git-Tag: 2.10~85 X-Git-Url: https://git.decadent.org.uk/gitweb/?p=maypole.git;a=commitdiff_plain;h=7913f720113bfd85b59a9fed57a60ec7a665fb39 some fixes for Maypole::Config, Maypole::Model::Base and Maypole::Model::CDBI::Plain git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@279 48953598-375a-da11-a14b-00016c27c3ee --- diff --git a/Changes b/Changes index 2c2e663..7dadefc 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,10 @@ Revision history for Perl extension Maypole +2.05 Tue Oct 28 20:00:00 2004 + - Fixed a bug in CGI::Maypole::parse_location() (Dave Howorth) + - Some fixes for Maypole::Config, Maypole::Model::Base and + Maypole::Model::CDBI::Plain (Dave Howorth) + 2.04 Tue Oct 27 14:00:00 2004 - Fixed Apache::MVC version (Randal Schwartz) - fixed template_args (Dave Howorth) diff --git a/lib/Apache/MVC.pm b/lib/Apache/MVC.pm index 13d8a14..0f91e9a 100644 --- a/lib/Apache/MVC.pm +++ b/lib/Apache/MVC.pm @@ -1,6 +1,6 @@ package Apache::MVC; -our $VERSION = '2.04'; +our $VERSION = '2.05'; use strict; use warnings; diff --git a/lib/CGI/Maypole.pm b/lib/CGI/Maypole.pm index 7da043c..345b68e 100644 --- a/lib/CGI/Maypole.pm +++ b/lib/CGI/Maypole.pm @@ -4,7 +4,7 @@ use base 'Maypole'; use strict; use warnings; -our $VERSION = '2.04'; +our $VERSION = '2.05'; sub run { my $self = shift; @@ -22,6 +22,7 @@ sub parse_location { my $loc = $self->{cgi}->url( -absolute => 1 ); no warnings 'uninitialized'; $self->{path} =~ s/^($loc)?\///; + $self->{path} .= '/' if $self->{path} eq $loc; $self->parse_path; $self->parse_args; } diff --git a/lib/Maypole.pm b/lib/Maypole.pm index 6e41ee7..bcd0b3a 100644 --- a/lib/Maypole.pm +++ b/lib/Maypole.pm @@ -6,7 +6,7 @@ use warnings; use Maypole::Config; use Maypole::Constants; -our $VERSION = '2.04'; +our $VERSION = '2.05'; __PACKAGE__->mk_classdata($_) for qw( config init_done view_object ); __PACKAGE__->mk_accessors( diff --git a/lib/Maypole/Config.pm b/lib/Maypole/Config.pm index 9d0c900..65263ff 100644 --- a/lib/Maypole/Config.pm +++ b/lib/Maypole/Config.pm @@ -12,7 +12,7 @@ __PACKAGE__->mk_accessors( ); # Should only be modified by model. -__PACKAGE__->mk_ro_accessors(qw( classes tables table_to_class)); +__PACKAGE__->mk_ro_accessors(qw( classes tables)); 1; @@ -40,10 +40,6 @@ This is the number of rows your application should display per page. Contains a list of all tables, if supported by model. -=head3 table_to_class - -A hash containing a table to class mapping, if supported by model. - =head3 template_root This is where your application can find its templates. @@ -69,8 +65,8 @@ model class, and should not be changed in the view or the config. =head3 display_tables -These are the tables that are public to your Maypole application. -Defaults to all the tables in the database. +This is a list of the tables that are public to your Maypole +application. Defaults to all the tables in the database. =head3 dsn @@ -89,7 +85,8 @@ The name of the model class for your Maypole Application. Defaults to =head3 ok_tables -These are the tables that Maypole should care about +This is a hash of the public tables. It is populated automatically by +Maypole from the list in display_tables and should not be changed. =head3 pass @@ -103,6 +100,16 @@ Other options to the DBI connect call. Username to log into the database with. +=head2 Adding additional configuration data + +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: + + Maypole::Config->mk_accessors(qw(variable or variables)); + +Care is needed to avoid conflicting variable names. + =head1 SEE ALSO L diff --git a/lib/Maypole/Model/CDBI/Plain.pm b/lib/Maypole/Model/CDBI/Plain.pm index 6c2709c..e4f6cfc 100644 --- a/lib/Maypole/Model/CDBI/Plain.pm +++ b/lib/Maypole/Model/CDBI/Plain.pm @@ -1,6 +1,8 @@ package Maypole::Model::CDBI::Plain; use base 'Maypole::Model::CDBI'; +Maypole::Config->mk_accessors(qw(table_to_class)); + sub setup_database { my ( $self, $config, $namespace, $classes ) = @_; $config->{classes} = $classes;