You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Kathryn Andersen <ka...@katspace.homelinux.org> on 2006/10/11 07:36:37 UTC

Embperl::Form::Validate bug

I've been trying out Embperl::Form::Validate, (Embperl version 2.2.0)
and I've found what appears to be a bug with error messages.

If one does not give a $pref argument, and one does not give -msg values
in the RULES array, then all you get for an error message is the id
value of the error message.  I looked around in the code, and it appears that
the build_message method completely ignores the default
'default_language' setting, it only takes the 'default_language' from
the $pref argument, which is passed in unchanged by the error_message
method.

Line 362 of Embperl/Form/Validate.pm

my $default_language = $pref -> {default_language};

should be

my $default_language = $pref -> {default_language} || $self->{default_language} ;

Otherwise, what happens is that it says to itself, "hey,
$default_language is undefined, so I can't give you an error message"
and the error message then falls back to the default, which is the
id of the error message.

Which is not what one would desire.

Another question related to this -- the documentation for
Embperl::Form::Validate says 

msg
    field specific messages, if any. Maybe a hash with multiple languages.

param
    array with parameters which should subsituted inside the message

But it doesn't say how one should form the message to take advantage of
this parameter substitution, not what the parameters refer to.

Kathryn Andersen
-- 
 _--_|\     | Kathryn Andersen	<http://www.katspace.com>
/      \    | 
\_.--.*/    | GenFicCrit mailing list <http://www.katspace.com/gen_fic_crit/>
      v     | 
------------| Melbourne -> Victoria -> Australia -> Southern Hemisphere
Maranatha!  |	-> Earth -> Sol -> Milky Way Galaxy -> Universe

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: Embperl::Form::Validate bug

Posted by 'Kathryn Andersen' <ka...@katspace.homelinux.org>.
On Wed, Oct 11, 2006 at 04:35:04PM +0200, Gerald Richter wrote:
> > Line 362 of Embperl/Form/Validate.pm
> > 
> > my $default_language = $pref -> {default_language};
> > 
> > should be
> > 
> > my $default_language = $pref -> {default_language} || 
> > $self->{default_language} ;
> > 
> 
> Yes, this make sense. It's updated in the SVN.

Thanks.
 
> > 
> > But it doesn't say how one should form the message to take 
> > advantage of this parameter substitution, not what the 
> > parameters refer to.
> > 
> 
> Use %1, %2 etc. for first, second, etc. element in the array param
> references to.

Okay, but what *are* the elements in the array?  What do they refer to?

Kathryn Andersen
-- 
 _--_|\     | Kathryn Andersen	<http://www.katspace.com>
/      \    | 
\_.--.*/    | GenFicCrit mailing list <http://www.katspace.com/gen_fic_crit/>
      v     | 
------------| Melbourne -> Victoria -> Australia -> Southern Hemisphere
Maranatha!  |	-> Earth -> Sol -> Milky Way Galaxy -> Universe

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


RE: Embperl::Form::Validate bug

Posted by Gerald Richter <ri...@ecos.de>.
> Line 362 of Embperl/Form/Validate.pm
> 
> my $default_language = $pref -> {default_language};
> 
> should be
> 
> my $default_language = $pref -> {default_language} || 
> $self->{default_language} ;
> 

Yes, this make sense. It's updated in the SVN.

> 
> But it doesn't say how one should form the message to take 
> advantage of this parameter substitution, not what the 
> parameters refer to.
> 

Use %1, %2 etc. for first, second, etc. element in the array param
references to.

Gerald



 
** Virus checked by BB-5000 Mailfilter ** 


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org