Do not manipulate lib path directly.

Perl is a bit fucky about addng paths to @INC directly or via use lib;
Also update .gitignore.
This commit is contained in:
eleksir
2026-01-02 16:16:17 +03:00
parent 8f6ccfba04
commit 65a3382bb0
2 changed files with 23 additions and 2 deletions

1
.gitignore vendored
View File

@@ -6,4 +6,5 @@ aleesa-telegram.pid
data/cache/** data/cache/**
data/admin/** data/admin/**
data/config.json data/config.json
data/chatlist.txt
vendor_perl/** vendor_perl/**

View File

@@ -13,11 +13,31 @@ use warnings;
use utf8; use utf8;
use open qw (:std :utf8); use open qw (:std :utf8);
use English qw ( -no_match_vars ); use English qw ( -no_match_vars );
use version; our $VERSION = qw (1.0);
my $workdir;
# before we run, change working dir
BEGIN {
use Cwd qw (chdir abs_path);
my @CWD = split /\//xms, abs_path ($PROGRAM_NAME);
if ($#CWD > 1) {
$#CWD = $#CWD - 1;
}
$workdir = join '/', @CWD;
chdir $workdir;
}
use lib ("$workdir/lib", "$workdir/vendor_perl", "$workdir/vendor_perl/lib/perl5");
no Cwd;
use Data::Dumper qw(Dumper); use Data::Dumper qw(Dumper);
use JSON::XS (); use JSON::XS ();
use lib ("./lib", "./vendor_perl", "./vendor_perl/lib/perl5");
use BotLib::Admin qw( use BotLib::Admin qw(
FortuneToggleList FortuneEnabled FortuneToggleList FortuneEnabled
ChanMsgToggleList ChanMsgEnabled ChanMsgToggleList ChanMsgEnabled