Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

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? 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.


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

Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-06-25 08:16 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.