trim-аем фразу после проверки её на undef, а не до
This commit is contained in:
10
lib/Karma.pm
10
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,
|
||||
|
||||
Reference in New Issue
Block a user