[Catalyst] Data::FormValidator

Marcello m.romani at spinsoft.it
Mon Nov 28 11:27:43 CET 2005


Caroline Johnston ha scritto:
>>I build a default input profile in MyApp.pm and import it (more or less)
>>like this:
>>
>>sub some_sub_somewhere {
>>   my ( $self, $c ) = @_;
>>
>>   my %profile = %{ $c->config->{default_dfv_profile} };

** Note: see below

>>   $profile{required} = [ qw( id name notes ) ];
>>
>>   ...
>>
>>}
> 
> 
> Aaaah. That makes sense. So I set up
> 
> dfv_profile:
>  msgs:
>   format: '%s'
> 
> in myapp.yml then in my Controller, just override the bits I want like:
> 
>     $c->config->{dfv_profile}->{required} = [qw(username password)];

Hmm. Seems to me you're messing with a global variable here. If you 
forget to re-set the 'required' item in another controller's action you 
can find yourself with the value you set a previously accessed action.
Not 100% sure, but I would do some tests because I suspect a bug like 
this can be very difficult to discover...

Notice I did a local copy of the hash before messing with it.

> 
> Great. Thanks!

Prego!

> 
> Cxx
> 
> 
> _______________________________________________
> Catalyst mailing list
> Catalyst at lists.rawmode.org
> http://lists.rawmode.org/mailman/listinfo/catalyst
> 


-- 
Marcello Romani
Developer
Spin s.r.l.
Reggio Emilia
http://www.spinsoft.it




More information about the Catalyst mailing list