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

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

This isn't quite sufficiently specified to write code for.

1) You talk about a bracketed "record" and nested within it bracketed "sub-records", but the main record and its single direct sub-record appear to have key-value pairs (like a hash structure), while the further nested sub-records appear to be simple lists (like an array structure). How is it intended to distinguish the one from the other? Is it just that the key "valid-values" introduces a list while anything else introduces a hash?

2) You talk about keys as "text" and values as "simple text" (if not a record), but there's an example of a quoted string ("The aws-ec2 parameters") and the unquoted string values include other punctuation marks. What characters can appear in unquoted text? What types of quoting can appear (double quotes, single quotes, other)? Can quote marks appear inside a quoted string, perhaps escaped somehow? Can quoted text include other whitespace, such as newlines?

3) The example shows four bits of text preceding the main record (sys ecm cloud-provider /Common/aws-ec2), what is supposed to happen with that text, is it to be ignored?

It would be useful to answer these questions, and confirm the answers by showing what data structure you would ideally like to see from this example (perhaps in the form of Data::Dumper output). Eg:

$VAR1 = { 'description' => 'The aws-ec2 parameters', 'property-template' => { 'account' => {}, 'availability-zone' => { 'valid-values' => [ 'a', 'b', 'c', 'd' ] }, 'instance-type' => { 'valid-values' => [ 't2.micro', 't2.small', 't2.medium' ] }, 'region' => { 'valid-values' => [ 'us-east-1', 'us-west-1' ] } } };

In reply to Re: Parsing bracket formatted file by hv
in thread Parsing bracket formatted file by Stilgar

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 learning in the Monastery: (4)
As of 2024-04-26 01:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found