symkat / dbix-config Goto Github PK
View Code? Open in Web Editor NEWManage Credentials for DBI
Manage Credentials for DBI
For cases like DBIx::Connector, and people who really don't want to DBIx::Config->connect() provide a method to get the configuration details, such that the following code does what you want.
#!/usr/bin/perl
use warnings;
use strict;
use DBIx::Connector;
use DBIx::Config;
my $conn = DBIx::Connector->new( DBIx::Config->connect_info( "MY_DATABASE" ) );
And, mst beat me to the patch:
diff --git a/lib/DBIx/Config.pm b/lib/DBIx/Config.pm
index 47ca6ae..d0bb9a7 100644
--- a/lib/DBIx/Config.pm
+++ b/lib/DBIx/Config.pm
@@ -28,7 +28,7 @@ sub new {
return $self;
}
-sub connect {
+sub connect_info {
my ( $self, @info ) = @_;
if ( ! ref $self eq __PACKAGE__ ) {
@@ -42,7 +42,12 @@ sub connect {
$config = $self->default_load_credentials($config)
unless $config->{dsn} =~ /dbi:/i;
- return DBI->connect( $self->_dbi_credentials($config) );
+ return $self->_dbi_credentials( $config );
+}
+
+sub connect {
+ my ( $self, @info ) = @_;
+ return DBI->connect( $self->connect_info( @info ) );
}
# Normalize arguments into a single hash. If we get a single hashref,
Please see https://rt.cpan.org/Ticket/Display.html?id=112888 (and possibly other issues in this queue).
Allow a directory to be added to config_files through an environment variable so quicksilver likes it.
The documentation doesn't point out that Config::Any is being used and that config files will be tried for all the given extentions that are tried by Config::Any.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.