[jifty-devel] Solved : Composing Param modules
myshare
mraptor at gmail.com
Thu Mar 1 16:57:18 EST 2007
hi,
I posted a question some time ago :
How can I mix and match Params ? and also be able to have Params-only modules ?
So the solution is the following :
Let's have two modules Boo and Coo like this :
use Jifty::Param::Schema;
use Jifty::Action schema {
param .... ;
...
};
then in Foo we will do the following :
package Foo;
use Boo;
use Coo;
use Class::Data::Inheritable;
Class::Data::Inheritable::mk_classdata(Foo => 'PARAMS');
Foo->PARAMS( Jifty::Param::Schema::merge_params(Boo->PARAMS(),
Coo->PARAMS() ) );
1;
To test :
#!/usr/bin/perl
use Foo;
use Data::Dumper;
print Dumper( Foo->PARAMS());
If someone knows a more elegant/sane way of doing this, let me know !!
You could add this to the FAQ it good to be known.
More information about the jifty-devel
mailing list