# Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl test.pl' ######################### We start with some black magic to print on failure. use lib qw(blib/lib); # Change 1..1 below to 1..last_test_to_print . # (It may become useful if the test is moved to ./t subdirectory.) BEGIN { $| = 1; print "1..7\n"; } END {print "not ok 1\n" unless $loaded;} use IniConf::Tied; $loaded = 1; print "ok 1\n"; ######################### End of black magic. # Open the file my($config, $config); $config=tie %config, 'IniConf::Tied', '_test.ini'; die "Unable to open $config: $!\n" unless $config; print "ok 2\n"; # simple value that has a "failed" substitution # this way we know if recursion failed or not print 'not ' unless '[yada]' eq $config{something}; print "ok 3\n"; # add more values $config->setup('fr'); print 'not ' unless 'Bonjour Monde' eq "$config{hello} $config{world}"; print "ok 4\n"; # yet more values $config->setup('gerald'); print 'not ' unless 'Billy' eq $config{something}; print "ok 5\n"; # substitution print 'not ' unless 'http://gerald.pied.nu/fr/' eq $config{homeURL}; print "ok 6\n"; # change a value, so substitution should change $config{host}='yadda'; print 'not ' unless 'http://yadda/fr/' eq $config{homeURL}; print "ok 7\n";