On Thu, 18 Aug 2005, Yuval Kogman wrote:
You sortof can:
sub validate (+$credit_card_number,
+$credit_card_expiration,
+$credit_card_holder_name)
where { defined $credit_card_number xor
defined $credit_card_expiration &&
defined $credit_card_holder_name }
{...}
multi sub validate () { # no credit card info
}
multi sub validate (
$credit_card_number,
$credit_card_expiration,
$credit_card_holder_name
) {
}
Yeah, while playing with datetime stuff for pugs it occurred to me that
providing a fallback multi sub could be quite handy.
But I'd really like to get this stuff done at compile time wherever
possible. If I write this:
validate( credit_card_number: $number );
it should blow up at compile time, right?
-dave
/*===================================================
VegGuide.Org www.BookIRead.com
Your guide to all that's veg. My book blog
===================================================*/