| 1 | package App::BCSSH::Util; | ||||||||||||
| 2 | 1 | ▶ | use strictures 1; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 3 | |||||||||||||
| 4 | 1 | ▶ | use Module::Runtime qw(require_module); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | |||||||||||||
| 6 | 1 | ▶ | use base 'Exporter'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | 1 | our @EXPORT_OK = qw(find_mods command_to_package package_to_command rc_dir); | |||||||||||
| 8 | |||||||||||||
| 9 | 0 | ▶ | sub find_mods { | ||||||||||
|
Subroutine
find_mods: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||
| 10 | 0 | my ($ns, $load) = @_; | |||||||||||
| 11 | 0 | require Module::Find; | |||||||||||
| 12 | 0 | my @mods = Module::Find::findallmod($ns); | |||||||||||
| 13 | 0 | ▶ | if (defined &_fatpacker::modules) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 14 | 0 | push @mods, grep { /^$ns\::/ } _fatpacker::modules(); | |||||||||||
| 15 | } | ||||||||||||
| 16 | 0 | push @mods, grep { /^$ns\::/ } map { my $m = $_; $m =~ s{/}{::}g; $m =~ s/\.pm$//; $m } keys %INC; | |||||||||||
| 17 | 0 | ▶ | if ($load) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 18 | 0 | for my $mod (@mods) { require_module($mod) } | |||||||||||
| 19 | } | ||||||||||||
| 20 | 0 | my %mods; | |||||||||||
| 21 | 0 | @mods{@mods} = (); | |||||||||||
| 22 | 0 | return sort keys %mods; | |||||||||||
| 23 | } | ||||||||||||
| 24 | |||||||||||||
| 25 | 0 | ▶ | sub command_to_package { | ||||||||||
|
Subroutine
command_to_package: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 26 | 0 | my $command = shift; | |||||||||||
| 27 | 0 | $command =~ s/-/::/g; | |||||||||||
| 28 | 0 | return "App::BCSSH::Command::$command"; | |||||||||||
| 29 | } | ||||||||||||
| 30 | |||||||||||||
| 31 | 0 | ▶ | sub package_to_command { | ||||||||||
|
Subroutine
package_to_command: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||
| 32 | 0 | my $package = shift; | |||||||||||
| 33 | 0 | $package =~ s/^App::BCSSH::Command:://; | |||||||||||
| 34 | 0 | $package =~ s/::/-/g; | |||||||||||
| 35 | 0 | return $package; | |||||||||||
| 36 | } | ||||||||||||
| 37 | |||||||||||||
| 38 | 0 | ▶ | sub rc_dir { | ||||||||||
|
Subroutine
rc_dir: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||
| 39 | 0 | ▶ | my $config_base = $ENV{XDG_CONFIG_HOME} || "$ENV{HOME}/.config"; | ||||||||||
|
Condition0%0/2
$ENV{'XDG_CONFIG_HOME'} || "$ENV{'HOME'}/.config"
MC/DC0%0/1
$ENV{'XDG_CONFIG_HOME'} || "$ENV{'HOME'}/.config"
$ENV{'XDG_CONFIG_HOME'}
Truth table0%0/2
A
A= $ENV{'XDG_CONFIG_HOME'}
| |||||||||||||
| 40 | 0 | return "$config_base/bcssh"; | |||||||||||
| 41 | } | ||||||||||||
| 42 | |||||||||||||
| 43 | 1 | 1; | |||||||||||
| 44 | __END__ | ||||||||||||