I found an example on the net that works. (I renumbered the source to shorten response).
However can someone post an example where you don't have to go through the intermediate step of reading from a file? Instead of $parser->parse_file($file) do a $parser->parse_text($html). Where $html comes from a LWP::Simple get call and parse_text($html) I made up.
Are there any alternatives to using parse_text?
1 #!/usr/bin/perl -w 2 package Example; 3 use strict; 4 5 require HTML::Parser; 6 7 @Example::ISA = qw(HTML::Parser); 8 my $parser = Example->new; 9 $parser->parse_file('index.html'); 10 11 print $parser->{TEXT}; 12 13 sub text 14 { 15 my ($self,$text) = @_; 16 $self->{TEXT} .= $text; 17 }

In reply to Re: How to strip HTML using latest module by f0dder
in thread How to strip HTML using latest module by f0dder

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.