[jifty-devel] Reusing Jifty models outside Jifty apps
Jesse Vincent
jesse at bestpractical.com
Sun Dec 10 17:07:26 EST 2006
On Dec 10, 2006, at 2:23 AM, Agent Zhang wrote:
> 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? ;-)
>
It is. That's the internal name for Hiveminder.
> 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.
>
Oh! I bet the problem is that Jifty->new() isn't in a BEGIN {} block.
Try that?
-j
> 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.
>
> Cheers,
> Agent
> _______________________________________________
> jifty-devel mailing list
> jifty-devel at lists.jifty.org
> http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel
>
More information about the jifty-devel
mailing list