[Jifty-commit] r2151 - in jifty/trunk: lib/Jifty/Web/Form lib/Jifty/Web/Form/Field

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Tue Nov 14 19:47:05 EST 2006


Author: schwern
Date: Tue Nov 14 19:47:04 2006
New Revision: 2151

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/Web/Form/Clickable.pm
   jifty/trunk/lib/Jifty/Web/Form/Element.pm
   jifty/trunk/lib/Jifty/Web/Form/Field/Button.pm
   jifty/trunk/lib/Jifty/Web/Form/Field/Checkbox.pm
   jifty/trunk/lib/Jifty/Web/Form/Field/Textarea.pm
   jifty/trunk/lib/Jifty/Web/Form/Link.pm

Log:
 r25969 at windhund:  schwern | 2006-11-14 16:46:42 -0800
 Eliminate duplication in accessor declaration.


Modified: jifty/trunk/lib/Jifty/Web/Form/Clickable.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/Form/Clickable.pm	(original)
+++ jifty/trunk/lib/Jifty/Web/Form/Clickable.pm	Tue Nov 14 19:47:04 2006
@@ -23,13 +23,15 @@
 
 =cut
 
+use constant ACCESSORS => qw(url escape_label tooltip continuation call
+                             returns submit target preserve_state
+                             render_as_button render_as_link);
 sub accessors {
     shift->SUPER::accessors,
-        qw(url escape_label tooltip continuation call returns submit target preserve_state render_as_button render_as_link);
+    ACCESSORS
 }
-__PACKAGE__->mk_accessors(
-    qw(url escape_label tooltip continuation call returns submit target preserve_state render_as_button render_as_link)
-);
+__PACKAGE__->mk_accessors( ACCESSORS );
+
 
 =head2 new PARAMHASH
 

Modified: jifty/trunk/lib/Jifty/Web/Form/Element.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/Form/Element.pm	(original)
+++ jifty/trunk/lib/Jifty/Web/Form/Element.pm	Tue Nov 14 19:47:04 2006
@@ -134,7 +134,7 @@
 
 =cut
 
-sub handlers { qw(onclick); }
+use constant handlers => qw(onclick);
 
 =head2 accessors
 
@@ -144,8 +144,8 @@
 
 =cut
 
-sub accessors { shift->handlers, qw(class key_binding id label tooltip) }
-__PACKAGE__->mk_accessors(qw(onclick class key_binding id label tooltip));
+use constant accessors => (__PACKAGE__->handlers, qw(class key_binding id label tooltip));
+__PACKAGE__->mk_accessors(__PACKAGE__->accessors);
 
 =head2 new PARAMHASH OVERRIDE
 

Modified: jifty/trunk/lib/Jifty/Web/Form/Field/Button.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/Form/Field/Button.pm	(original)
+++ jifty/trunk/lib/Jifty/Web/Form/Field/Button.pm	Tue Nov 14 19:47:04 2006
@@ -4,7 +4,6 @@
 package Jifty::Web::Form::Field::Button;
 
 use base qw/Jifty::Web::Form::Field/;
-__PACKAGE__->mk_accessors(qw/button_as_link/);
 
 =head2 accessors
 
@@ -14,7 +13,9 @@
 
 =cut
 
-sub accessors { shift->SUPER::accessors(), 'button_as_link' }
+use constant ACCESSORS => qw(button_as_link);
+sub accessors { shift->SUPER::accessors(), ACCESSORS }
+__PACKAGE__->mk_accessors(ACCESSORS);
 
 =head2 render_widget
 

Modified: jifty/trunk/lib/Jifty/Web/Form/Field/Checkbox.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/Form/Field/Checkbox.pm	(original)
+++ jifty/trunk/lib/Jifty/Web/Form/Field/Checkbox.pm	Tue Nov 14 19:47:04 2006
@@ -4,7 +4,6 @@
 package Jifty::Web::Form::Field::Checkbox;
 
 use base qw/Jifty::Web::Form::Field/;
-__PACKAGE__->mk_accessors(qw/checked value/);
 
 =head2 accessors
 
@@ -14,7 +13,9 @@
 
 =cut
 
-sub accessors { shift->SUPER::accessors(), 'checked' , 'value' }
+use constant ACCESSORS => qw(checked value);
+sub accessors { shift->SUPER::accessors(), ACCESSORS }
+__PACKAGE__->mk_accessors(ACCESSORS);
 
 =head2 render_widget
 

Modified: jifty/trunk/lib/Jifty/Web/Form/Field/Textarea.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/Form/Field/Textarea.pm	(original)
+++ jifty/trunk/lib/Jifty/Web/Form/Field/Textarea.pm	Tue Nov 14 19:47:04 2006
@@ -5,7 +5,6 @@
 
 use base qw/Jifty::Web::Form::Field/;
 
-__PACKAGE__->mk_accessors(qw(rows cols));
 
 =head2 accessors
 
@@ -14,7 +13,9 @@
 
 =cut
 
-sub accessors { shift->SUPER::accessors(), 'rows', 'cols' }
+use constant ACCESSORS => qw(rows cols);
+sub accessors { shift->SUPER::accessors(), ACCESSORS }
+__PACKAGE__->mk_accessors(ACCESSORS);
 
 =head2 render_widget
 

Modified: jifty/trunk/lib/Jifty/Web/Form/Link.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Web/Form/Link.pm	(original)
+++ jifty/trunk/lib/Jifty/Web/Form/Link.pm	Tue Nov 14 19:47:04 2006
@@ -31,8 +31,9 @@
 
 =cut
 
-sub accessors { shift->SUPER::accessors(), qw(url escape_label tooltip target); }
-__PACKAGE__->mk_accessors(qw(url escape_label tooltip target));
+use constant ACCESSORS => qw(url escape_label tooltip target);
+sub accessors { shift->SUPER::accessors(), ACCESSORS }
+__PACKAGE__->mk_accessors(ACCESSORS);
 
 =head2 new PARAMHASH
 


More information about the Jifty-commit mailing list