Separate DSN parts using escaped commas instead so bareword values work.

This commit is contained in:
Daniel Nichter
2012-05-24 10:56:04 -06:00
parent 15146353f9
commit 026d95ac24
2 changed files with 35 additions and 15 deletions

View File

@@ -34,14 +34,7 @@ $Data::Dumper::Quotekeys = 0;
# Passwords may contain commas.
# https://bugs.launchpad.net/percona-toolkit/+bug/886077
my $dsn_sep = qr/ # Separate DSN parts by
, # comma
(?= # followed by either
(?:\Z # the end of the string, or
|[a-zA-Z]= # start of another DSN part
)
)
/x;
my $dsn_sep = qr/(?<!\\),/;
eval {
require DBI;
@@ -140,6 +133,7 @@ sub parse {
foreach my $dsn_part ( split($dsn_sep, $dsn) ) {
if ( my ($prop_key, $prop_val) = $dsn_part =~ m/^(.)=(.*)$/ ) {
# Handle the typical DSN parts like h=host, P=3306, etc.
$prop_val =~ s/\\,/,/g;
$given_props{$prop_key} = $prop_val;
}
else {