| Net-Server-Framework documentation | Contained in the Net-Server-Framework distribution. |
Net::Server::Framework::Config - this lib is deprecated and only here for compatibility
This documentation refers to Net::Server::Framework::Config version 1.3.
This library is only listed for compatibility and needs to be replaced by one of the established configuration parser.
This converts a INI style file into a hash
There are no known bugs in this module. Please report problems to Lenz Gschwendtner ( <lenz@springtimesoft.com> ) Patches are welcome.
Lenz Gschwendtner ( <lenz@springtimesoft.com> )
Copyright (c) 2007 Lenz Gschwerndtner ( <lenz@springtimesoft.comn> ) All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
| Net-Server-Framework documentation | Contained in the Net-Server-Framework distribution. |
#!/usr/bin/perl package Net::Server::Framework::Config; use strict; use warnings; use Carp; our ($VERSION) = '1.3'; sub file2hash { my $file = shift; open( my $FILE, q{<}, $file ) or croak "Could not open $file: $!"; my $hash; while (<$FILE>) { if ( my ( $key, $value ) = $_ =~ 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 }sxm ) { $hash->{$key} = $value; } } return $hash; } 1;