r4862 - in /packages/libformvalidator-simple-perl/trunk: ./ debian/
inc/ lib/FormValidator/ lib/FormValidator/Simple/ t/ t/conf/
eloy at users.alioth.debian.org
eloy at users.alioth.debian.org
Wed Feb 21 15:04:58 CET 2007
Author: eloy
Date: Wed Feb 21 15:04:57 2007
New Revision: 4862
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=4862
Log:
new upstream version
Added:
packages/libformvalidator-simple-perl/trunk/inc/
- copied from r4861, packages/libformvalidator-simple-perl/branches/upstream/current/inc/
packages/libformvalidator-simple-perl/trunk/t/28_decode.t
- copied unchanged from r4861, packages/libformvalidator-simple-perl/branches/upstream/current/t/28_decode.t
packages/libformvalidator-simple-perl/trunk/t/conf/messages_ja.yml
- copied unchanged from r4861, packages/libformvalidator-simple-perl/branches/upstream/current/t/conf/messages_ja.yml
Modified:
packages/libformvalidator-simple-perl/trunk/Changes
packages/libformvalidator-simple-perl/trunk/MANIFEST
packages/libformvalidator-simple-perl/trunk/META.yml
packages/libformvalidator-simple-perl/trunk/Makefile.PL
packages/libformvalidator-simple-perl/trunk/debian/changelog
packages/libformvalidator-simple-perl/trunk/lib/FormValidator/Simple.pm
packages/libformvalidator-simple-perl/trunk/lib/FormValidator/Simple/Messages.pm
packages/libformvalidator-simple-perl/trunk/lib/FormValidator/Simple/Results.pm
packages/libformvalidator-simple-perl/trunk/t/22_messages.t
Modified: packages/libformvalidator-simple-perl/trunk/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libformvalidator-simple-perl/trunk/Changes?rev=4862&op=diff
==============================================================================
--- packages/libformvalidator-simple-perl/trunk/Changes (original)
+++ packages/libformvalidator-simple-perl/trunk/Changes Wed Feb 21 15:04:57 2007
@@ -1,4 +1,12 @@
Revision history for Perl extension FormValidator::Simple.
+
+0.21 Wed Feb 2 17:52:00 2007
+ - Aplied a patch and set_messages_decode_from method was implemented.
+ Thanks to Yasuhiro Horiuchi.
+
+0.20 Wed Jan 24 20:05:00 2007
+ - Added field_messages method on Results class.
+ required by Jim Spath, Thanks.
0.19 Thu Oct 26 18:52:00 2006
- Added set_invalid method to Results class.
Modified: packages/libformvalidator-simple-perl/trunk/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libformvalidator-simple-perl/trunk/MANIFEST?rev=4862&op=diff
==============================================================================
--- packages/libformvalidator-simple-perl/trunk/MANIFEST (original)
+++ packages/libformvalidator-simple-perl/trunk/MANIFEST Wed Feb 21 15:04:57 2007
@@ -1,8 +1,15 @@
Changes
-MANIFEST
-META.yml
-Makefile.PL
-README
+inc/Module/AutoInstall.pm
+inc/Module/Install.pm
+inc/Module/Install/AutoInstall.pm
+inc/Module/Install/Base.pm
+inc/Module/Install/Can.pm
+inc/Module/Install/Fetch.pm
+inc/Module/Install/Include.pm
+inc/Module/Install/Makefile.pm
+inc/Module/Install/Metadata.pm
+inc/Module/Install/Win32.pm
+inc/Module/Install/WriteAll.pm
lib/FormValidator/Simple.pm
lib/FormValidator/Simple/ArrayList.pm
lib/FormValidator/Simple/Constants.pm
@@ -16,6 +23,10 @@
lib/FormValidator/Simple/Result.pm
lib/FormValidator/Simple/Results.pm
lib/FormValidator/Simple/Validator.pm
+Makefile.PL
+MANIFEST
+META.yml
+README
t/00_compile.t
t/01_constraint.t
t/02_constraints.t
@@ -44,5 +55,7 @@
t/25_all.t
t/26_inarray.t
t/27_set_invalid.t
+t/28_decode.t
t/conf/messages.yml
+t/conf/messages_ja.yml
t/lib/FormValidator/Simple/Plugin/Sample.pm
Modified: packages/libformvalidator-simple-perl/trunk/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libformvalidator-simple-perl/trunk/META.yml?rev=4862&op=diff
==============================================================================
--- packages/libformvalidator-simple-perl/trunk/META.yml (original)
+++ packages/libformvalidator-simple-perl/trunk/META.yml Wed Feb 21 15:04:57 2007
@@ -1,24 +1,26 @@
-# http://module-build.sourceforge.net/META-spec.html
-#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
-name: FormValidator-Simple
-version: 0.19
-version_from: lib/FormValidator/Simple.pm
-installdirs: site
-requires:
- Class::Accessor: 0.22
- Class::Data::Accessor: 0
- Class::Data::Inheritable: 0.04
- Class::Inspector: 1.13
- Date::Calc: 5.4
- DateTime::Format::Strptime: 1.07
- Email::Valid: 0.15
- Email::Valid::Loose: 0.04
- List::MoreUtils: 0.16
- Mail::Address: 0
- Scalar::Util: 0
- Tie::IxHash: 1.21
- UNIVERSAL::require: 0.1
- YAML: 0.39
-
+abstract: "validation with simple chains of constraints "
+author: Lyo Kato <lyo.kato at gmail.com>
distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.30
+generated_by: Module::Install version 0.64
+license: perl
+name: FormValidator-Simple
+no_index:
+ directory:
+ - inc
+ - t
+requires:
+ Class::Accessor: 0.22
+ Class::Data::Accessor: 0.03
+ Class::Data::Inheritable: 0.04
+ Class::Inspector: 1.13
+ Date::Calc: 5.4
+ DateTime::Format::Strptime: 1.07
+ Email::Valid: 0.15
+ Email::Valid::Loose: 0.04
+ List::MoreUtils: 0.16
+ Mail::Address: 0
+ Scalar::Util: 0
+ Tie::IxHash: 1.21
+ UNIVERSAL::require: 0.1
+ YAML: 0.39
+version: 0.21
Modified: packages/libformvalidator-simple-perl/trunk/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libformvalidator-simple-perl/trunk/Makefile.PL?rev=4862&op=diff
==============================================================================
--- packages/libformvalidator-simple-perl/trunk/Makefile.PL (original)
+++ packages/libformvalidator-simple-perl/trunk/Makefile.PL Wed Feb 21 15:04:57 2007
@@ -1,22 +1,21 @@
-use ExtUtils::MakeMaker;
-WriteMakefile(
- NAME => 'FormValidator::Simple',
- VERSION_FROM => 'lib/FormValidator/Simple.pm', # finds $VERSION
- PREREQ_PM => {
- 'Class::Accessor' => 0.22,
- 'Class::Inspector' => 1.13,
- 'Class::Data::Inheritable' => 0.04,
- 'Class::Data::Accessor' => 0,
- 'UNIVERSAL::require' => 0.10,
- 'Mail::Address' => 0,
- 'Email::Valid' => 0.15,
- 'Email::Valid::Loose' => 0.04,
- 'Date::Calc' => 5.4,
- 'Tie::IxHash' => 1.21,
- 'YAML' => 0.39,
- 'List::MoreUtils' => 0.16,
- 'Scalar::Util' => 0,
- 'DateTime::Format::Strptime' => 1.0700,
- }, # e.g., Module::Name => 1.1
-);
+use inc::Module::Install;
+name 'FormValidator-Simple';
+all_from 'lib/FormValidator/Simple.pm';
+requires 'Class::Accessor' => 0.22;
+requires 'Class::Inspector' => 1.13;
+requires 'Class::Data::Inheritable' => 0.04;
+requires 'Class::Data::Accessor' => 0.03;
+requires 'UNIVERSAL::require' => 0.10;
+requires 'Mail::Address' => 0;
+requires 'Email::Valid' => 0.15;
+requires 'Email::Valid::Loose' => 0.04;
+requires 'Date::Calc' => 5.4;
+requires 'Tie::IxHash' => 1.21;
+requires 'YAML' => 0.39;
+requires 'List::MoreUtils' => 0.16;
+requires 'Scalar::Util' => 0;
+requires 'DateTime::Format::Strptime' => 1.0700;
+auto_install;
+WriteAll;
+
Modified: packages/libformvalidator-simple-perl/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libformvalidator-simple-perl/trunk/debian/changelog?rev=4862&op=diff
==============================================================================
--- packages/libformvalidator-simple-perl/trunk/debian/changelog (original)
+++ packages/libformvalidator-simple-perl/trunk/debian/changelog Wed Feb 21 15:04:57 2007
@@ -1,3 +1,9 @@
+libformvalidator-simple-perl (0.21-1) unstable; urgency=low
+
+ * New upstream release
+
+ -- Krzysztof Krzyzaniak (eloy) <eloy at debian.org> Wed, 21 Feb 2007 15:03:37 +0100
+
libformvalidator-simple-perl (0.19-1) unstable; urgency=low
* New upstream release.
Modified: packages/libformvalidator-simple-perl/trunk/lib/FormValidator/Simple.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libformvalidator-simple-perl/trunk/lib/FormValidator/Simple.pm?rev=4862&op=diff
==============================================================================
--- packages/libformvalidator-simple-perl/trunk/lib/FormValidator/Simple.pm (original)
+++ packages/libformvalidator-simple-perl/trunk/lib/FormValidator/Simple.pm Wed Feb 21 15:04:57 2007
@@ -12,7 +12,7 @@
use FormValidator::Simple::Constants;
use FormValidator::Simple::Messages;
-our $VERSION = '0.19';
+our $VERSION = '0.21';
__PACKAGE__->mk_classaccessors(qw/data prof results/);
__PACKAGE__->mk_classaccessor( messages => FormValidator::Simple::Messages->new );
@@ -65,6 +65,11 @@
}
}
+sub set_message_decode_from {
+ my ($self, $decode_from) = @_;
+ $self->messages->decode_from($decode_from);
+}
+
sub set_message_format {
my ($proto, $format) = @_;
$format ||= '';
@@ -151,7 +156,6 @@
}
1;
-__END__
=head1 NAME
@@ -621,6 +625,15 @@
print $message, "\n";
}
+ # or you can get messages as hash style.
+ # each fieldname is the key
+ my $field_messages = $result->field_messages('action1');
+ if ($field_messages->{name}) {
+ foreach my $message ( @{ $field_messages->{name} } ) {
+ print $message, "\n";
+ }
+ }
+
When it can't find indicated action, name, and type, it searches proper message from DEFAULT action.
If in template file,
@@ -645,6 +658,13 @@
See L<FormValidator::Simple::Results>
+=head1 FLAGGED UTF-8
+
+If you set encoding like follows, it automatically decode the
+result messages.
+
+ FormValidtor::Simple->set_mesasges_decode_from('utf-8');
+
=head1 SEE ALSO
L<Data::FormValidator>
Modified: packages/libformvalidator-simple-perl/trunk/lib/FormValidator/Simple/Messages.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libformvalidator-simple-perl/trunk/lib/FormValidator/Simple/Messages.pm?rev=4862&op=diff
==============================================================================
--- packages/libformvalidator-simple-perl/trunk/lib/FormValidator/Simple/Messages.pm (original)
+++ packages/libformvalidator-simple-perl/trunk/lib/FormValidator/Simple/Messages.pm Wed Feb 21 15:04:57 2007
@@ -1,7 +1,11 @@
package FormValidator::Simple::Messages;
use strict;
+use base 'Class::Accessor::Fast';
use YAML;
use FormValidator::Simple::Exception;
+
+__PACKAGE__->mk_accessors(qw/decode_from/);
+use Encode;
sub new {
my $class = shift;
@@ -45,6 +49,9 @@
sub get {
my $self = shift;
my $msg = $self->_get(@_);
+ if ($self->decode_from && !Encode::is_utf8($msg)) {
+ $msg = Encode::decode($self->decode_from, $msg);
+ }
return sprintf $self->format, $msg;
}
Modified: packages/libformvalidator-simple-perl/trunk/lib/FormValidator/Simple/Results.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libformvalidator-simple-perl/trunk/lib/FormValidator/Simple/Results.pm?rev=4862&op=diff
==============================================================================
--- packages/libformvalidator-simple-perl/trunk/lib/FormValidator/Simple/Results.pm (original)
+++ packages/libformvalidator-simple-perl/trunk/lib/FormValidator/Simple/Results.pm Wed Feb 21 15:04:57 2007
@@ -41,6 +41,23 @@
return \@messages;
}
+sub field_messages {
+ my ($self, $action) = @_;
+ my $messages = {};
+ my $keys = $self->error;
+ foreach my $key ( @$keys ) {
+ $messages->{$key} = [];
+ my $types = $self->error($key);
+ foreach my $type ( @$types ) {
+ my $message = $self->message->get($action, $key, $type);
+ unless ( List::MoreUtils::any { $_ eq $message } @{ $messages->{$key} } ) {
+ push @{ $messages->{$key} }, $message;
+ }
+ }
+ }
+ return $messages;
+}
+
sub register {
my ($self, $name) = @_;
$self->_records->{$name}
Modified: packages/libformvalidator-simple-perl/trunk/t/22_messages.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libformvalidator-simple-perl/trunk/t/22_messages.t?rev=4862&op=diff
==============================================================================
--- packages/libformvalidator-simple-perl/trunk/t/22_messages.t (original)
+++ packages/libformvalidator-simple-perl/trunk/t/22_messages.t Wed Feb 21 15:04:57 2007
@@ -1,5 +1,5 @@
use strict;
-use Test::More tests => 16;
+use Test::More tests => 25;
BEGIN{ use_ok("FormValidator::Simple") }
use CGI;
@@ -83,6 +83,12 @@
is($omessages->[0], 'not blank for object1');
is($omessages->[1], 'length wrong for object2');
+my $field_messages = $or->field_messages('object');
+is(scalar @{ $field_messages->{object1} }, 1);
+is(scalar @{ $field_messages->{object2} }, 1);
+is($field_messages->{object1}[0], 'not blank for object1');
+is($field_messages->{object2}[0], 'length wrong for object2');
+
# make sure the class version still works:
my $nr = FormValidator::Simple->check( $q => [
data1 => [qw/NOT_BLANK INT/, [qw/LENGTH 0 3/] ],
@@ -98,3 +104,10 @@
is($nmessages->[3], 'input data3');
is($nmessages->[4], 'input data4');
+my $nfmessages = $nr->field_messages('test');
+is($nfmessages->{data1}[0], 'input integer for data1');
+is($nfmessages->{data1}[1], 'data1 has wrong length');
+is($nfmessages->{data2}[0], 'default error for data2');
+is($nfmessages->{data3}[0], 'input data3');
+is($nfmessages->{data4}[0], 'input data4');
+
More information about the Pkg-perl-cvs-commits
mailing list