Fixes for cli

Use correct path for working dir
Fix path for Conf.om
Use pubsub object instead of redis connection
This commit is contained in:
eleksir
2021-12-11 15:55:14 +03:00
parent f33e05a91c
commit 7cac72d5b9
2 changed files with 4 additions and 11 deletions

View File

@@ -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;

View File

@@ -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',