CPAN-API/metacpan-web — Issue #411: Fails to read none-key=value lines
Author: andreas-marschke
Created: 2011-12-08 11:29:21+00:00
State: open

Hi!

----------------------------------------------------------------------------------------------------------
andreas@[duke] ~/src/nagios $> perl nsc2service.pl --nsc NSC.ini --template service.tpl
Syntax error at line 2: 'FileLogger.dll
' at /usr/share/perl5/Mixin/Linewise/Readers.pm line 85
----------------------------------------------------------------------------------------------------------

I ran across above bug with this code:
----------------------------------------------------------------------------------------------------------
#!/usr/bin/perl

our $VERSION = '0.001';

use 5.010_000;

use strict;
use warnings;

use Data::Dumper;
use Getopt::Long;
use IO::File;
use Pod::Usage;
use File::Slurp;
use Config::INI::Reader;

my ($nsc,%nsc_content,$template,$content_template);

my $result = GetOptions (
"h|help" => sub { pod2usage(-exitval => 0,
-verbose => 99,
-noperldoc => 1)},
"n|nsc=s" => \$nsc,
"t|template=s" => \$template);

$content_template = read_file ( $template );
%nsc_content = Config::INI::Reader->read_file($nsc);

print Dumper($nsc_content{'External Aliases'});
----------------------------------------------------------------------------------------------------------

It apparently hung on a line like this:
----------------------------------------------------------------------------------------------------------
[modules]
FileLogger.dll
CheckSystem.dll
CheckDisk.dll
NRPEListener.dll
CheckEventLog.dll
CheckHelpers.dll
CheckExternalScripts.dll
----------------------------------------------------------------------------------------------------------

This is part of the ini-file in NSC.ini for the NRPE NSClient on windows.

If possible I will send in a patch.

Cheers,

Andreas Marschke.