[Petal] A new modifier - logical or
William McKee
william@knowmad.com
Fri, 25 Oct 2002 17:28:18 -0400
To the best of my knowledge, Petal does not provide a means of comparing
two values. I hacked out an or: modifier which will return a true value if
either of the values being compared are true. Thought I'd share the
results for your comments/critiques/accolades <g>.
Have a good weekend,
William
#
# Do an OR comparison
$Petal::Hash::MODIFIERS->{'or:'} = sub {
my $hash = shift;
my $args = shift;
my ($arg1, $arg2) = split /\s/, $args;
my $h1 = $hash->fetch($arg1);
my $h2 = $hash->fetch($arg2);
return ($h1 || $h2) ? 1:0;
};
--
Lead Developer
Knowmad Services Inc. || Internet Applications & Database Integration
http://www.knowmad.com