1

Another bits of refactoring, code-style fixes, etc

This commit is contained in:
Sergei Fedosov
2021-02-08 18:01:03 +03:00
parent 96b861b507
commit c619e47560
20 changed files with 82 additions and 93 deletions

View File

@@ -9,13 +9,13 @@ use open qw (:std :utf8);
use English qw ( -no_match_vars );
use Carp qw (carp croak);
use File::Path qw (make_path);
use Math::Random::Secure qw (irand);
use SQLite_File;
use conf qw (loadConf);
use vars qw/$VERSION/;
use version; our $VERSION = qw (1.0);
use Exporter qw (import);
our @EXPORT_OK = qw (seed friday);
$VERSION = '1.0';
my $c = loadConf ();
my $dir = $c->{friday}->{dir};
@@ -46,9 +46,9 @@ sub seed () {
next;
}
chomp();
my ($phrase, $days) = split(/ \|\| /);
my @daylist = split(//, $days);
chomp ();
my ($phrase, $days) = split (/ \|\| /);
my @daylist = split (//, $days);
foreach my $day (@daylist) {
unless (defined $day) {
@@ -59,7 +59,7 @@ sub seed () {
next ;
}
if (defined $phrase && ($phrase ne '') && ($phrase !~ m/^\s+$/xmsg)) {
if (defined ($phrase) && ($phrase ne '') && ($phrase !~ m/^\s+$/xmsg)) {
push @{$friday->[$day - 1]}, $phrase;
}
}
@@ -84,7 +84,7 @@ sub friday () {
return '';
};
my $phrase = $array[int (rand ($#array - 1))];
my $phrase = $array[irand ($#array - 1)];
# decode?
utf8::decode $phrase;
untie @array;