From: Damyan Ivanov Date: Tue, 16 Nov 2021 06:25:39 +0000 (+0000) Subject: move 'connect' method next to the 'disconnect' method X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=a10f5386816a7468337d033c7a6956d720b62108;p=mpd-feeder.git move 'connect' method next to the 'disconnect' method --- diff --git a/lib/App/MPD/Feeder/DB.pm b/lib/App/MPD/Feeder/DB.pm index 5ba1dde..ace454c 100644 --- a/lib/App/MPD/Feeder/DB.pm +++ b/lib/App/MPD/Feeder/DB.pm @@ -264,18 +264,6 @@ SQL ); } - method connect { - return if $db; - - $db = DBI->connect( "dbi:Pg:dbname=" . $opt->db_path, - $opt->db_user, $opt->db_password, - { RaiseError => 1, PrintError => 0, AutoCommit => 1 } ); - - $log->info( "Connected to database " . $opt->db_path ); - $generation = $self->get_option('generation'); - $log->debug("DB generation is $generation"); - } - method walk_unwanted_artists($callback) { $self->connect; @@ -346,6 +334,18 @@ SQL return $count; } + method connect { + return if $db; + + $db = DBI->connect( "dbi:Pg:dbname=" . $opt->db_path, + $opt->db_user, $opt->db_password, + { RaiseError => 1, PrintError => 0, AutoCommit => 1 } ); + + $log->info( "Connected to database " . $opt->db_path ); + $generation = $self->get_option('generation'); + $log->debug("DB generation is $generation"); + } + method disconnect { return unless $db;