Permalink
Browse files

Cleanup verbose

  • Loading branch information...
1 parent e6e15b9 commit eb26e3199419402b69fc0d11d9f570aef04e77ec @gshank gshank committed Feb 4, 2009
Showing with 37 additions and 28 deletions.
  1. +6 −0 Changes
  2. +0 −1 META.yml
  3. +0 −2 Makefile.PL
  4. +21 −15 lib/HTML/FormHandler.pm
  5. +9 −9 lib/HTML/FormHandler/Field.pm
  6. +1 −1 t/lib/BookDB/Controller/Book.pm
View
@@ -1,5 +1,11 @@
Revision history for HTML::FormHandler
+0.12 Wed Feb 04 2009, 18:00
+ Fix 'dump_fields'. Add more output for verbose. Change so
+ that 'validate' doesn't require a separate 'clear' for
+ persistent forms. The controller test will only execute
+ with an environment variable.
+
0.11 Mon Feb 02 2009, 17:00
Change to use BEGIN block in controllers for Catalyst 5.80.
View
@@ -4,7 +4,6 @@ author:
- 'Gerda Shank, gshank@cpan.org'
build_requires:
Test::More: 0.77
- Test::WWW::Mechanize: 1.24
distribution_type: module
generated_by: 'Module::Install version 0.77'
license: perl
View
@@ -16,8 +16,6 @@ requires 'DateTime';
requires 'DBIx::Class';
requires 'HTML::Entities';
-test_requires 'Test::WWW::Mechanize' => '1.24';
-
recommends 'Catalyst';
recommends 'Catalyst::Component::InstancePerContext';
recommends 'Template';
@@ -57,7 +57,12 @@ to update a 'Book' record:
$c->res->redirect( $c->uri_for('list') );
}
-
+The example above has the forms as a persistent part of the application.
+If you prefer, it also works fine to create the form on each request:
+
+ my $form = MyApp::Form->new;
+ my $validated = $form->process( item => $book, params => $params );
+
An example of a form class:
package MyApp::Form::User;
@@ -349,18 +354,6 @@ has 'field_counter' => (
default => 1
);
-=head2 name_prefix
-
-You don't need this attribute unless you have a compound field.
-Prefix used for field names in compound fields. The collection
-of fields can be a complete form. An example might be a field
-that represents a DateTime object, but is made up of separate
-day, month, and year fields.
-
-=cut
-
-has 'name_prefix' => ( isa => 'Str', is => 'rw' );
-
=head2 html_prefix
Flag to indicate that the form name is used as a prefix for fields
@@ -379,6 +372,19 @@ will return the form name + "." + field name
has 'html_prefix' => ( isa => 'Bool', is => 'rw' );
+=head2 name_prefix
+
+You don't need this attribute unless you have a compound field.
+Prefix is used for field names in compound fields. The collection
+of fields can be a complete form. An example might be a field
+that represents a DateTime object, but is made up of separate
+day, month, and year fields. Adds the 'name_prefix' plus a dot to
+the beginning of the field name.
+
+=cut
+
+has 'name_prefix' => ( isa => 'Str', is => 'rw' );
+
=head2 active_column
The column in tables used for select list that marks an option 'active'
@@ -725,11 +731,12 @@ sub dump_fields
{
my $self = shift;
- warn "HFH: Fields for form ", $self->name, "\n";
+ warn "HFH: ------- fields for form ", $self->name, "-------\n";
for my $field ( $self->sorted_fields )
{
$field->dump;
}
+ warn "HFH: ------- end fields -------\n";
}
=head2 init_from_object
@@ -1113,7 +1120,6 @@ sub build_form
{
my $self = shift;
- warn "HFH: build_form\n" if $self->verbose;
my $meta_flist = $self->meta->field_list if $self->meta->can('field_list');
my $flist = $self->field_list;
$self->_build_fields( $meta_flist, 0 ) if $meta_flist;
@@ -901,23 +901,23 @@ sub dump
my $self = shift;
require Data::Dumper;
- warn "HFH: **** Field: ", $self->name, "\n";
- warn "HFH: Field Type: ", ref($self), "\n";
- warn "HFH: Required: ", ( $self->required || '0' ), "\n";
- warn "HFH: Password: ", ( $self->password || '0' ), "\n";
+ warn "HFH: ----- ", $self->name, " -----\n";
+ warn "HFH: type: ", ref($self), "\n";
+ warn "HFH: required: ", ( $self->required || '0' ), "\n";
+ warn "HFH: password: ", ( $self->password || '0' ), "\n";
my $v = $self->value;
- warn "HFH: Value: ", Data::Dumper::Dumper $v if $v;
+ warn "HFH: value: ", Data::Dumper::Dumper $v if $v;
my $iv = $self->init_value;
- warn "HFH: InitValue: ", Data::Dumper::Dumper $iv if $iv;
+ warn "HFH: init_value: ", Data::Dumper::Dumper $iv if $iv;
my $i = $self->input;
- warn "HFH: Input: ", Data::Dumper::Dumper $i if $i;
+ warn "HFH: input: ", Data::Dumper::Dumper $i if $i;
my $fif = $self->fif;
- warn "HFH: Fif: ", Data::Dumper::Dumper $fif if $fif;
+ warn "HFH: fif: ", Data::Dumper::Dumper $fif if $fif;
if ( $self->can('options') )
{
my $o = $self->options;
- warn "HFH: Options: " . Data::Dumper::Dumper $o;
+ warn "HFH: options: " . Data::Dumper::Dumper $o;
}
}
@@ -9,7 +9,7 @@ use BookDB::Form::Book;
use BookDB::Form::BookView;
has 'edit_form' => ( isa => 'BookDB::Form::Book', is => 'rw',
- lazy => 1, default => sub { BookDB::Form::Book->new } );
+ lazy => 1, default => sub { BookDB::Form::Book->new( verbose => 1 ) } );
has 'view_form' => ( isa => 'BookDB::Form::BookView', is => 'rw',
lazy => 1, default => sub { BookDB::Form::BookView->new } );

0 comments on commit eb26e31

Please sign in to comment.