File Coverage

blib/lib/No/Worries.pm
Criterion Covered Total %
statement 17 17 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 22 22 100.0


line stmt bran cond sub pod time code
1             #+##############################################################################
2             # #
3             # File: No/Worries.pm #
4             # #
5             # Description: coding without worries #
6             # #
7             #-##############################################################################
8              
9             #
10             # module definition
11             #
12              
13             package No::Worries;
14 20     20   56559 use strict;
  20         38  
  20         477  
15 20     20   78 use warnings;
  20         36  
  20         1098  
16             our $VERSION = "1.6";
17             our $REVISION = sprintf("%d.%02d", q$Revision: 1.34 $ =~ /(\d+)\.(\d+)/);
18              
19             #
20             # used modules
21             #
22              
23 20     20   8008 use Sys::Hostname qw();
  20         18487  
  20         585  
24 20     20   7499 use No::Worries::Export qw(export_control);
  20         53  
  20         110  
25              
26             #
27             # global variables
28             #
29              
30             our($HostName, $ProgramName, $_IntegerRegexp, $_NumberRegexp);
31              
32             #
33             # module initialization
34             #
35              
36             # we set once for all the host name
37             $HostName = Sys::Hostname::hostname() || "";
38             $HostName = lc($HostName);
39             $HostName =~ s/\..+$//;
40              
41             # we set once for all the program name
42             $ProgramName = $0 || "";
43             $ProgramName =~ s/^.*\///;
44              
45             # private global variables
46             $_IntegerRegexp = qr/^\d+$/;
47             $_NumberRegexp = qr/^(\d+\.)?\d+$/;
48              
49             #
50             # export control
51             #
52              
53             sub import : method {
54 69     69   161 my($pkg, %exported);
55              
56 69         129 $pkg = shift(@_);
57 69         293 grep($exported{$_}++, qw($HostName $ProgramName));
58 69         190 grep($exported{$_}++, qw($_IntegerRegexp $_NumberRegexp));
59 69         270 export_control(scalar(caller()), $pkg, \%exported, @_);
60             }
61              
62             1;
63              
64             __DATA__