X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FApp%2FRemoteGnokii.pm;h=718ac9305fe078eaee4957ce2db629b6a6e3366c;hb=ca8f39c8fbd0124ff04ad7c31e1bc9cf2377abc0;hp=c03ff9268a4433fb8f6b405a7b70211f9759dc4a;hpb=bd744e3f19a9742ad50c6a6b65d2d24b3f69bd67;p=app-remotegnokii.git diff --git a/lib/App/RemoteGnokii.pm b/lib/App/RemoteGnokii.pm index c03ff92..718ac93 100644 --- a/lib/App/RemoteGnokii.pm +++ b/lib/App/RemoteGnokii.pm @@ -4,7 +4,6 @@ use 5.014000; use strict; use warnings; our $VERSION = '0.000_001'; -$VERSION = eval $VERSION; use Config::Any; use File::Copy qw/move/; @@ -13,7 +12,7 @@ use Plack::Request; my $cfg; -sub cfg ($){ +sub cfg ($){ ## no critic (ProhibitSubroutinePrototypes) unless ($cfg) { $cfg = Config::Any->load_stems({stems => [$ENV{RGCONFIG} // '/etc/rg'], use_ext => 1, flatten_to_hash => 1}); my @cfg = values %$cfg; @@ -26,8 +25,8 @@ sub cfg ($){ sub sendsms { my ($number, $text) = @_; my ($fh, $file) = tempfile 'smsXXXX', TMPDIR => 1; - print $fh "$number\n$text"; - close $fh; + print $fh "$number\n$text" or warn "print: $!"; ## no critic (RequireCarping) + close $fh or warn "close: $!"; ## no critic (RequireCarping) move $file, cfg 'spool'; } @@ -36,7 +35,7 @@ sub sendsms { sub action { my ($number, $date, $text) = @_; my $password = cfg 'password'; - sendsms cfg 'number', <new(shift); - my @numbers = split ',', $r->param('numbers'); + my @numbers = split /,/s, $r->param('numbers'); my $password = $r->param('password'); return [403, ['Content-Type', 'text/plain'], ['Bad password']] unless $password eq $correct_password; my $text = $r->param('text');