/usr/share/perl5/Boxer/CLI/Command.pm is in boxer 1.1.4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | package Boxer::CLI::Command;
use 5.010;
use strictures 1;
use App::Cmd::Setup-command;
use Log::Any::Adapter qw<Screen>;
use File::HomeDir qw<>;
use File::Temp qw<>;
use JSON qw<>;
use Path::Class qw<>;
use Role::Commons -all;
our $AUTHORITY = 'cpan:JONASS';
our $VERSION = 'v1.1.4';
my %config;
sub get_tempdir
{
Path::Class::Dir::->new(File::Temp::->newdir);
}
sub _get_distdatadir
{
File::HomeDir::->my_dist_data('boxer')
// Path::Class::Dir::->new(
File::HomeDir::->my_home => qw(boxer data) )->stringify;
}
sub _get_distconfigdir
{
File::HomeDir::->my_dist_config('config')
// Path::Class::Dir::->new(
File::HomeDir::->my_home => qw(boxer etc) )->stringify;
}
sub get_cachedir
{
my $self = shift;
my $d = Path::Class::Dir::->new(
$self->_get_distdatadir,
( ( $self->command_names )[0] ),
'cache',
);
$d->mkpath;
return $d;
}
sub get_datadir
{
my $self = shift;
my $d = Path::Class::Dir::->new(
$self->_get_distdatadir,
( ( $self->command_names )[0] ),
'store',
);
$d->mkpath;
return $d;
}
sub get_configfile
{
my $self = shift;
my $f = Path::Class::File::->new(
$self->_get_distconfigdir,
( ( $self->command_names )[0] ),
'config.json',
);
}
sub get_config
{
my $proto = shift;
my $class = ref($proto) || $proto;
unless ( $config{$class} ) {
$config{$class} = eval {
JSON::->new->decode( scalar $proto->get_configfile->slurp );
}
|| +{};
}
$config{$class};
}
sub save_config
{
my $proto = shift;
my $class = ref($proto) || $proto;
my $config = $config{$class} || +{};
my $fh = $proto->get_configfile->openw;
print $fh $config;
}
1;
|