On Mon, Apr 02, 2007 at 22:15:08 +0100, Andy Armstrong wrote: > Instead I'd like to be able to write: > > my $form = WebForm::new; > my $wide_form = $form->variant( { width => 30 } ); > my $narrow_form = $form->variant( { width => 10 } ); > > $wide_form->input('name', 'Enter you name'); > $narrow_form->input('age', 'Enter your age'); > > There's still only one WebForm object: $wide_form and $narrow_form are > proxies for $form that modify its behaviour. It's a bit like currying > but for objects rather than functions.
That's pretty much vanilla prototype OO (know any js?). See Class::Classless, Class::Prototyped and friends. > In some ways it's similar to MVC with $wide_form and $narrow_form being > two views attached to the $form controller. The difference is that the > two views actually inherit their behavior from the controller and can be > used interchangeably with it. Eh, how? -- Yuval Kogman <[EMAIL PROTECTED]> http://nothingmuch.woobling.org 0xEBD27418
pgpYVx1iOg9y8.pgp
Description: PGP signature