[jifty-devel] Reusing Jifty models outside Jifty apps

Agent Zhang agentzh at gmail.com
Sat Dec 9 01:28:52 EST 2006


I've found that It's often desired to reuse Jifty Models in off-line
database importing/exporting scripts. Currently I'm using the following
piece of code in my Qooqle project's off-line scripts:

    use UNIVERSAL::require;
    use Jifty::Config;
    use Jifty::ClassLoader;

    BEGIN {
        Jifty::ClassLoader->new(base => 'Qooqle')->require;

    my $config = Jifty::Config->new;
    my $db_config = $config->framework('Database');
    use Jifty::DBI::Handle;
    my $handle = Jifty::DBI::Handle->new();
        driver   => $db_config->{Driver},
        database => $db_config->{Database},
        user     => $db_config->{User},
        password => $db_config->{Password},
    Jifty->new( handle => $handle );

Yes, it's ugly, but I can't make it shorter. What's the best practice for
doing this in the Jifty world?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.bestpractical.com/pipermail/jifty-devel/attachments/20061209/f9454966/attachment-0001.htm

More information about the jifty-devel mailing list