Skip to content

Instantly share code, notes, and snippets.

@plu
Created November 23, 2010 16:47
Show Gist options
  • Save plu/712082 to your computer and use it in GitHub Desktop.
Save plu/712082 to your computer and use it in GitHub Desktop.
package DAO::Example::Utils;
use strict;
use warnings;
use base 'Exporter';
use Config::JFDI;
use DAO::Example::DB;
use vars qw/@EXPORT_OK $schema $config/;
@EXPORT_OK = qw/
schema
config
/;
sub config {
return $config if defined $config;
$config = Config::JFDI->new( name => "DAO::Example" )->get;
return $config;
}
sub schema {
return $schema if defined $schema;
$schema = DAO::Example::DB->connect( @{ config->{'Model::DB'}{connect_info} || [] } );
return $schema;
}
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment