protoplasm wrote: > I'm attempting to write some code using the Config::INI::Simple > module. When I run the app I get the following: > > Use of uninitialized value in concatenation (.) or string at ./open- > file2.pl line 35. > Use of uninitialized value in concatenation (.) or string at ./open- > file2.pl line 36. > Use of uninitialized value in concatenation (.) or string at ./open- > file2.pl line 37. > > I'm not sure what is uninitialized at those lines. > > Here is the code: > > #!/usr/bin/env perl > > use Carp; > use Config::INI::Simple; > use English; > use strict; > use warnings; > > use File::Find; > use File::HomeDir; > my $AesTestDir; > my @AesTestDirArray; > my $homeDir = File::HomeDir->my_home; > my @homeDirectories = ($homeDir); > > use vars qw/*name *dir/; > *name = *File::Find::name; > *dir = *File::Find::dir; > > ##-- > my $conf = new Config::INI::Simple; > > ##-- Settings file name > my $INIFILE = "settings1.ini"; > > ##-- Open settings file. > ## '<' open for reading > ## '>' create for writing > ## '>>' create and/or open for appending > open (my $FILE, '>>', $INIFILE) or croak "Can't open '$INIFILE': > $OS_ERROR"; > > # Read the config file. > $conf->read ("settings1.ini"); > > print $conf->{TestPaths}->{c_tests} . "\n"; > print $conf->{TestPaths}->{j_tests} . "\n"; > print $conf->{JarPath}->{jaest} . "\n"; > > # Find directories. > print "Locating AesTest directory...\n"; > File::Find::find(\&AesTestDir, @homeDirectories); > AesTestDirSelect(); > > close $FILE or croak "Couldn't close '$INIFILE': $OS_ERROR"; > > # Find AesTest directories. > sub AesTestDir > { > if (/^AesTest/ && -d) > { > $AesTestDir = $name; > push @AesTestDirArray, $name; > } > } > > # If there are multiple AesTest directories found, allow the user to > select > # which directory they would like to use. > sub AesTestDirSelect > { > if (@AesTestDirArray > 1) > { > # Get the array element (plus 1) from @AesTestDirArray. > foreach my $element (0..$#AesTestDirArray) > { > print "\t["; > print $element + 1 . "] $AesTestDirArray[$element]\n"; > } > print "Select the AesTest directory you would like to use: "; > chomp (my $selection = <STDIN>); > > $AesTestDir = $AesTestDirArray[$selection - 1]; > } > else > { > print " Found <$AesTestDir>\n"; > } > # Maybe add more logic here to exit if the dir is not found. > }
Those source lines are: > print $conf->{TestPaths}->{c_tests} . "\n"; > print $conf->{TestPaths}->{j_tests} . "\n"; > print $conf->{JarPath}->{jaest} . "\n"; so clearly those data elements are undefined, or more probably non-existent. Do this use Data::Dumper; print Dumper $conf; to see what data you actually have in there. Rob -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/