aboutsummaryrefslogtreecommitdiff
path: root/tgsend
diff options
context:
space:
mode:
authorGuillermo Ramos2019-06-24 12:04:15 +0200
committerGuillermo Ramos2019-06-24 12:04:15 +0200
commit47fb4fc02407def9d9b19a2746983b8c65937e3f (patch)
tree75b72d0b8ff49d9e25e0192760d07061a514ab5c /tgsend
parent07975e3f25a20d30238442ce3fc98dc2b24f14a9 (diff)
downloadtgutils-47fb4fc02407def9d9b19a2746983b8c65937e3f.tar.gz
TgLib.{Cache,Env}
Diffstat (limited to 'tgsend')
-rwxr-xr-xtgsend9
1 files changed, 4 insertions, 5 deletions
diff --git a/tgsend b/tgsend
index ad874b6..c556d95 100755
--- a/tgsend
+++ b/tgsend
@@ -17,10 +17,10 @@ use Data::Dumper;
use HTTP::Request;
use JSON qw<encode_json>;
-
-my $HOME = $ENV{'HOME'};
-my $CONFIG_HOME = $ENV{'XDG_CONFIG_HOME'} || "$HOME/.config";
-my $CACHE_HOME = $ENV{'XDG_CACHE_HOME'} || "$HOME/.cache";
+# Local modules
+use FindBin;
+use lib "$FindBin::Bin/lib";
+use TgLib::Env qw<$HOME $CONFIG_HOME $CACHE_HOME>;
my $TOKEN;
my $PRETEND;
@@ -38,7 +38,6 @@ $TOKEN ||= $ENV{'TGUTILS_TOKEN'};
# If still no token, try to get it from ~/.config/tgutils_token
unless ($TOKEN) {
- my $CONFIG_HOME = $ENV{'XDG_CONFIG_HOME'} || $ENV{'HOME'} . "/.config";
my $CONFIG = "$CONFIG_HOME/tgutils_token";
open(my $cfg, "<", $CONFIG) or
pod2usage(-message => "ERROR: Unable to get bot token ($CONFIG: $!).\n",