Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the HTML-FormHandler CPAN distribution.

Report information
The Basics
Id: 56303
Status: resolved
Worked: 15 min
Priority: 0/
Queue: HTML-FormHandler

People
Owner: gshank [...] cpan.org
Requestors: clayton [...] physics.umn.edu
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Using an array for field_name_space does not work as intended
Date: Mon, 05 Apr 2010 13:52:11 -0500
To: bug-HTML-FormHandler [...] rt.cpan.org
From: Andy Clayton <clayton [...] physics.umn.edu>
Hello, It appears that field_name_space should be able to take an array (which would be helpful), but since load_class throws an exception when it can't find the class only the first one is ever tried. Please see the attached patch. Thank you, Andy
Index: BuildFields.pm =================================================================== --- BuildFields.pm (revision 1431) +++ BuildFields.pm (revision 1432) @@ -201,10 +201,11 @@ my $loaded; foreach my $ns (@{$self->field_name_space}) { $class = $ns . "::" . $type; - if( Class::MOP::load_class($class) ) { + try { + Class::MOP::load_class($class); $loaded++; last; - } + } catch { } } die "Could not load field class '$type' for field '$name'" unless $loaded;
Subject: Re: [rt.cpan.org #56303] Using an array for field_name_space does not work as intended
Date: Mon, 05 Apr 2010 14:52:07 -0500
To: bug-HTML-FormHandler [...] rt.cpan.org
From: Andy Clayton <clayton [...] physics.umn.edu>
Oops. That original patch wasn't quite right. This should be better.
Index: BuildFields.pm =================================================================== --- BuildFields.pm (revision 1403) +++ BuildFields.pm (revision 1437) @@ -199,12 +199,14 @@ # type prefixed with '+', not a built-in if( ref $self->field_name_space eq 'ARRAY' ) { my $loaded; + my @errors; foreach my $ns (@{$self->field_name_space}) { $class = $ns . "::" . $type; - if( Class::MOP::load_class($class) ) { + try { + Class::MOP::load_class($class); $loaded++; - last; - } + }; + last if $loaded; } die "Could not load field class '$type' for field '$name'" unless $loaded;
Thanks for the bug report. Fix has been pushed to the repository and will be in the next release.