in reply to and / or for config options
If I understand you correctly, you want to do something like this:
test_l.cfgtest_l.pl%config = ( 'proceed_with_x' => '( ($option1 && $option2) || $option3 )' ) ;
#! /usr/bin/perl use strict ; use warnings ; $|++ ; our %config ; do "test_l.cfg" ; my ( $r, $option1, $option2, $option3 ) ; # Case 1: Should pass. ( $option1, $option2, $option3 ) = ( 1, 1, 0 ) ; $r = eval qq[$config{'proceed_with_x'}] ; print "Case 1: " . ( $r ? "PASS" : "FAIL" ) . "\n" ; # Case 2: Should pass. ( $option1, $option2, $option3 ) = ( 0, 0, 1 ) ; $r = eval qq[$config{'proceed_with_x'}] ; print "Case 2: " . ( $r ? "PASS" : "FAIL" ) . "\n" ; # Case 3: Should fail. ( $option1, $option2, $option3 ) = ( 0, 1, 0 ) ; $r = eval qq[$config{'proceed_with_x'}] ; print "Case 3: " . ( $r ? "PASS" : "FAIL" ) . "\n" ; __END__
Those who know that they are profound strive for clarity. Those who
would like to seem profound to the crowd strive for obscurity.
--Friedrich Nietzsche
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: and / or for config options
by smackdab (Pilgrim) on Aug 17, 2002 at 02:05 UTC |