in reply to HTML::Parser Skip Style Content

Set a flag when you hit a style start tag, and unset it when you hit the end tag. Then in the text handler (and any other handler where you might print), just return if the flag is set.

Update: This would not work if there are nested style tags. In that case, use an array as a stack for your "flag", and push a value on it on every style start tag, pop when you hit the end tag. As long as the array contains anything, you're inside style tags.

Replies are listed 'Best First'.
Re^2: HTML::Parser Skip Style Content
by almut (Canon) on Mar 09, 2010 at 21:07 UTC
    In that case, use an array as a stack for your "flag"...

    Wouldn't incrementing/decrementing a simple scalar serve the same purpose (indicating the level of nestedness — similarly to counting opening/closing parentheses)?

      Um, yeah, that'd work too. And is simpler. 8-)

        Thanks guys! I'll give those a try ...