Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Personally I'd prefer working with a Domain Specific Language for configuration, far more flexible!

Each entry must be a sub in your my_config package, action is a sub action (&) {...} taking a code block with options.

It's not only easy to read for non programmers, but also easy to validate (just add prototypes and do argument checking within the subs)

package my_config; action { id 'svninfo'; desc 'svn working copy information'; cmdline 'svn info'; workdir ''; logfile 'minbld_svninfo.log'; tee 1; prompt 0; run 1; }; action { id 'svnup'; desc 'Run full svn update'; cmdline 'svn update'; workdir ''; logfile 'minbld_svnupdate.log'; tee 1; prompt 0; run 1; }; # ...

(update: features which are only boolean could be handled without arguments with useful defaults, i.e. run 1 is simply run and run 0 is skipped)

DRY could be achieved with preloaded constants, nested structures or special commands to set defaults like

default workdir => ''; # or default { workdir ''; } # or just a top-level setting workdir ''; action { # workdir can be missing now }

The fact that you can insert arbitrary perlcode is a mixed bag, it might add extra flexibility but also be a source of bugs with non-hackers. Deactivating builtins in CORE might be an option...

Dunno if there is already an appropriate module on CPAN (?), otherwise I'd volunteer producing one for the comming GPW.

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!


In reply to Re: Data-driven Programming: fun with Perl, JSON, YAML, XML... by LanX
in thread Data-driven Programming: fun with Perl, JSON, YAML, XML... by eyepopslikeamosquito

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (7)
As of 2024-04-23 13:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found