[jifty-devel] Easier model usage

Jesse Vincent jesse at bestpractical.com
Mon Sep 1 17:56:37 EDT 2008


On Aug 30, 2008, at 6:21 AM, Kang-min Liu wrote:

> Hi, cl, jesse
>
> The introduced names are not top-level package names but package
> global functions.
>
> "Foo" is a method imported from Jifty::ModelHelpers with body defined
> there with some
> code looks like this:
>
> *{"Foo"} = sub {
>    my @arg = @_;
>    my $obj = Jifty->app_class(Model => "Foo");
>    if (@arg == 1) {
>        $obj->load(@arg)
>    }
>    elsif (@arg % 2 == 0) {
>        $obj->load_by_cols(@arg);
>    }
>    return $obj;
> };
>
> Only they are generated in the body of Jifty::ModelHelpers package.
> Not even playing any import
> magic.
>

In the interest of encouraging more of a plugin culture, is there any  
reason not to release this as
JiftyX::ModelHelpers on CPAN? (I think it's neat and you shouldn't  
take my desire to pluginize more of jifty
as anything negative at all :)

>

>
> You say:
>
> db("foo[id=1]")
>
> (I did'nt named it DBIx::jQuery for some reason but maybe I should
> have done that.)

Ooh, that's kind of sick. I'd love to see how more complex code looks  
with it.

-j

>


More information about the jifty-devel mailing list