DBIx::RewriteDSN - dsn rewriter for debug
use DBI; use DBIx::RewriteDSN -rules => q{ dbi:SQLite:dbname=foobar dbi:SQLite:dbname=test_foobar }; ## DBIx::RewriteDSN redefine DBI::connect and ## rewrite dsn passed to DBI::connect my $dbh = DBI->connect("dbi:SQLite:dbname=foobar", "", ""); $dbh->{Name} #=> dbname=test_foobar
External File:
use DBI; use DBIx::RewriteDSN -file => "dbi_rewrite.rules"; my $dbh = DBI->connect("dbi:SQLite:dbname=foobar", "", "");
DBIx::RewriteDSN is dsn rewriter. This enables rewrite all DBI->connect based on rule text.
Enable rewrites based on rules in filename.
filename
Enable rewrites based on rules.
If DBI_REWRITE_DSN is false, import does not anything by default.
DBI_REWRITE_DSN
Disable rewrites.
Re-enable rewrites.
Prepend $rules to current rules.
Rules is like:
dbi:SQLite:dbname=foobar dbi:SQLite:dbname=foobar_test dbi:mysql:database=([^;]+).* dbi:SQLite:dbname=$1 # fallback (.*) dbi:fallback:$1
cho45 <cho45@lowreal.net>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install DBIx::RewriteDSN, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DBIx::RewriteDSN
CPAN shell
perl -MCPAN -e shell install DBIx::RewriteDSN
For more information on module installation, please visit the detailed CPAN module installation guide.