As these these modules are written, the new() takes some rules as to what tags/attributes are and aren't allowed and turns them into a list of allowed tags/attributes.

So far so good.

But I'm not seeing where massaging the rules about allowed and denied tags and attributes generates a win except it might make the checking easier to write.

The algorithm for filtering against the rules will still boil down to:

1. get a token which is either html markup or text. stop when none are left. 2. it the token is text, add it to the output 2. drop the tag if it's not allowed 3. drop each attibute not allowed 4. repeat

With a linear problem, I don't see what maintaining state wins for me unless the object accumulates a result for me as I intermittently obtain text to feed it with. Which I admit could be useful, but just not the way I've been programming.

UPDATE: actually, just as important issue than linearity in the sense above is the fact that there's only one thing to do with the object, and when you've done it, it's useful life is over.


In reply to Re: Re: Cleaning up HTML tags by cleverett
in thread Cleaning up HTML tags by cleverett

Title:
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, details, 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, summary, 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.