From 7cac72d5b9cf759bf6a152f306b54160a8afff9c Mon Sep 17 00:00:00 2001 From: eleksir Date: Sat, 11 Dec 2021 15:55:14 +0300 Subject: [PATCH] Fixes for cli Use correct path for working dir Fix path for Conf.om Use pubsub object instead of redis connection --- bin/redis_msg_gen.pl | 10 +--------- lib/Cli.pm | 5 +++-- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/bin/redis_msg_gen.pl b/bin/redis_msg_gen.pl index a7fe2c0..0abb8b1 100644 --- a/bin/redis_msg_gen.pl +++ b/bin/redis_msg_gen.pl @@ -15,11 +15,7 @@ my $workdir; BEGIN { use Cwd qw (chdir abs_path); my @CWD = split /\//xms, abs_path ($PROGRAM_NAME); - - if ($#CWD > 1) { - $#CWD = $#CWD - 1; - } - + if ($#CWD > 1) { $#CWD = $#CWD - 2; } $workdir = join '/', @CWD; chdir $workdir; } @@ -27,10 +23,6 @@ BEGIN { use lib ("$workdir/lib", "$workdir/vendor_perl", "$workdir/vendor_perl/lib/perl5"); use Cli qw (RunCli); -# set correct proctitle -$PROGRAM_NAME = abs_path $PROGRAM_NAME; ## no critic (Variables::RequireLocalizedPunctuationVars) - -# run cli, at last RunCli (); exit 0; diff --git a/lib/Cli.pm b/lib/Cli.pm index e8571ed..1c6df0c 100644 --- a/lib/Cli.pm +++ b/lib/Cli.pm @@ -10,7 +10,7 @@ use open qw (:std :utf8); # модули для работы приложения use Mojo::Redis; -use Conf qw (LoadConf); +use BolLib::Conf qw (LoadConf); use version; our $VERSION = qw (1.0); use Exporter qw (import); @@ -23,9 +23,10 @@ sub RunCli { sprintf 'redis://%s:%s/1', $c->{redis_server}, $c->{redis_port} ); + my $pubsub = $redis->pubsub; my $send_to = 'telegram'; - $redis->json ($send_to)->notify ( + $pubsub->json ($send_to)->notify ( $send_to => { from => 'redis_msg_gen.pl', userid => '0',