File tree Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Expand file tree Collapse file tree 1 file changed +5
-9
lines changed Original file line number Diff line number Diff line change 1
1
package Mojo::mysql ;
2
2
use Mojo::Base ' Mojo::EventEmitter' ;
3
3
4
- use Carp ' croak' ;
4
+ use Carp qw( croak) ;
5
5
use DBI;
6
- use File::Spec::Functions ' file_name_is_absolute' ;
6
+ use File::Spec::Functions qw( file_name_is_absolute) ;
7
7
use Mojo::mysql::Database;
8
8
use Mojo::mysql::Migrations;
9
9
use Mojo::URL;
10
- use Scalar::Util ' weaken' ;
10
+ use Scalar::Util qw( blessed weaken) ;
11
11
use SQL::Abstract::mysql;
12
12
13
13
use constant MARIADB => !!eval { require DBD::MariaDB; DBD::MariaDB-> VERSION(1.21) };
@@ -68,14 +68,10 @@ sub from_string {
68
68
69
69
# Protocol
70
70
return $self unless $str ;
71
- my $url
72
- = UNIVERSAL::isa($str , ' URI::db' ) ? $str
73
- : UNIVERSAL::isa($str , ' Mojo::URL' ) ? $str
74
- : URI ? URI::db-> new($str )
75
- : Mojo::URL-> new($str );
71
+ my $url = blessed $str ? $str : Mojo::URL-> new($str );
76
72
77
73
my $protocol = $url -> can(' engine' ) ? $url -> engine : $url -> protocol;
78
- croak qq{ " $str " must have the "mariadb" or "mysql" schemes } unless $protocol =~ m ! ^(mariadb|mysql)$ ! ;
74
+ croak qq{ Invalid MySQL/MariaDB connection string " $str " } unless $protocol =~ m ! ^(mariadb|mysql)$ ! ;
79
75
my $dsn = $protocol eq ' mariadb' ? ' dbi:MariaDB' : ' dbi:mysql' ;
80
76
81
77
# Database
You can’t perform that action at this time.
0 commit comments