[jifty-devel] Contd: Compose Params

myshare mraptor at gmail.com
Thu Mar 1 17:19:38 EST 2007

even better way is make a Foo.pm like this :

package Foo;
use strict;
use Jifty::Param::Schema;
use Class::Data::Inheritable;
use Carp;

sub compose {
    my @modules = @_;
    my $pkg = __PACKAGE__;
    Class::Data::Inheritable::mk_classdata($pkg => 'PARAMS');
    for my $m (@modules) {
        eval "require $m";
        if ($@) { croak "Cant load module $m" }
        else  { $pkg->PARAMS(
Jifty::Param::Schema::merge_params($pkg->PARAMS(), $m->PARAMS() ) ) }


then in any module where u want to use some Params  defined somewhere just do
like this :

package Joo;
use base qw/Foo/;
Joo->compose qw(Coo Boo);

and test like this :


use Joo;
use Data::Dumper;

#you can do it also as late as here
#Joo->compose qw(Coo Boo);
print Dumper( Joo->PARAMS());

More information about the jifty-devel mailing list