Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

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

by RichardK (Parson)
on Apr 19, 2015 at 11:24 UTC ( [id://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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2024-04-25 08:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found