in reply to Re: RFC - Parameter Objects
in thread RFC - Parameter Objects
I have to admit that I've never cared for overloaded methods that function as both accessors and mutators, but in this case, it might make sense.
The combination of parameters can be dealt with if I pass $self to the subroutines used for validation. Then, each item can check the other values, but this could make things order dependant (untested).
my $param = Sub::ParamObject->new({ foo => qr/\d+/, bar => sub { $_[0]->{foo} > 3 && $_[1] =~ /^this|that$/ } }); $param ->foo(7) ->bar('this'); # succeeds $param ->foo(2) ->bar('this'); # fails
And thanks for the bug catch!
Cheers,
Ovid
New address of my CGI Course.
Silence is Evil (feel free to copy and distribute widely - note copyright text)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: RFC - Parameter Objects
by Corion (Patriarch) on May 14, 2003 at 19:10 UTC | |
by Ovid (Cardinal) on May 14, 2003 at 20:33 UTC | |
by hossman (Prior) on May 14, 2003 at 21:35 UTC | |
by Aristotle (Chancellor) on May 21, 2003 at 14:26 UTC | |
|
Re: Re: Re: RFC - Parameter Objects
by hossman (Prior) on May 14, 2003 at 21:13 UTC | |
by Ovid (Cardinal) on May 14, 2003 at 21:32 UTC |