KyussRyn has asked for the wisdom of the Perl Monks concerning the following question:
and have had no problems. Also in the actual code it all compiles fine. The problem I get is that I receive a Internal Server Error as soon as I uncomment "use Config::IniFiles;". My test code is:#!c:\Perl\bin\perl use warnings; use strict; package PARSEINFO;
and my PARSEINFO package (PARSEINFO.pm) code is:#!c:\Perl\bin\perl use warnings; use strict; use PARSEINFO; use GUI; use CGI qw(:standard); use constant PASS => 1; my $i_input1 = param('INPUT1'); my $i_input2 = param('INPIT2'); my %data; &PARSEINFO::ParseConfigFileToHash( 'c:\inifile.ini', \%data ); if( ($i_input1 eq $data{input1}) && ($i_input2 eq $data{input2}) ) { if( ($i_input2) || ($i_input1) ) { my @args = ("../bin/Script.exe", $i_input1, $i_input2); system(@args); my $result = $? >>8; if ( $result == PASS) { &GUI::HtmlDoc1(); } else { &GUI::HtmlDoc2(); } } else { &GUI::HtmlDoc3(); } } else { &GUI::HtmlDoc2(); } exit (0);
I know that the GUI Package works fine and the HTMLDOC1, 2 and 3 all have no problems. Thank you in adavnce for any assistance you can offer.#!c:\Perl\bin\perl use warnings; use strict; use Config::IniFiles; package PARSEINFO; sub ParseConfigFileToHash { my $ini_file = shift; my $cfg = Config::IniFiles->new( -file => $ini_file ); my $hashref = shift; $hashref->{input1} = $cfg->val( 'SETTINGS', 'INPUT1'); $hashref->{input2} = $cfg->val( 'SETTINGS', 'INPUT2'); } sub OutputConfigFile{ my $ini_file = shift; my $newConfigFile = Config::IniFiles->new( ); $newConfigFile->SetFileName( $ini_file ); my $hashref = shift; my $sectionName = 'SETTINGS'; $newConfigFile->newval( $sectionName, 'INPUT1', $hashref->{ +input1} ); $newConfigFile->newval( $sectionName, 'INPUT2', $hashref->{ +input2} ); $newConfigFile->RewriteConfig(); $newConfigFile->WriteConfig( $ini_file ); } 1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using Config::IniFiles in CGI
by mr_mischief (Monsignor) on Jan 11, 2011 at 09:48 UTC | |
|
Re: Using Config::IniFiles in CGI
by Anonyrnous Monk (Hermit) on Jan 11, 2011 at 09:37 UTC | |
|
Re: Using Config::IniFiles in CGI
by KyussRyn (Acolyte) on Jan 17, 2011 at 05:24 UTC |