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

Re: Properly indented using HTML::Tiny

by herveus (Prior)
on Oct 20, 2009 at 11:59 UTC ( [id://802201]=note: print w/replies, xml ) Need Help??


in reply to Properly indented using HTML::Tiny

Howdy!

What do *you* mean when you say "properly indented"? The output you present appears to have line breaks in appropriate places, but even those are not a formal requirement.

You allude to an example in the POD; it would be helpful if you had included it to show us what you were expecting.

Perhaps the lack of indentation is part and parcel of being "simple and lightweight".

yours,
Michael

Replies are listed 'Best First'.
Re^2: Properly indented using HTML::Tiny
by SnowWolf75 (Initiate) on Oct 21, 2009 at 22:52 UTC
    When I started my foray into coding, I picked up from somewhere that tags should be indented with a tree-like structure for readability. The output of the code snippet I allude to ( http://search.cpan.org/dist/HTML-Tiny/lib/HTML/Tiny.pm ) shows such indenting - tags that enclose other tags create an indent while sibling tags are at the same indent level - which is where my confusion and/or frustration came from. To me, the phrasing in the POD said I would get that indenting.

    The solution I found was to write my own functions - ti(), to(), and te() - to indent, 'out-dent', and 'equal-dent' the output by means of a global indent level variable. Putting these at the beginning of the line, or sometimes inside the HTML::Tiny autotags, created a nice flowing structure, at least to me. I know that there aren't hard standards for writing the HTML, but I prefer legibility over compactness more times. (likely why I've never gotten the hang of reading/writing obfuscated code)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://802201]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (9)
As of 2024-03-28 18:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found