Eyck has asked for the wisdom of the Perl Monks concerning the following question:
I find perl hash notation very readable, so I tend to use it for config files, the problem is, that then I have to require/use the file ( which is insecure and unelegant ), and I would prefer to parse it, like you normally do with config files.
With some external lib parsing this hash notation it would be also easy to let non-perl based programs read such files..
First phase would be just parsing something like this:
my $hash={ 'Key1' => "Value1", 'Key2' => "Value2", };
next levels would handle arrays, comments, etc...
What would be the best way to handle this? (ie without evaling this, possibly with some kind of error reporting )
Has anyone else done anything like this, any big hurdles waiting for soul trying that ( I haven't found any module/lib handling this issue )?
UPDATE D'oh! Of course there is, Storable does exactly that.
|
|---|