Catalog/Env.pm

filter: Statementstmt 63.1% 24 / 38 Branchbran 21.4% 3 / 14 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 54.5% 6 / 11 Podpod 100% 5 / 5 totaltotal 52.0% 38 / 73 CC 9 SCAR 23.2
CC
9
Cov
49%
exe7z
30.0
nom_local
6.0
BEGIN
5.2
CRAP 10.2
« Catalog/DB.pm ↑ Summary
1 # acces aux cots
2 # et aux "bonnes" variables d'environnement
3  
4 package File::Catalog::Env;
5  
6 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use Env;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 2 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 2 our @EXPORT_OK = qw(nom_local);
13  
14 =head1 NAME
15  
16 File::Catalog::Env - The great new File::Catalog::Env!
17  
18 =head1 VERSION
19  
20 Version 0.002
21  
22 =cut
23  
24 2 our $VERSION = 0.002;
25  
26 2 my $serveur;
27 my $windows;
28 2 my $exe7z;
29 2 my $tmp;
30  
31 =head1 SYNOPSIS
32  
33 Quick summary of what the module does.
34  
35 Perhaps a little code snippet.
36  
37 use File::Catalog;
38  
39 my $foo = File::Catalog->new();
40 ...
41  
42 =head1 EXPORT
43  
44 A list of functions that can be exported. You can delete this section
45 if you don't export anything, such as for a purely object-oriented module.
46  
47 =cut
48  
49 # Linux/Moba
50 2 ▶BEGIN {
Subroutine BEGIN: called CC=4 SCAR=16.4
51 2 ▶ if (exists $ENV{MOBASTARTUPDIR}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $ENV{'MOBASTARTUPDIR'}) { } 0 2 2
52  
53 # Moba
54 0 $serveur = $ENV{COMPUTERNAME};
55 0 $windows = 1;
56 }
57 else {
58 # Linux
59 2 $serveur = $ENV{HOSTNAME};
60 2 $windows = 0;
61 }
62  
63 # tmp
64 2 ▶ $tmp = (exists $ENV{TMPZ}) ? $ENV{TMPZ} : ((exists $ENV{TMP}) ? $ENV{TMP} : "/tmp");
Branch: 2 branches
BranchTrueFalseTotal
exists $ENV{'TMPZ'} ? : 0 2 2
exists $ENV{'TMP'} ? : 0 2 2
65 }
66  
67 =head1 SUBROUTINES/METHODS
68  
69 =head2 windows
70  
71 =cut
72  
73 0 ▶sub windows {
Subroutine windows: not called CC=1 SCAR=6.9
Pod documented
74 0 return $windows;
75 }
76  
77 =head2 serveur
78  
79 =cut
80  
81 0 ▶sub serveur {
Subroutine serveur: not called CC=1 SCAR=6.9
Pod documented
82 0 return $serveur;
83 }
84  
85 =head2 exe7z
86  
87 =cut
88  
89 0 ▶sub exe7z {
Subroutine exe7z: not called CC=5 SCAR=34.0
Pod documented
90  
91 0 ▶ if (!defined $exe7z) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $exe7z) 0 0 0
92 0 my $ok7za = !(system('7za &>/dev/null') >> 8);
93 0 my $ok7z = !(system('7z &>/dev/null') >> 8);
94 0 ▶ die "7z introuvable !\n" unless ($ok7z or $ok7za);
Branch: 1 branch
BranchTrueFalseTotal
unless $ok7z or $ok7za 0 0 0
Condition0%0/3
$ok7z or $ok7za
l!l&&r!l&&!r
000
MC/DC0%0/2
$ok7z or $ok7za
$ok7z $ok7za
Truth table0%0/3
A or B
A= $ok7zB= $ok7za
ABresult
1X1
011
000
95 0 ▶ $exe7z = ($ok7za) ? "7za" : "7z";
Branch: 1 branch
BranchTrueFalseTotal
$ok7za ? : 0 0 0
96 }
97  
98 0 return $exe7z;
99 }
100  
101 =head2 tmp
102  
103 =cut
104  
105 0 ▶sub tmp {
Subroutine tmp: not called CC=1 SCAR=6.9
Pod documented
106 0 return $tmp;
107 }
108  
109 =head2 nom_local
110  
111 =cut
112  
113 0 ▶sub nom_local {
Subroutine nom_local: not called CC=2 SCAR=17.9
Pod documented
114 0 my $repfic = shift;
115 0 ▶ $repfic =~ s|^/drives/([a-z])/|$1:/| if $windows;
Branch: 1 branch
BranchTrueFalseTotal
if $windows 0 0 0
116 0 return $repfic;
117 }
118  
119 =head1 AUTHOR
120  
121 Patrick Hingrez, C<< <info-perl at phiz.fr> >>
122  
123 =head1 BUGS
124  
125 Please report any bugs or feature requests to C<bug-file-catalog at rt.cpan.org>, or through
126 the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=File-Catalog>. I will be notified, and then you'll
127 automatically be notified of progress on your bug as I make changes.
128  
129  
130  
131  
132 =head1 SUPPORT
133  
134 You can find documentation for this module with the perldoc command.
135  
136 perldoc File::Catalog
137  
138  
139 You can also look for information at:
140  
141 =over 4
142  
143 =item * RT: CPAN's request tracker (report bugs here)
144  
145 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=File-Catalog>
146  
147 =item * AnnoCPAN: Annotated CPAN documentation
148  
149 L<http://annocpan.org/dist/File-Catalog>
150  
151 =item * CPAN Ratings
152  
153 L<http://cpanratings.perl.org/d/File-Catalog>
154  
155 =item * Search CPAN
156  
157 L<http://search.cpan.org/dist/File-Catalog/>
158  
159 =back
160  
161  
162 =head1 ACKNOWLEDGEMENTS
163  
164  
165 =head1 LICENSE AND COPYRIGHT
166  
167 Copyright 2015 Patrick Hingrez.
168  
169 This program is free software; you can redistribute it and/or modify it
170 under the terms of the the Artistic License (2.0). You may obtain a
171 copy of the full license at:
172  
173 L<http://www.perlfoundation.org/artistic_license_2_0>
174  
175 Any use, modification, and distribution of the Standard or Modified
176 Versions is governed by this Artistic License. By using, modifying or
177 distributing the Package, you accept this license. Do not use, modify,
178 or distribute the Package, if you do not accept this license.
179  
180 If your Modified Version has been derived from a Modified Version made
181 by someone other than you, you are nevertheless required to ensure that
182 your Modified Version complies with the requirements of this license.
183  
184 This license does not grant you the right to use any trademark, service
185 mark, tradename, or logo of the Copyright Holder.
186  
187 This license includes the non-exclusive, worldwide, free-of-charge
188 patent license to make, have made, use, offer to sell, sell, import and
189 otherwise transfer the Package with respect to any patent claims
190 licensable by the Copyright Holder that are necessarily infringed by the
191 Package. If you institute patent litigation (including a cross-claim or
192 counterclaim) against any party alleging that the Package constitutes
193 direct or contributory patent infringement, then this Artistic License
194 to you shall terminate on the date that such litigation is filed.
195  
196 Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER
197 AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
198 THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
199 PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY
200 YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR
201 CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR
202 CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE,
203 EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
204  
205  
206 =cut
207  
208 2 1; # End of File::Catalog::DB
« Catalog/DB.pm ↑ Summary