On Wed, Aug 17, 2005 at 22:06:07 +0000, Luke Palmer wrote:
> >
> > { credit_card_number =>
> > { optional => 1,
> > depends => [ 'credit_card_expiration', 'credit_card_holder_name' ] },
> >
> > credit_card_expiration => { optional => 1 },
> >
> > credit_card_holder_name => { optional => 1 },
> > }
> >
> > I have no idea how I might do this in Perl6, but I would love to see it
> > supported as part of parameter declarations
>
> 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
) {
}
--
() Yuval Kogman <[EMAIL PROTECTED]> 0xEBD27418 perl hacker &
/\ kung foo master: /me beats up some cheese: neeyah!!!!!!!!!!!!!!!!!
pgpEa5OfAsbXn.pgp
Description: PGP signature
