[jifty-devel] Reusing Jifty models outside Jifty apps

Agent Zhang agentzh at gmail.com
Sat Dec 9 21:23:23 EST 2006

On 12/10/06, Agent Zhang <agentzh at gmail.com> wrote:
> #!/usr/bin/env perl
> use lib '../Jifty/lib';
> use lib 'lib';
> use Jifty::Everything;
> use BTDT::CurrentUser;
> use BTDT::Model::User;
> use Getopt::Long;
> Jifty->new();

Yay, that's all the boilerplate we need! BTDT is your Jifty app's
name, right? ;-)

Actually I've tried this piece of code before taking the harder
approach. But I got the following error:

    Can't locate Qooqle/Record.pm in @INC (@INC contains: lib
E:/Perl/lib E:/Perl/site/lib .) at lib/Qooqle/Model/QQUser.pm line 25.
    BEGIN failed--compilation aborted at lib/Qooqle/Model/QQUser.pm
line 25. Compilation failed in require at bin/qqimport.pl line 15.
    BEGIN failed--compilation aborted at bin/qqimport.pl line 15.

So I thought the simplest solution was not feasible at all. Now I
finally understand that instead of writing

    package Qooqle::Model::QQUser;
    use Jifty::DBI::Schema;

    use Qooqle::Record schema { ... }

I should have written

    package Qooqle::Model::QQUser;
    use Jifty::DBI::Schema;

    use Jifty::Record schema { ... }

in my Qooqle's model definitions.

Not sure if it's a Jifty bug or not. it seems ClassLoader doesn't work
for Jifty::Everything.


More information about the jifty-devel mailing list