Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Re: Re: RFC - Parameter Objects

by hossman (Prior)
on May 14, 2003 at 21:13 UTC ( [id://258258]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: RFC - Parameter Objects
in thread RFC - Parameter Objects

That approach wouldn't solve the main case I pointed out where it becomes important to have validation...
what if none of the set methods are called?
...ie: what if someone constructs a Params object, but never sets any values in it? Then there is no validation of any kind.

Replies are listed 'Best First'.
Re(4): RFC - Parameter Objects
by Ovid (Cardinal) on May 14, 2003 at 21:32 UTC

    You are right, but I think it might be solved. In a response to Corion, I wrote:

    Perhaps the contructor could be modified. The current hashref would fall under a key named "params" and a different key named "groups" would list group validations. Then, as soon as an accessor is called, the "group" validations would be checked. This would eliminate the order dependence. Workable?

    When an accessor is called, the parameters are validated. If a value is never set, we can still validate it when the accessor is called. This is still not foolproof, but I think it's a reasonable scheme. Let me know if you think there are problems with this.

    Cheers,
    Ovid

    New address of my CGI Course.
    Silence is Evil (feel free to copy and distribute widely - note copyright text)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://258258]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2024-04-18 05:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found