Hello,

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;
   $config->load;
   my $db_config = $config->framework('Database');
   use Jifty::DBI::Handle;
   my $handle = Jifty::DBI::Handle->new();
   $handle->connect(
       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?

Thanks!
Agent
_______________________________________________
jifty-devel mailing list
[email protected]
http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel

Reply via email to