| 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
| |||||||||||
| 15 | 0 | my $hash; | |||||||||
| 16 | 0 | ▶ | while (<$FILE>) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 17 | 0 | ▶ | if ( | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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. | ||||||||||