Hi, is there a module available to read configuration files which are like this:
arbitrary_denominator-00 | alternate-denominator-00 | alternate-denominator-01 [| ...] { itemA = <some string> itemB = <some integer> itemC = <some float> itemD = <some CSV> } as in: postmas...@example.com | u...@example.com { itemB = 5 itemC = 3.2 itemD = foo, bar, example } The "arbitrary_denominator" would allow to retrieve the configuration options given for that particular thing (in this case an email address). It doesn't /have/ to be exactly like this; I simply used a way of writing it which I'd find pretty. I merely want to kinda have a unique handle of a set of options that apply so that I can access those in my script, like: my $foo = '.*@example.com'; my $config = getconfig->new("some.file"); foreach my $denom (@config->denominators) { if($denom =~ m/$foo/) { my $thisitem = config->itemC[$_]; print "itemC of $denom: $thisitem\n" if defined($thisitem); } } I hope you get the idea ... I'm thinking something like Getopt::Long, but for configuration files like above instead of commandline options. I don't want to use something like a CSV file for this because each entry must not be required to have every possible item defined, and a CSV file would be rather difficult to maintain. It would be possible, though inconvenient, to use a single file for each denominator. I think that at the minimum, one file per /array of denominators/ might do. However, with multiple files, all of them would have to be examined every time a config item for a denominator is requested, which could lead to somewhat poor performance, hence I'd rather use a single file. This would be one step along the way of solving the problem of printing (pre-filtered) incoming email, including the attachments, by various criteria ("when xx sends a PDF then print it unless it has more than N pages and print all HTML from xx, but print all PDF from xx when the subject is "foo"; never print the PDF sent by zz and only the first page of HTML from zz ..."): I should need a configuration file which is easy to edit, for specifying such criteria in sufficient detail. Then a perl script will use various tools to do the decoding and printing, considering the config. I'm expecting it to start somewhat simple and getting more complicated over time when users figure out that they will need a lot of criteria to keep the amount of paper wasted within reasonable limits, so the config file format must be easily extendable with further options. Your ideas will be appreciated. -- Knowledge is volatile and fluid. Software is power. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/