in reply to Re: read error in XML parsers, Windows XP Service only
in thread read error in XML parsers, Windows XP Service only
#!/usr/bin/perl # CVS version : $Id: MiraLoader.pl,v 2.13 2008-02-03 15:11:46 efs Exp +$ use strict "vars"; use warnings; use FindBin qw($Bin); use lib "$Bin/../lib"; use File::Basename; use File::Copy; use Getopt::Std; use Encode; use XML::Simple; #$XML::Simple::PREFERRED_PARSER = 'XML::Parser'; #[...] log_msg(0,"Going to parse INI file."); $INITBL = parse_INI("$MYTOPDIR/$MYINI",$SVCNAME); # $INITBL = ref + to Parameter table # parse_INI dies in case of errors, so if we're here, it's ok log_msg(0,"INI file parsed."); #[...] sub parse_INI { ############# my $IniFile = shift; # INI file name my $MYTAG = shift; # tag of "my" section my $IniRef; # the returned ref. my ($MIRA,$MYSECT); my $SectRef; my ($Val,@SplitVals); my $Msg = "Required directory not found or insufficient permissions : +"; my $MsgSect = "Required section missing in INI file :"; my $MsgFil = "Required directory/file not found or insufficient permis +sions"; my $MsgParam = "Required parameter missing in INI file :"; my $MsgParam2 = "Parameter in INI file has invalid value :"; my $fh; log_msg(0,"==>parse_INI()") if $Debug>1; unless (open($fh,'<',$IniFile)) { die_msg(0,"** Cannot open INI file \"$IniFile\" **") if $Debug +; } # Create an XML::Simple object with default parameters, my $XMLOBJ = new XML::Simple( keeproot => 1, forcearray => 0, # keyattr => 'Id', forcecontent => 1, contentkey => 'Value', ); $IniRef = $XMLOBJ->XMLin($fh); # *** close $fh; #[...] }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: read error in XML parsers, Windows XP Service only
by BrowserUk (Patriarch) on Apr 20, 2008 at 21:58 UTC |