Framework/Config.pm

filter: Statementstmt 61.1% 11 / 18 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 3 / 4 Podpod n/a totaltotal 50.0% 14 / 28 CC 4 SCAR 24.7
CC
4
Cov
46%
file2hash
20.0
BEGIN
1.0
BEGIN
1.0
CRAP 11.9
« Framework/Validate.pm ↑ Summary Framework/Errorcodes.pm »
1 #!/usr/bin/perl
2  
3 package Net::Server::Framework::Config;
4  
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 our ($VERSION) = '1.3';
10  
11 0 ▶sub file2hash {
Subroutine file2hash: not called CC=4 SCAR=30.0
12 0 my $file = shift;
13  
14 0 ▶ open( my $FILE, q{<}, $file ) or croak "Could not open $file: $!";
Branch: 1 branch
BranchTrueFalseTotal
open my $FILE, "<", $file or croak("Could not open ${file}: $!") 0 0 0
15 0 my $hash;
16 0 ▶ while (<$FILE>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $FILE)) 0 0 0
17 0 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if (() = $_ =~ m[\A # beginning of string ^\s* # trailing spaces are ignored ([^#/] # match any string \S+) # not starting with # or / # and not beeing a space \s+ # any number of spaces (.*) # any character \n # newlines at end of line \z # end of string ]msx) 0 0 0
18 my ( $key, $value ) =
19 $_ =~ m{\A # beginning of string
20 ^\s* # trailing spaces are ignored
21 ([^#/] # match any string
22 \S+) # not starting with # or /
23 # and not beeing a space
24 \s+ # any number of spaces
25 (.*) # any character
26 \n # newlines at end of line
27 \z # end of string
28 }sxm
29 )
30 {
31 0 $hash->{$key} = $value;
32 }
33 }
34 0 return $hash;
35 }
36  
37 1 1;
38  
39 =head1 NAME
40  
41 Net::Server::Framework::Config - this lib is deprecated and only here
42 for compatibility
43  
44  
45 =head1 VERSION
46  
47 This documentation refers to C<Net::Server::Framework::Config> version 1.3.
48  
49 =head1 DESCRIPTION
50  
51 This library is only listed for compatibility and needs to be replaced
52 by one of the established configuration parser.
53  
54 =head1 BASIC METHODS
55  
56 =head2 file2hash
57  
58 This converts a INI style file into a hash
59  
60 =head1 BUGS AND LIMITATIONS
61  
62 There are no known bugs in this module.
63 Please report problems to
64 Lenz Gschwendtner ( <lenz@springtimesoft.com> )
65 Patches are welcome.
66  
67 =head1 AUTHOR
68  
69 Lenz Gschwendtner ( <lenz@springtimesoft.com> )
70  
71  
72  
73 =head1 LICENCE AND COPYRIGHT
74  
75 Copyright (c)
76 2007 Lenz Gschwerndtner ( <lenz@springtimesoft.comn> )
77 All rights reserved.
78  
79 This module is free software; you can redistribute it and/or
80 modify it under the same terms as Perl itself. See L<perlartistic>.
81  
82 This program is distributed in the hope that it will be useful,
83 but WITHOUT ANY WARRANTY; without even the implied warranty of
84 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
« Framework/Validate.pm ↑ Summary Framework/Errorcodes.pm »