From a10f5386816a7468337d033c7a6956d720b62108 Mon Sep 17 00:00:00 2001 From: Damyan Ivanov Date: Tue, 16 Nov 2021 06:25:39 +0000 Subject: [PATCH] move 'connect' method next to the 'disconnect' method --- lib/App/MPD/Feeder/DB.pm | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) 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; -- 2.39.2