r41070 - in /branches/upstream/libcgi-application-perl/current: Changes META.yml Makefile.PL lib/CGI/Application.pm
ansgar-guest at users.alioth.debian.org
ansgar-guest at users.alioth.debian.org
Fri Jul 31 10:34:29 UTC 2009
Author: ansgar-guest
Date: Fri Jul 31 10:34:23 2009
New Revision: 41070
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=41070
Log:
[svn-upgrade] Integrating new upstream version, libcgi-application-perl (4.31)
Modified:
branches/upstream/libcgi-application-perl/current/Changes
branches/upstream/libcgi-application-perl/current/META.yml
branches/upstream/libcgi-application-perl/current/Makefile.PL
branches/upstream/libcgi-application-perl/current/lib/CGI/Application.pm
Modified: branches/upstream/libcgi-application-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcgi-application-perl/current/Changes?rev=41070&op=diff
==============================================================================
--- branches/upstream/libcgi-application-perl/current/Changes (original)
+++ branches/upstream/libcgi-application-perl/current/Changes Fri Jul 31 10:34:23 2009
@@ -1,4 +1,16 @@
Revision history for CGI::Application.
+
+4.31 Wed Jul 29, 2009
+
+ [FEATURES]
+ - html_tmpl_class() now allows setting an an alternate HTML::Template class
+ at a run time. This makes it easy to set the class to be
+ 'HTML::Template::Dumper' for debugging. You can then see and precisely
+ test the Perl data structure that would be sent your template, taking
+ into account the template tokens that are actually set there. (Mark Stosberg)
+
+ [DOCUMENTATION]
+ - More typo fixes (Lyle)
4.21 Sat Jan 3, 2009
Modified: branches/upstream/libcgi-application-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcgi-application-perl/current/META.yml?rev=41070&op=diff
==============================================================================
--- branches/upstream/libcgi-application-perl/current/META.yml (original)
+++ branches/upstream/libcgi-application-perl/current/META.yml Fri Jul 31 10:34:23 2009
@@ -1,10 +1,10 @@
---- #YAML:1.0
+---
name: CGI-Application
-version: 4.21
+version: 4.31
author:
- - Jesse Erlbaum <jesse at erlbaum.net>
- - Mark Stosberg <mark at summersault.com>
- - with the help of many others!
+ - 'Jesse Erlbaum <jesse at erlbaum.net>'
+ - 'Mark Stosberg <mark at summersault.com>'
+ - "with the help of many others!"
abstract: Framework for building reusable web-applications
license: perl
requires:
@@ -13,10 +13,17 @@
Class::ISA: 0
HTML::Template: 0
Test::More: 0.47
+generated_by: Module::Build version 0.32
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.2.html
+ version: 1.2
+no_index:
+ file:
provides:
CGI::Application:
file: lib/CGI/Application.pm
- version: 4.21
+ version: 4.31
CGI::Application::Mailform:
file: lib/CGI/Application/Mailform.pm
-generated_by: Module::Build version 0.2611
+resources:
+ license: ~
Modified: branches/upstream/libcgi-application-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcgi-application-perl/current/Makefile.PL?rev=41070&op=diff
==============================================================================
--- branches/upstream/libcgi-application-perl/current/Makefile.PL (original)
+++ branches/upstream/libcgi-application-perl/current/Makefile.PL Fri Jul 31 10:34:23 2009
@@ -1,17 +1,17 @@
-# Note: this file was auto-generated by Module::Build::Compat version 0.03
+# Note: this file was auto-generated by Module::Build::Compat version 0.32
use ExtUtils::MakeMaker;
WriteMakefile
(
+ 'INSTALLDIRS' => 'site',
'NAME' => 'CGI::Application',
+ 'EXE_FILES' => [],
'VERSION_FROM' => 'lib/CGI/Application.pm',
'PREREQ_PM' => {
- 'CGI' => '0',
- 'Carp' => '0',
- 'Class::ISA' => '0',
- 'HTML::Template' => '0',
- 'Test::More' => '0.47'
- },
- 'INSTALLDIRS' => 'site',
- 'PL_FILES' => {}
+ 'Test::More' => '0.47',
+ 'HTML::Template' => 0,
+ 'Class::ISA' => 0,
+ 'CGI' => 0,
+ 'Carp' => 0
+ }
)
;
Modified: branches/upstream/libcgi-application-perl/current/lib/CGI/Application.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libcgi-application-perl/current/lib/CGI/Application.pm?rev=41070&op=diff
==============================================================================
--- branches/upstream/libcgi-application-perl/current/lib/CGI/Application.pm (original)
+++ branches/upstream/libcgi-application-perl/current/lib/CGI/Application.pm Fri Jul 31 10:34:23 2009
@@ -3,7 +3,7 @@
use strict;
use Class::ISA;
-$CGI::Application::VERSION = '4.21';
+$CGI::Application::VERSION = '4.31';
my %INSTALLED_CALLBACKS = (
# hook name package sub
@@ -21,6 +21,7 @@
sub new {
my $class = shift;
+
my @args = @_;
if (ref($class)) {
@@ -1221,7 +1222,7 @@
Note that if you want to pass extra arguments but use the default template
name, you still need to provide a name of C<undef>:
- my $tmpl_obj = $webapp->load_tmpl(undef',
+ my $tmpl_obj = $webapp->load_tmpl(undef,
die_on_bad_params => 0,
cache => 1
);
@@ -1242,9 +1243,12 @@
B<specifying the template class with html_tmpl_class()>
-You may specify an API-compatible alternative to HTML::Template by overriding
-C<html_tmpl_class()>. This method should return the class name of your template
-system. The default simply returns "HTML::Template". The alternate class should
+You may specify an API-compatible alternative to L<HTML::Template> by setting
+a new C<html_tmpl_class()>:
+
+ $self->html_tmpl_class('HTML::Template::Dumper');
+
+The default is "HTML::Template". The alternate class should
provide at least the following parts of the HTML::Template API:
$t = $class->new( scalarref => ... ); # If you use scalarref templates
@@ -1252,9 +1256,23 @@
$t = $class->new( filename => ... );
$t->param(...);
-Example implementation:
-
- sub html_tmpl_class { 'HTML::Template::Pro' }
+Here's an example case allowing you to precisely test what's sent to your
+templates:
+
+ $ENV{CGI_APP_RETURN_ONLY} = 1;
+ my $webapp = WebApp->new;
+ $webapp->html_tmpl_class('HTML::Template::Dumper');
+ my $out_str = $webapp->run;
+ my $tmpl_href = eval "$out_str";
+
+ # Now Precisely test what would be set to the template
+ is ($tmpl_href->{pet_name}, 'Daisy', "Daisy is sent template");
+
+This is a powerful technique because HTML::Template::Dumper loads and considers
+the template file that would actually be used. If the 'pet_name' token was missing
+in the template, the above test would fail. So, you are testing both your code
+and your templates in a much more precise way than using simple regular
+expressions to see if the string "Daisy" appeared somewhere on the page.
B<The load_tmpl() callback>
@@ -1640,7 +1658,19 @@
=cut
-sub html_tmpl_class { 'HTML::Template' }
+sub html_tmpl_class {
+ my $self = shift;
+ my $tmpl_class = shift;
+
+ # First use? Create new __ERROR_MODE
+ $self->{__HTML_TMPL_CLASS} = 'HTML::Template' unless (exists($self->{__HTML_TMPL_CLASS}));
+
+ if (defined $tmpl_class) {
+ $self->{__HTML_TMPL_CLASS} = $tmpl_class;
+ }
+
+ return $self->{__HTML_TMPL_CLASS};
+}
sub load_tmpl {
my $self = shift;
@@ -1940,7 +1970,7 @@
=item *
-L<CGI::Application::Plugin::DBH> - Provides easy management of one or more database handles and candelay making the database connection until the moment it is actually used.
+L<CGI::Application::Plugin::DBH> - Provides easy management of one or more database handles and can delay making the database connection until the moment it is actually used.
=item *
More information about the Pkg-perl-cvs-commits
mailing list