http://qs1969.pair.com?node_id=1123952


in reply to Data-driven Programming: fun with Perl, JSON, YAML, XML...

One way to reduce the amount of repetition is to take a more OO approach and give each action a type or base action (class) that contains the common parameters. Then to look up a parameter, first check the action and if it does not exists then check the base action. This will make it much easier to add new actions and prevent a lot of cut & paste. Each new action then only need contain the relevant information, not the boring boilerplate stuff.

e.g. something along these lines :-

[ {id => 'test_build', workdir =>'build/t', type => 'default_test'}, {id => 'test_output', workdir => 'output/t', type => 'default_test'} +, ... {id => 'default_test', command => 'prove', logfile => 'test.out', te +e => 1, prompt => 0, run => 1}, ... ]

My personal preference is to use json for this type of thing, but it is just that: a personal preference. Use whatever you and your users will find most comfortable.