diff options
author | dakkar <dakkar@luxion> | 2006-02-13 15:53:39 +0000 |
---|---|---|
committer | dakkar <dakkar@luxion> | 2006-02-13 15:53:39 +0000 |
commit | c58b498f7060665e286b1b7eb978cebeed9e8655 (patch) | |
tree | 24a6e00ca314ca57c157c9684c2e582607ed1251 /GroLUG/lib/HTML/Widget/Constraint | |
parent | r1314@narval: dakkar | 2006-02-10 19:50:50 +0100 (diff) | |
download | IscrittiGroLUG-c58b498f7060665e286b1b7eb978cebeed9e8655.tar.gz IscrittiGroLUG-c58b498f7060665e286b1b7eb978cebeed9e8655.tar.bz2 IscrittiGroLUG-c58b498f7060665e286b1b7eb978cebeed9e8655.zip |
merge dalla branch
git-svn-id: svn://luxion/repos/IscrittiGroLUG/trunk@191 fcb26f47-9200-0410-b104-b98ab5b095f3
Diffstat (limited to 'GroLUG/lib/HTML/Widget/Constraint')
-rw-r--r-- | GroLUG/lib/HTML/Widget/Constraint/EuroAmount.pm | 9 | ||||
-rw-r--r-- | GroLUG/lib/HTML/Widget/Constraint/ISODate.pm | 18 |
2 files changed, 27 insertions, 0 deletions
diff --git a/GroLUG/lib/HTML/Widget/Constraint/EuroAmount.pm b/GroLUG/lib/HTML/Widget/Constraint/EuroAmount.pm new file mode 100644 index 0000000..7e80265 --- /dev/null +++ b/GroLUG/lib/HTML/Widget/Constraint/EuroAmount.pm @@ -0,0 +1,9 @@ +package HTML::Widget::Constraint::EuroAmount; + +use warnings; +use strict; +use base 'HTML::Widget::Constraint::Regex'; + +sub regex { qr{^\d+(?:\.\d{0,2})?$} }; + +1; diff --git a/GroLUG/lib/HTML/Widget/Constraint/ISODate.pm b/GroLUG/lib/HTML/Widget/Constraint/ISODate.pm new file mode 100644 index 0000000..f5680d2 --- /dev/null +++ b/GroLUG/lib/HTML/Widget/Constraint/ISODate.pm @@ -0,0 +1,18 @@ +package HTML::Widget::Constraint::ISODate; + +use warnings; +use strict; +use base 'HTML::Widget::Constraint'; +use DateTime::Format::Strptime; + +my $format=DateTime::Format::Strptime->new(pattern=>'%F'); + +sub validate { + my ($self,$value)=@_; + + my $val=$format->parse_datetime($value); + + return defined($val); +} + +1; |