Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I have heard rumours that Perl 5 is not parseable by any kind of earthly grammar. However, I'm wondering if one could get close, and if anyone has actually tried.

I'm interested in creating a "watered down" Perl environment for web developers. Developers would be able to embed a certain safe subset of Perl in their HTML - the basic control and data structures, without the eval, file I/O, system commands, backticks, etc.

The closest thing I've found, naturally, is the Safe module. I've tried gamely to use it, but it presents a host of problems when used with Mason (and, I expect, other templating systems.) One of the major problems is that once you're inside the safe compartment, everything you call out to (such as useful CPAN modules) is restricted by safe as well.

What I want, instead, is just a black box that I can hand a piece of Perl code and have it say "yes" or "no" indicating whether it is a safe subset of Perl according to my definition in the grammar. Inputs to this black box would, of course, have to include a full list of allowed function and package names.

I'm aware of the great difficulty of trying to parse Perl in its fullness, and I would be willing to sacrafice a fair amount of functionality and syntax in order to get to an actual usable grammar.

Thanks for any advice and pointers.

Jon


In reply to A grammar for Perl, or something close by swartz

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-03-29 14:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found