Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

What kind of arbitrary perl data structures are you trying to render (they are not all created equal)? Are you looking for something quick and dirty for debugging purposes? Or more stable for UI purposes? Is there an issue with using Javascript (you seem to imply that with the Data::TreeDumper::Renderer::DHTML comment)? Do you really want it in HTML, or do you just need to see it in the browser? I ask these questions because there are a number of ways you could do this.

If you have an array of hashes, a few scalars and want a nice UI, you could very easily use HTML::Template.

If you need to see your structure for debugging purposes, then the output of Data::Dumper wrapped in a PRE tag is usually sufficient (IMO of course).

If this is for a UI, is it really an arbitrary data-structure? I would expect that there is some consistency and logic to it if it is meant to be displayed in a UI, otherwise you might want to rethink your UI (IMO consitency is a major factor in the usability of a UI).

The more details you provide, the better we can answer your question.


In reply to Re: Printing data structures as HTML by stvn
in thread Printing data structures as HTML by sutch

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

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others surveying the Monastery: (3)
    As of 2018-02-26 02:28 GMT
    Find Nodes?
      Voting Booth?
      When it is dark outside I am happiest to see ...

      Results (316 votes). Check out past polls.