From 4d9cde38be5b268d8659e125307ac9a305f20a44 Mon Sep 17 00:00:00 2001 From: eleksir Date: Sun, 27 Mar 2022 19:15:58 +0300 Subject: [PATCH] =?UTF-8?q?trim-=D0=B0=D0=B5=D0=BC=20=D1=84=D1=80=D0=B0?= =?UTF-8?q?=D0=B7=D1=83=20=D0=BF=D0=BE=D1=81=D0=BB=D0=B5=20=D0=BF=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D0=B8=20=D0=B5=D1=91=20=D0=BD?= =?UTF-8?q?=D0=B0=20undef,=20=D0=B0=20=D0=BD=D0=B5=20=D0=B4=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/Karma.pm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/Karma.pm b/lib/Karma.pm index 64ab097..42895c2 100644 --- a/lib/Karma.pm +++ b/lib/Karma.pm @@ -1,4 +1,5 @@ package Karma; +# Хранит и выдаёт карму фразы use 5.018; ## no critic (ProhibitImplicitImport) use strict; @@ -22,18 +23,17 @@ my $c = LoadConf (); my $cachedir = $c->{cachedir}; my $max = 5; -# swallow phrase and return answer sub KarmaSet (@) { my $chatid = shift; my $phrase = shift; my $action = shift; - $phrase = trim ($phrase); - if ((! defined $phrase) || $phrase eq '') { $phrase = ' '; } + $phrase = trim ($phrase); + my $cache = CHI->new ( driver => 'BerkeleyDB', root_dir => $cachedir, @@ -80,12 +80,12 @@ sub KarmaGet (@) { my $chatid = shift; my $phrase = shift; - $phrase = trim ($phrase); - if ((! defined $phrase) || $phrase eq '') { $phrase = ' '; } + $phrase = trim ($phrase); + my $cache = CHI->new ( driver => 'BerkeleyDB', root_dir => $cachedir,