Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
In working on a web application, I am reaching the point at which I need to provide administrators with some limited scripting capability through a password protected web interface. Capabilities would initially need to include if...elsif...else, return, boolean logic, numeric expressions, retrieving and storing of data from/to a SQL database, and set operations (union, intersection, etc).

I have been exploring several alternatives:

  1. represent structure in XML
    • Disadvantage: ugly to edit, verbose
    • Advantage: introspection is easy
  2. build an API and allow full use of perl as the scripting language
    • Disadvantage: few limits to power and flexibility; more training required.
    • Advantage: few limits to power and flexibility
  3. define a mini-language and write a translator to convert it to perl for execution
    • Disadvantage: additional work over option 2 and less power and flexibility
    • Advantage: introspection easier than option 2, power and flexibility can be limited appropriately; less training required than option 2.

I am leaning toward the third option -- minilanguage with translator to perl. Are there any major pitfalls with such an approach?

I have not found much written about writing a minilanguage translator in perl, though Template Toolkit does serve as an example. Can anyone point me to some good resources as to how to get started down this path?

I envision bulding the parser/translator in something like Parse::RecDescent or Parse::Yapp. Parsing speed is not very critical in this application because code would be parsed once and converted to perl, then used many times.


In reply to Embedded perl or mini-language translator to perl by mp

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 having a coffee break in the Monastery: (3)
As of 2024-04-25 19:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found