Skip to content
Snippets Groups Projects
Commit b6b91c04 authored by Andy Yates's avatar Andy Yates
Browse files

Adding aliases in for user, hostname and pass because this drives me crazy once a month.

parent 8f76cc83
No related branches found
No related tags found
No related merge requests found
......@@ -526,6 +526,21 @@ sub username {
$self->{_username};
}
=head2 user
Arg [1] : (optional) string $arg
The new value of the username used by this connection.
Example : $user = $db_connection->user()
Description: Convenience alias for the username method
Returntype : String
=cut
sub user {
my ($self, $arg) = @_;
return $self->username($arg);
}
=head2 host
......@@ -550,6 +565,21 @@ sub host {
$self->{_host};
}
=head2 hostname
Arg [1] : (optional) string $arg
The new value of the host used by this connection.
Example : $hostname = $db_connection->hostname()
Description: Convenience alias for the host method
Returntype : String
=cut
sub hostname {
my ($self, $arg) = @_;
return $self->host($arg);
}
=head2 password
......@@ -582,7 +612,20 @@ sub password {
return ( ref( $self->{_password} ) && &{ $self->{_password} } ) || '';
}
=head2 pass
Arg [1] : (optional) string $arg
The new value of the password used by this connection.
Example : $pass = $db_connection->pass()
Description: Convenience alias for the password method
Returntype : String
=cut
sub pass {
my ($self, $arg) = @_;
return $self->password($arg);
}
=head2 disconnect_when_inactive
......
......@@ -79,17 +79,25 @@ ok(test_getter_setter($dbc, 'dbname' , 'ensembl_db_name'));
# 6 username
#
ok(test_getter_setter($dbc, 'username', 'ensembl_user'));
is($dbc->user(), $dbc->username(), 'Checking user() returns same as username()');
#
# 7 password
#
ok(test_getter_setter($dbc, 'password', 'ensembl_password'));
is($dbc->pass(), $dbc->password(), 'Checking pass() returns same as password()');
#
# 10 dbhandle
#
ok(test_getter_setter($dbc, 'db_handle', $dbc->db_handle));
#
# dbname
#
ok(test_getter_setter($dbc, 'host', $dbc->host));
is($dbc->hostname(), $dbc->host(), 'Checking hostname() returns same as host()');
# Check the to_hash() works
is_deeply($dbc->to_hash(), \%dbc_args, 'Checking to_hash() can roundtrip a DBConnection');
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment