File Coverage

blib/lib/File/Catalog/Env.pm
Criterion Covered Total %
statement 18 32 56.2
branch 3 14 21.4
condition 0 3 0.0
subroutine 6 11 54.5
pod 5 5 100.0
total 32 65 49.2


line stmt bran cond sub pod time code
1             # acces aux cots
2             # et aux "bonnes" variables d'environnement
3              
4             package File::Catalog::Env;
5              
6 1     1   4 use strict;
  1         1  
  1         32  
7 1     1   3 use warnings;
  1         2  
  1         18  
8 1     1   17 use 5.010;
  1         2  
9 1     1   3 use Env;
  1         1  
  1         6  
10 1     1   424 use Exporter 'import';
  1         1  
  1         109  
11              
12             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             our $VERSION = 0.002;
25              
26             my $serveur;
27             my $windows;
28             my $exe7z;
29             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             BEGIN {
51 1 50   1   3 if (exists $ENV{MOBASTARTUPDIR}) {
52              
53             # Moba
54 0         0 $serveur = $ENV{COMPUTERNAME};
55 0         0 $windows = 1;
56             }
57             else {
58             # Linux
59 1         3 $serveur = $ENV{HOSTNAME};
60 1         2 $windows = 0;
61             }
62              
63             # tmp
64 1 50       173 $tmp = (exists $ENV{TMPZ}) ? $ENV{TMPZ} : ((exists $ENV{TMP}) ? $ENV{TMP} : "/tmp");
    50          
65             }
66              
67             =head1 SUBROUTINES/METHODS
68              
69             =head2 windows
70              
71             =cut
72              
73             sub windows {
74 0     0 1   return $windows;
75             }
76              
77             =head2 serveur
78              
79             =cut
80              
81             sub serveur {
82 0     0 1   return $serveur;
83             }
84              
85             =head2 exe7z
86              
87             =cut
88              
89             sub exe7z {
90              
91 0 0   0 1   if (!defined $exe7z) {
92 0           my $ok7za = !(system('7za &>/dev/null') >> 8);
93 0           my $ok7z = !(system('7z &>/dev/null') >> 8);
94 0 0 0       die "7z introuvable !\n" unless ($ok7z or $ok7za);
95 0 0         $exe7z = ($ok7za) ? "7za" : "7z";
96             }
97              
98 0           return $exe7z;
99             }
100              
101             =head2 tmp
102              
103             =cut
104              
105             sub tmp {
106 0     0 1   return $tmp;
107             }
108              
109             =head2 nom_local
110              
111             =cut
112              
113             sub nom_local {
114 0     0 1   my $repfic = shift;
115 0 0         $repfic =~ s|^/drives/([a-z])/|$1:/| if $windows;
116 0           return $repfic;
117             }
118              
119             =head1 AUTHOR
120              
121             Patrick Hingrez, C<< >>
122              
123             =head1 BUGS
124              
125             Please report any bugs or feature requests to C, or through
126             the web interface at L. 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
146              
147             =item * AnnoCPAN: Annotated CPAN documentation
148              
149             L
150              
151             =item * CPAN Ratings
152              
153             L
154              
155             =item * Search CPAN
156              
157             L
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
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             1; # End of File::Catalog::DB