[PW-dev] XML configuration
Status: Alpha
Brought to you by:
spadkins
From: James G S. <JG...@TA...> - 2001-06-23 19:29:25
|
I have an XML configuration object created. It is a bit awkward in places, but this is my first time to deal with XML::Parser directly, so someone might have a better way to do this. The code for this and an example perl script and configuration file are at http://hex.tamu.edu/pwl/ . Documentation is lagging horribly. Basically, the following is a configuration: <classes> <class id="menu"> <entrees><hash> <a>Aardvark</a> <b>Beef</b> <c>Calamari</a> </hash> </entrees> <entree>b</entree> <desserts><array> <value>Chocolate Mousse</value> <value>Strawberry Shortcake</value> <value>Death by Chocolate</value> </array> </desserts> <dessert>Death by Chocolate</dessert> </class> </classes> This allows for a widget to have the class "menu". If the name of the class is "entree", then the set of values it can have is "entrees" within the "menu" class. The default value is "entree". We might want to expand the configuration to something like this: <configuration> <classes> <class id="error"> <color>red</color> </class> </classes> <widgets> <widget name="date"> <month value="January"/> <day value="2"/> <year>1992</year> </widget> </widgets> </configuration> I don't have that coded yet.... I was wanting the following line to work: my $conf = read Widget::Configuration::XML "test.conf"; but Perl didn't like it :( It does make for a nice sentence though. Instead, I use: my $conf = Widget::Configuration::XML -> read("test.conf"); -- James Smith <JG...@TA...>, 979-862-3725 Texas A&M CIS Operating Systems Group, Unix |