Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: Data-driven Programming: fun with Perl, JSON, YAML, XML...

by RichardK (Parson)
on Apr 19, 2015 at 11:24 UTC ( #1123952=note: print w/replies, xml ) Need Help??

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.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1123952]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (2)
As of 2022-05-20 22:39 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (76 votes). Check out past polls.