NAME
Mojo::MySQL5::URL - Connection URL
SYNOPSIS
use
Mojo::MySQL5::URL;
# Parse
say
$url
->username;
say
$url
->password;
say
$url
->host;
say
$url
->port;
say
$url
->database;
say
$url
->options;
# Build
my
$url
= Mojo::MySQL5::URL->new;
$url
->scheme(
'mysql'
);
$url
->userinfo(
'sri:foobar'
);
$url
->host(
'server'
);
$url
->port(3306);
$url
->database(
'test'
);
$url
->options(
foo
=>
'bar'
);
say
"$url"
;
DESCRIPTION
Mojo::MySQL5::URL implements MySQL Connection string URL for using in Mojo::MySQL5.
ATTRIBUTES
Mojo::MySQL5::URL inherits all attributes from Mojo::URL and implements the following new ones.
database
my
$db
=
$url
->database;
$url
=
$url
->database(
'test'
);
Database name.
options
my
$options
=
$url
->options;
$url
=
$url
->options->{PrintError} = 1;
Database options.
password
my
$password
=
$url
->password;
$url
=
$url
->password(
's3cret'
);
Password part of URL.
username
my
$username
=
$url
->username;
$url
=
$url
->username(
'batman'
);
Username part of URL.
METHODS
Mojo::MySQL5::URL inherits all methods from Mojo::URL and implements the following new ones.
dsn
# dbi:mysql:dbname=test;host=server;port=3000
say
$url
->dsn;
Convert URL to DBI Data Source Name.
parse
Parse URL string.
new
my
$url
= Mojo::MySQL5::URL->new;