Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

rjbs (4671)

  (email not shown publicly)
AOL IM: RicardoJBSignes (Add Buddy, Send Message)
Yahoo! ID: RicardoSignes (Add User, Send Message)

I'm a Perl coder living in Bethlehem, PA and working Philadelphia. I'm a philosopher and theologan by training, but I was shocked to learn upon my graduation that these skills don't have many associated careers. Now I write code.

Journal of rjbs (4671)

Tuesday July 29, 2008
09:27 PM

blast from my programming past

[ #37051 ]

Despite all my attempts to convince myself that it was a bad idea and not needed (I mean, I even tried to solve the problem with XML), I have found myself working on a schema and data validation system.

I'll write more about it when it's more done.

In the meantime, I needed, in several places, both in the schemata and in my internal code, to quickly say "given these minimum and maximum values, which may or may not be exclusive, construct a validator."

I was slowly slogging through this, dreading the growing cross-product of possible combinations, when I realized that I made this simple five years ago, and now I could reap the benefits -- becoming, once again, probably the only person to use Number::Tolerant.

push @tolerances, Number::Tolerant->new($arg->{min} => 'or_more')
  if defined $arg->{min};
push @tolerances, ... if ...;

my $tol = reduce { $a & $b } @tolerances;

return sub { $_[0] == $tol };

Thanks, younger me! For once you didn't set me up for more obnoxious work.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.