File Coverage

lib/Sys/Path/SPc.pm
Criterion Covered Total %
statement 35 35 100.0
branch 8 8 100.0
condition n/a
subroutine 19 19 100.0
pod 14 14 100.0
total 76 76 100.0


line stmt bran cond sub pod time code
1             package Sys::Path::SPc;
2              
3 1     1   5 use warnings;
  1         1  
  1         34  
4 1     1   3 use strict;
  1         1  
  1         35  
5              
6             our $VERSION = '0.14';
7              
8 1     1   7 use File::Spec;
  1         1  
  1         38  
9              
10 1     1   6 sub _path_types {qw(
11             prefix
12             localstatedir
13             sysconfdir
14             datadir
15             docdir
16             cachedir
17             logdir
18             spooldir
19             rundir
20             lockdir
21             localedir
22             sharedstatedir
23             webdir
24             srvdir
25             )};
26              
27             # sub names inspired by http://www.gnu.org/software/autoconf/manual/html_node/Installation-Directory-Variables.html#Installation-Directory-Variables
28 1     1   11 use Config; # remove after install
  1         1  
  1         377  
29             my $prefix = $Config::Config{'prefix'}; # remove after install
30             my $localstatedir = # remove after install
31             $Config::Config{'prefix'} eq '/usr' # remove after install
32             ? '/var' # remove after install
33             : File::Spec->catdir($Config::Config{'prefix'}, 'var') # remove after install
34             ; # remove after install
35             my $sysconfdir = # remove after install
36             $Config::Config{'prefix'} eq '/usr' # remove after install
37             ? '/etc' # remove after install
38             : File::Spec->catdir($Config::Config{'prefix'}, 'etc') # remove after install
39             ; # remove after install
40             my $srvdir = # remove after install
41             $Config::Config{'prefix'} eq '/usr' # remove after install
42             ? '/srv' # remove after install
43             : File::Spec->catdir($Config::Config{'prefix'}, 'srv') # remove after install
44             ; # remove after install
45              
46 6 100   6 1 699 sub prefix { shift; $prefix = $_[0] if @_; return $prefix; };
  6         14  
  6         546  
47 14 100   14 1 23 sub localstatedir { shift; $localstatedir = $_[0] if @_; return $localstatedir; };
  14         29  
  14         943  
48              
49 3 100   3 1 10 sub sysconfdir { shift; $sysconfdir = $_[0] if @_; return $sysconfdir; };
  3         8  
  3         103  
50 1     1 1 7 sub datadir { File::Spec->catdir(__PACKAGE__->prefix, 'share') };
51 1     1 1 7 sub docdir { File::Spec->catdir(__PACKAGE__->prefix, 'share', 'doc') };
52 1     1 1 7 sub localedir { File::Spec->catdir(__PACKAGE__->prefix, 'share', 'locale') };
53 1     1 1 8 sub cachedir { File::Spec->catdir(__PACKAGE__->localstatedir, 'cache') };
54 1     1 1 24 sub logdir { File::Spec->catdir(__PACKAGE__->localstatedir, 'log') };
55 1     1 1 7 sub spooldir { File::Spec->catdir(__PACKAGE__->localstatedir, 'spool') };
56 1     1 1 9 sub rundir { File::Spec->catdir(__PACKAGE__->localstatedir, 'run') };
57 1     1 1 7 sub lockdir { File::Spec->catdir(__PACKAGE__->localstatedir, 'lock') };
58 5     5 1 861 sub sharedstatedir { File::Spec->catdir(__PACKAGE__->localstatedir, 'lib') };
59 1     1 1 7 sub webdir { File::Spec->catdir(__PACKAGE__->localstatedir, 'www') };
60 3 100   3 1 11 sub srvdir { shift; $srvdir = $_[0] if @_; return $srvdir; };
  3         8  
  3         100  
61              
62             1;
63              
64              
65             __END__