From: Simon Cozens Date: Mon, 6 Dec 2004 01:20:13 +0000 (+0000) Subject: minor tweaks X-Git-Tag: 2.10~67 X-Git-Url: https://git.decadent.org.uk/gitweb/?p=maypole.git;a=commitdiff_plain;h=9b8f3c269605db27908000957b20cc3a336f9148 minor tweaks adding $VERSION remove empty params from search() in M::M::CDBI git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@297 48953598-375a-da11-a14b-00016c27c3ee --- diff --git a/lib/CGI/Maypole.pm b/lib/CGI/Maypole.pm index 39514f9..863bc10 100644 --- a/lib/CGI/Maypole.pm +++ b/lib/CGI/Maypole.pm @@ -3,6 +3,7 @@ use base 'Maypole'; use strict; use warnings; +use CGI::Simple; our $VERSION = '2.05'; @@ -12,7 +13,6 @@ sub run { } sub get_request { - require CGI::Simple; shift->{cgi} = CGI::Simple->new(); } diff --git a/lib/Maypole.pm b/lib/Maypole.pm index bcd0b3a..e16dd82 100644 --- a/lib/Maypole.pm +++ b/lib/Maypole.pm @@ -23,6 +23,7 @@ sub setup { $calling_class = ref $calling_class if ref $calling_class; { no strict 'refs'; + no warnings 'redefine'; # Naughty. *{ $calling_class . "::handler" } = @@ -72,6 +73,7 @@ sub handler { sub handler_guts { my $r = shift; $r->model_class( $r->config->model->class_of( $r, $r->{table} ) ); + my $applicable = $r->is_applicable; unless ( $applicable == OK ) { diff --git a/lib/Maypole/Config.pm b/lib/Maypole/Config.pm index 65263ff..6a236c8 100644 --- a/lib/Maypole/Config.pm +++ b/lib/Maypole/Config.pm @@ -5,6 +5,8 @@ use attributes (); use strict; use warnings; +our $VERSION = "1." . sprintf "%04d", q$Rev$ =~ /: (\d+)/; + # Public accessors. __PACKAGE__->mk_accessors( qw( view uri_base template_root model loader display_tables ok_tables diff --git a/lib/Maypole/Model/CDBI.pm b/lib/Maypole/Model/CDBI.pm index 14f2f0b..031d985 100644 --- a/lib/Maypole/Model/CDBI.pm +++ b/lib/Maypole/Model/CDBI.pm @@ -158,7 +158,7 @@ sub search : Exported { my $oper = "like"; # For now my %params = %{ $r->{params} }; my %values = map { $_ => { $oper, $params{$_} } } - grep { defined $params{$_} and $fields{$_} } keys %params; + grep { length ($params{$_}) and $fields{$_} } keys %params; $r->template("list"); if ( !%values ) { return $self->list($r) } @@ -206,7 +206,7 @@ sub list : Exported { } sub setup_database { - my ( $self, $config, $namespace, $dsn, $u, $p, $opts ) = @_; + my ( $class, $config, $namespace, $dsn, $u, $p, $opts ) = @_; $dsn ||= $config->dsn; $u ||= $config->user; $p ||= $config->pass;