Activator
view release on metacpan or search on metacpan
lib/Activator/DB.pm view on Meta::CPAN
## These attributes and config are all optional, and use the default from above
attr:
AutoCommit: 0/1
config:
debug: 0/1 # only affects this connection
=head1 USAGE
This module can be used either pseudo-OO or static on multiple
databases. I say pseudo-OO, because you don't call new: this module
auto-vivicates a singleton object whenever you connect for the first
time.
=over
=item ## pseudo-OO example:
my $db = Activator::DB->connect( 'db_alias' );
$db->query_method( $sql, $bind, @args );
$db->connect( 'alt_db_alias' );
lib/Activator/Options.pm view on Meta::CPAN
my $files = { user => { target => "$ENV{USER}.yml" },
realm => { target => "${realm}.yml" },
project => { target => "${project}.yml" },
org => { target => 'org.yml' } };
foreach my $path ( keys %$search_paths ) {
$path =~ s|/$||;
foreach my $which ( keys %$files ) {
my $target = $files->{ $which }->{target};
if ( !opendir DIR, $path ) {
# TODO: enhance this note to say where this path was detected
WARN( "Ignoring invalid path '$path'" );
}
else {
my @found = grep { /^$target$/ && -f "$path/$_" } readdir(DIR);
if ( @found ) {
my $file = "$path/$found[0]";
if ( !exists( $files->{ $which }->{ file } ) ) {
$files->{ $which }->{file} = $file;
}
else {
# TODO: enhance this note to say where this path was detected
INFO( "Ignoring lower priority config file '$file'" );
}
}
}
}
}
# now that we have all the files, import 'em! This is a super long
# winded but safe "left precedence" merge of all files
my ( $user_config, $realm_config, $project_config, $org_config );
lib/Activator/Registry.pm view on Meta::CPAN
Activator::DB->getrow( 'select * from some_table', [], connect->'default');
Run this way:
./test.pl
Produces this error:
activator_db_config missing You must define the key "Activator::DB" or "Activator->DB" in your project configuration
Probably should say something about the fact that you should have run it like this:
ACT_REG_YAML_FILE=/path/to/registry.yml ./test.pl
=item * Utilize other merge methods
Only the default merge mechanism for L<Hash::Merge> is used. It'd be
more robust to support other mechanisms as well.
=back
( run in 0.771 second using v1.01-cache-2.11-cpan-483215c6ad5 )