Hello community,
here is the log from the commit of package perl-CGI-Application for openSUSE:Factory
checked in at Fri Jul 31 22:45:15 CEST 2009.
--------
--- perl-CGI-Application/perl-CGI-Application.changes 2008-11-04 11:55:00.000000000 +0100
+++ /mounts/work_src_done/STABLE/perl-CGI-Application/perl-CGI-Application.changes 2009-07-30 18:04:41.000000000 +0200
@@ -1,0 +2,26 @@
+Thu Jul 30 17:01:25 CEST 2009 - cwh@suse.de
+
+- 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
+
+ [FEATURES]
+ - This now works:
+ $webapp->query($new_query_object);
+ Setting a new query object can be useful in combination with
+ CGI::Application::Server. (Jaldhar Vyas)
+
+ [DOCUMENTATION]
+ - More typo fixes (Lyle)
+
+-------------------------------------------------------------------
calling whatdependson for head-i586
Old:
----
CGI-Application-4.20.tar.bz2
New:
----
CGI-Application-4.31.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-CGI-Application.spec ++++++
--- /var/tmp/diff_new_pack.f1GC5o/_old 2009-07-31 22:44:00.000000000 +0200
+++ /var/tmp/diff_new_pack.f1GC5o/_new 2009-07-31 22:44:00.000000000 +0200
@@ -1,7 +1,7 @@
#
-# spec file for package perl-CGI-Application (Version 4.20)
+# spec file for package perl-CGI-Application (Version 4.31)
#
-# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -19,13 +19,13 @@
Name: perl-CGI-Application
-Version: 4.20
+Version: 4.31
Release: 1
Provides: CGI-Application
Requires: perl = %{perl_version}
AutoReqProv: on
Group: Development/Libraries/Perl
-License: Artistic License
+License: Artistic License ..
Url: http://search.cpan.org/~jerlbaum/CGI-Application
Summary: Framework for building reusable web-applications
Source: CGI-Application-%{version}.tar.bz2
++++++ CGI-Application-4.20.tar.bz2 -> CGI-Application-4.31.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CGI-Application-4.20/Changes new/CGI-Application-4.31/Changes
--- old/CGI-Application-4.20/Changes 2008-11-02 01:41:27.000000000 +0100
+++ new/CGI-Application-4.31/Changes 2009-07-30 03:41:00.000000000 +0200
@@ -1,5 +1,28 @@
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
+
+ [FEATURES]
+ - This now works:
+ $webapp->query($new_query_object);
+ Setting a new query object can be useful in combination with
+ CGI::Application::Server. (Jaldhar Vyas)
+
+ [DOCUMENTATION]
+ - More typo fixes (Lyle)
+
4.20 Sat Nov 1, 2008
[DOCUMENTATION]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CGI-Application-4.20/MANIFEST new/CGI-Application-4.31/MANIFEST
--- old/CGI-Application-4.20/MANIFEST 2008-11-02 01:40:57.000000000 +0100
+++ new/CGI-Application-4.31/MANIFEST 2009-07-30 03:41:00.000000000 +0200
@@ -27,6 +27,7 @@
t/mode_param_path_info.t
t/mode_param_overwritten.t
t/load_tmpl_hook.t
+t/query.t
t/lib/TestApp.pm
t/lib/TestApp2.pm
t/lib/TestApp3.pm
@@ -39,5 +40,7 @@
t/lib/TestApp10.pm
t/lib/TestApp11.pm
t/lib/TestApp12.pm
+t/lib/TestApp13.pm
+t/lib/TestApp14.pm
t/lib/TestCGI.pm
t/lib/templates/test.tmpl
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CGI-Application-4.20/META.yml new/CGI-Application-4.31/META.yml
--- old/CGI-Application-4.20/META.yml 2008-08-10 17:34:30.000000000 +0200
+++ new/CGI-Application-4.31/META.yml 2009-07-30 03:41:00.000000000 +0200
@@ -1,10 +1,10 @@
---- #YAML:1.0
+---
name: CGI-Application
-version: 4.11
+version: 4.31
author:
- - Jesse Erlbaum
- - Mark Stosberg
- - with the help of many others!
+ - 'Jesse Erlbaum '
+ - 'Mark Stosberg '
+ - "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.11
+ version: 4.31
CGI::Application::Mailform:
file: lib/CGI/Application/Mailform.pm
-generated_by: Module::Build version 0.2611
+resources:
+ license: ~
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CGI-Application-4.20/Makefile.PL new/CGI-Application-4.31/Makefile.PL
--- old/CGI-Application-4.20/Makefile.PL 2008-08-10 17:34:30.000000000 +0200
+++ new/CGI-Application-4.31/Makefile.PL 2009-07-30 03:41:00.000000000 +0200
@@ -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
+ }
)
;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CGI-Application-4.20/lib/CGI/Application.pm new/CGI-Application-4.31/lib/CGI/Application.pm
--- old/CGI-Application-4.20/lib/CGI/Application.pm 2008-11-02 01:38:26.000000000 +0100
+++ new/CGI-Application-4.31/lib/CGI/Application.pm 2009-07-30 03:41:00.000000000 +0200
@@ -3,7 +3,7 @@
use strict;
use Class::ISA;
-$CGI::Application::VERSION = '4.20';
+$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)) {
@@ -464,18 +465,14 @@
my $self = shift;
my ($query) = @_;
- # We're only allowed to set a new query object if one does not yet exist!
- unless (exists($self->{__QUERY_OBJ})) {
- my $new_query_obj;
-
- # If data is provided, set it! Otherwise, create a new one.
- if (defined($query)) {
- $new_query_obj = $query;
- } else {
- $new_query_obj = $self->cgiapp_get_query();
+ # If data is provided, set it! Otherwise, create a new one.
+ if (defined($query)) {
+ $self->{__QUERY_OBJ} = $query;
+ } else {
+ # We're only allowed to create a new query object if one does not yet exist!
+ unless (exists($self->{__QUERY_OBJ})) {
+ $self->{__QUERY_OBJ} = $self->cgiapp_get_query();
}
-
- $self->{__QUERY_OBJ} = $new_query_obj;
}
return $self->{__QUERY_OBJ};
@@ -1037,7 +1034,7 @@
all the arguments which were sent to the new() method.
An example of the benefits provided by utilizing this hook is
-creating a custom "application super-class" from which which all
+creating a custom "application super-class" from which all
your web applications would inherit, instead of CGI::Application.
Consider the following:
@@ -1165,13 +1162,13 @@
Override this method to retrieve the query object if you wish to use a
different query interface instead of CGI.pm.
-CGI.pm is only loaded to provided query object is only loaded if it used on a given request.
+CGI.pm is only loaded if it is used on a given request.
If you can use an alternative to CGI.pm, it needs to have some compatibility
with the CGI.pm API. For normal use, just having a compatible C<param> method
should be sufficient.
-If use the C option to the mode_param() method, then we will call
+If you use the C option to the mode_param() method, then we will call
the C method on the query object.
If you use the C<Dump> method in CGI::Application, we will call the C<Dump> and
@@ -1225,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
);
@@ -1246,9 +1243,12 @@
B
-You may specify an API-compatible alternative to HTML::Template by overriding
-C. 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 LHTML::Template by setting
+a new C:
+
+ $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
@@ -1256,9 +1256,23 @@
$t = $class->new( filename => ... );
$t->param(...);
-Example implementation:
+Here's an example case allowing you to precisely test what's sent to your
+templates:
- sub html_tmpl_class { 'HTML::Template::Pro' }
+ $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
@@ -1345,6 +1359,12 @@
method supports passing in your existing query object on construction using
the QUERY attribute.
+There are a few rare situations where you want your own query object to be
+used after your Application Module has already been constructed. In that case
+you can pass it to c like this:
+
+ $webapp->query($new_query_object);
+ my $q = $webapp->query(); # now uses $new_query_object
=head3 run_modes()
@@ -1638,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;
@@ -1938,7 +1970,7 @@
=item *
-LCGI::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.
+LCGI::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 *
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CGI-Application-4.20/t/lib/TestApp13.pm new/CGI-Application-4.31/t/lib/TestApp13.pm
--- old/CGI-Application-4.20/t/lib/TestApp13.pm 1970-01-01 01:00:00.000000000 +0100
+++ new/CGI-Application-4.31/t/lib/TestApp13.pm 2009-07-30 03:41:00.000000000 +0200
@@ -0,0 +1,53 @@
+package TestApp13;
+use strict;
+use CGI::Application;
+@TestApp13::ISA = qw(CGI::Application);
+
+# Prevent output to STDOUT
+$ENV{CGI_APP_RETURN_ONLY} = 1;
+
+sub setup {
+ my $self = shift;
+ $self->run_modes( [ qw( mode1 mode2 ) ] );
+ $self->start_mode( 'mode1' );
+ $self->error_mode( 'error' );
+}
+
+
+sub mode1 {
+ my $self = shift;
+ my $file;
+ open ( $file, "t/lib/templates/test.tmpl" )
+ || die "Cannot open testing template";
+ my $template = $self->load_tmpl( $file, 'die_on_bad_params' => 0 );
+ $template->param( 'ping' => "HELLO!" );
+ my $output = $template->output;
+ close ( $file );
+ $output;
+}
+
+sub mode2 {
+ my $self = shift;
+ my $template_string = <<_EOF_;
+<html>
+<head>
+<title>Simple Test</title>
+</head>
+<body>
+What's this: <!-- TMPL_VAR NAME="ping" -->
+</body>
+</html>
+_EOF_
+
+ my $template = $self->load_tmpl( \$template_string, 'die_on_bad_params' => 0 );
+ $template->param( 'ping' => 'HELLO!' );
+ $template->output;
+}
+
+sub error {
+ my $self = shift;
+ return "ERROR";
+}
+
+1;
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CGI-Application-4.20/t/lib/TestApp14.pm new/CGI-Application-4.31/t/lib/TestApp14.pm
--- old/CGI-Application-4.20/t/lib/TestApp14.pm 1970-01-01 01:00:00.000000000 +0100
+++ new/CGI-Application-4.31/t/lib/TestApp14.pm 2009-07-30 03:41:00.000000000 +0200
@@ -0,0 +1,21 @@
+package TestApp14;
+use base 'CGI::Application';
+use warnings;
+use strict;
+
+sub setup {
+ my $self = shift;
+ $self->run_modes([qw/ start /]);
+ $self->tmpl_path('t/lib/templates');
+}
+
+sub start {
+ my $self = shift;
+
+ my $t = $self->load_tmpl('test.tmpl');
+ $t->param(ping => $self->query->param('message'));
+
+ return $t->output();
+}
+
+1;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/CGI-Application-4.20/t/query.t new/CGI-Application-4.31/t/query.t
--- old/CGI-Application-4.20/t/query.t 1970-01-01 01:00:00.000000000 +0100
+++ new/CGI-Application-4.31/t/query.t 2009-07-30 03:41:00.000000000 +0200
@@ -0,0 +1,27 @@
+# test the query() method
+
+use Test::More 'no_plan';
+use CGI;
+
+# Include the test hierarchy
+use lib 't/lib';
+
+use TestApp14;
+
+# Prevent output to STDOUT
+$ENV{CGI_APP_RETURN_ONLY} = 1;
+
+# Test query()
+{
+ my $cgi = CGI->new('message=hello');
+ my $ta_obj = TestApp14->new(QUERY => $cgi);
+ my $output = $ta_obj->run();
+
+ like($output, qr/---->hello<----/);
+
+ my $cgi2 = CGI->new('message=goodbye');
+ $ta_obj->query($cgi2);
+ $output = $ta_obj->run();
+
+ like($output, qr/---->goodbye<----/);
+}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org