[Catalyst-commits] r7886 - in
CatalystX-CRUD/CatalystX-CRUD-Controller-RHTMLO/trunk: .
lib/CatalystX/CRUD/Controller
karpet at dev.catalyst.perl.org
karpet at dev.catalyst.perl.org
Tue Jun 3 21:47:36 BST 2008
Author: karpet
Date: 2008-06-03 21:47:36 +0100 (Tue, 03 Jun 2008)
New Revision: 7886
Modified:
CatalystX-CRUD/CatalystX-CRUD-Controller-RHTMLO/trunk/Changes
CatalystX-CRUD/CatalystX-CRUD-Controller-RHTMLO/trunk/lib/CatalystX/CRUD/Controller/RHTMLO.pm
Log:
cache field_names to avoid needing $c every time form is called
Modified: CatalystX-CRUD/CatalystX-CRUD-Controller-RHTMLO/trunk/Changes
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD-Controller-RHTMLO/trunk/Changes 2008-06-02 22:05:58 UTC (rev 7885)
+++ CatalystX-CRUD/CatalystX-CRUD-Controller-RHTMLO/trunk/Changes 2008-06-03 20:47:36 UTC (rev 7886)
@@ -44,7 +44,9 @@
* use Class::C3
* prime object as well as form in create()
-0.12 30 May 2008
+0.12 xxx
* pass $c in to form->new() as value to 'app' param, as well as setting in in app() method.
this is so that $c is available to build_form() et al.
+ * cache field_names() to avoid needing $c every time form() is called.
+
Modified: CatalystX-CRUD/CatalystX-CRUD-Controller-RHTMLO/trunk/lib/CatalystX/CRUD/Controller/RHTMLO.pm
===================================================================
--- CatalystX-CRUD/CatalystX-CRUD-Controller-RHTMLO/trunk/lib/CatalystX/CRUD/Controller/RHTMLO.pm 2008-06-02 22:05:58 UTC (rev 7885)
+++ CatalystX-CRUD/CatalystX-CRUD-Controller-RHTMLO/trunk/lib/CatalystX/CRUD/Controller/RHTMLO.pm 2008-06-03 20:47:36 UTC (rev 7886)
@@ -70,8 +70,9 @@
sub form {
my ( $self, $c ) = @_;
$self->{_form} ||= $self->form_class->new( app => $c );
+ $self->{_field_names} ||= $self->{_form}->field_names;
$self->{_form}->app($c) unless defined $self->{_form}->app;
- $self->{_form}->clear unless $self->{_form}->app->stash->{_form_called}++;
+ $self->{_form}->clear unless $self->{_form}->app->stash->{_form_called}->{ $self->action_namespace }++;
return $self->{_form};
}
@@ -83,7 +84,7 @@
sub field_names {
my ($self) = @_;
- return $self->form->field_names;
+ return $self->{_field_names};
}
=head2 all_form_errors
More information about the Catalyst-commits
mailing list