[Catalyst-commits] r7612 - trunk/Catalyst-Plugin-FillInForm
marcus at dev.catalyst.perl.org
marcus at dev.catalyst.perl.org
Fri Apr 11 20:47:41 BST 2008
Author: marcus
Date: 2008-04-11 20:47:41 +0100 (Fri, 11 Apr 2008)
New Revision: 7612
Modified:
trunk/Catalyst-Plugin-FillInForm/FillInForm.pm
Log:
Updated tests and docs for fillinform
Modified: trunk/Catalyst-Plugin-FillInForm/FillInForm.pm
===================================================================
--- trunk/Catalyst-Plugin-FillInForm/FillInForm.pm 2008-04-10 22:00:00 UTC (rev 7611)
+++ trunk/Catalyst-Plugin-FillInForm/FillInForm.pm 2008-04-11 19:47:41 UTC (rev 7612)
@@ -4,7 +4,7 @@
use NEXT;
use HTML::FillInForm;
-our $VERSION = '0.07';
+our $VERSION = '0.06';
=head1 NAME
@@ -20,7 +20,7 @@
# in MyApp.pm; assume $c->stash->data is seeded elsewhere
sub end : Private {
my ( $self, $c ) = @_;
- $c->forward('MyApp::V::TT') unless $c->res->body;
+ $c->forward('MyApp::V::TT') unless $c->res->output;
$c->fillform( $c->stash->data );
# ....
@@ -89,20 +89,48 @@
after your C<forward> call to your view class, which might be
in a built-in C<end> action in your application class.
+You can also hand in a hashref of additional params for
+HTML::FillInForm->fill() if you like. Explicitly providing a
+\%data_hash is mandatory for this use case.
+
+ $c->fillform( $c->req->parameters, {
+ ignore_fields => [ 'pagesrc', 'pagedst' ],
+ fill_password => 0,
+ } );
+
=cut
sub fillform {
my $c = shift;
my $fdat = shift || $c->request->parameters;
+ my $additional_params = shift;
- $c->response->body(
+ $c->response->output(
HTML::FillInForm->new->fill(
scalarref => \$c->response->{body},
- fdat => $fdat
+ fdat => $fdat,
+ %$additional_params,
)
);
}
+=head1 NOTES
+
+This class does not play well with Catalyst's ActionClass('RenderView')
+so you may want to check your C<end> method (in MyApp.pm or perhaps
+Controller/Root.pm). If it looks like this:
+
+ sub end : ActionClass('RenderView') {}
+
+Then you'll need to change it to something like this:
+
+ sub end : Private {
+ my ($self, $c) = @_;
+ $c->forward('render');
+ $c->fillform($c->req->params);
+ }
+ sub render : ActionClass('RenderView') { }
+
=head1 SEE ALSO
L<Catalyst>, L<Catalyst::Plugin::FormValidator>, L<HTML::FillInForm>.
@@ -112,6 +140,7 @@
Sebastian Riedel, C<sri at cpan.org>
Marcus Ramberg, C<mramberg at cpan.org>
Jesse Sheidlower, C<jester at panix.com>
+Jay Hannah, C<jay at jays.net>
=head1 COPYRIGHT
More information about the Catalyst-commits
mailing list