« blib/lib/App/RecordStream/Operation/tognuplot.pm
↑ Summary
blib/lib/App/RecordStream/Operation/fromps.pm »
| 1 | package App::RecordStream::Site; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 118 | our $VERSION = "4.0.23"; | |||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 118 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 118 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 118 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | { | ||||||||||||||||||||||||||||
| 11 | 118 | my $bootstrapped; | |||||||||||||||||||||||||||
| 12 | 118 | my %registry; | |||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | sub bootstrap | ||||||||||||||||||||||||||||
| 15 | { | ||||||||||||||||||||||||||||
| 16 | 143 | ▶ | if($bootstrapped) | ||||||||||||||||||||||||||
|
Subroutine
bootstrap: called CC=11 SCAR=24.0
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 17 | { | ||||||||||||||||||||||||||||
| 18 | 87 | return; | |||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | my @site_libs = ( | ||||||||||||||||||||||||||||
| 22 | (defined $ENV{RECS_SITELIB} ? $ENV{RECS_SITELIB} : ()), | ||||||||||||||||||||||||||||
| 23 | (defined $ENV{HOME} ? "$ENV{HOME}/.recs/site" : ()), | ||||||||||||||||||||||||||||
| 24 | 56 | ▶ | map { "$_/Recs/Site" } @INC | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 25 | ); | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | # First we find all conceivable sites by looking for module files | ||||||||||||||||||||||||||||
| 28 | 56 | my %sites; | |||||||||||||||||||||||||||
| 29 | 56 | for my $dir (@site_libs) | |||||||||||||||||||||||||||
| 30 | { | ||||||||||||||||||||||||||||
| 31 | 524 | ▶ | if(opendir(DIR, $dir)) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 32 | { | ||||||||||||||||||||||||||||
| 33 | 6 | ▶ | while(my $site_module = readdir(DIR)) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 34 | { | ||||||||||||||||||||||||||||
| 35 | 20 | ▶ | next if($site_module eq "." || $site_module eq ".."); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$site_module eq "." or $site_module eq ".."
MC/DC100%2/2
$site_module eq "." or $site_module eq ".."
$site_module eq "."
$site_module eq ".."
Truth table100%3/3
A or B
A= $site_module eq "."B= $site_module eq ".."
| |||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 8 | ▶ | if($site_module =~ /^(.*)\.pm$/) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 38 | { | ||||||||||||||||||||||||||||
| 39 | 6 | $sites{$1} = "$dir/$site_module"; | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | 6 | closedir(DIR); | |||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 56 | delete $sites{'Bootstrap'}; | |||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | # Then we try loading each of them (they register themselves) | ||||||||||||||||||||||||||||
| 49 | 56 | for my $site (sort(keys(%sites))) | |||||||||||||||||||||||||||
| 50 | { | ||||||||||||||||||||||||||||
| 51 | 6 | require $sites{$site}; | |||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | 56 | $bootstrapped = 1; | |||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | sub register_site | ||||||||||||||||||||||||||||
| 58 | { | ||||||||||||||||||||||||||||
| 59 | 0 | ▶ | my ($class, %args) = @_; | ||||||||||||||||||||||||||
|
Subroutine
register_site: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | 0 | ▶ | my $name = delete($args{'name'}) || croak "No name given in registration?!\n"; | ||||||||||||||||||||||||||
|
Condition0%0/3
delete $args{'name'} || croak("No name given in registration?!\n")
MC/DC0%0/2
delete $args{'name'} || croak("No name given in registration?!\n")
delete $args{'name'}
croak("No name given in registration?!\n")
Truth table0%0/3
A || B
A= delete $args{'name'}B= croak("No name given in registration?!\n")
| |||||||||||||||||||||||||||||
| 62 | 0 | ▶ | my $priority = delete($args{'priority'}) || 0; | ||||||||||||||||||||||||||
|
Condition0%0/2
delete $args{'priority'} || 0
MC/DC0%0/1
delete $args{'priority'} || 0
delete $args{'priority'}
Truth table0%0/2
A
A= delete $args{'priority'}
| |||||||||||||||||||||||||||||
| 63 | 0 | ▶ | my $path = delete($args{'path'}) || "App::RecordStream::Site::$name"; | ||||||||||||||||||||||||||
|
Condition0%0/2
delete $args{'path'} || "App::RecordStream::Site::$name"
MC/DC0%0/1
delete $args{'path'} || "App::RecordStream::Site::$name"
delete $args{'path'}
Truth table0%0/2
A
A= delete $args{'path'}
| |||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | 0 | $registry{$name} = | |||||||||||||||||||||||||||
| 66 | { | ||||||||||||||||||||||||||||
| 67 | 'name' => $name, | ||||||||||||||||||||||||||||
| 68 | 'path' => $path, | ||||||||||||||||||||||||||||
| 69 | 'priority' => $priority, | ||||||||||||||||||||||||||||
| 70 | }; | ||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | sub list_sites | ||||||||||||||||||||||||||||
| 74 | { | ||||||||||||||||||||||||||||
| 75 | 138 | ▶ | return values(%registry); | ||||||||||||||||||||||||||
|
Subroutine
list_sites: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | 118 | 1; | |||||||||||||||||||||||||||