Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

comment on

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

The functions tend to take arguments on a per element basis. If the function is going to it will generally ask if it is recieveing an array or hash reference first then go on to process the code accordingly.

The important thing is to provide the method with what it is expecting or is set up to handle. Here it is important to determine to the method it is being provided with an array reference rather than an expanded list. As it will determine whether the list is going to be concatenated and used as content as in the case where the array actual is used and ends up as one chunk in the div, or split into the lists components and then used as content, where the ref is used and creates the individual divs.

The square brackets provide the method with an anonymous array built from the list provided in the array, whereas the reference to the array provides, a reference to the array. Providing the reference being the more efficient way to move the data through.

I think that building an anonymous array out of a named array (what I did by adding square brackets)is probably more expensive than needs be, but was a workaround to get the desired result.

Basically if you provide the array as a reference, the method does the foreach for you. But you have to inspect each method via the docs to determine what each will or wont accept. There can be differnces in output depending on which markup or version you are using and such.

To note, while hacking through this I noticed that closed div beginning elements were produced which is some effect of the code being processed for xhtml and not html, hence the start_div/end_div in the foreach statement to explicitly inform cgi what I wanted. This also prevented the divs being built recursively within themselves without any closing elements.


In reply to Re^2: Calling functions in middle of CGI HTML declarations by Don Coyote
in thread Calling functions in middle of CGI HTML declarations by dr.jekyllandme

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 imbibing at the Monastery: (4)
As of 2024-04-16 04:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found