Do you know where your variables are? | |
PerlMonks |
Re: Rebuilding changed tags with HTML::TokeParserby Ovid (Cardinal) |
on Dec 13, 2002 at 23:37 UTC ( [id://219779]=note: print w/replies, xml ) | Need Help?? |
Use HTML::TokeParser::Simple. First, I designed it to be a drop-in replacement, so you could use the module without any changes in your code except for the use statement and the constructor call. Then, as you refactor, you use the module to 'clean up' the nasty bits. The following is untested and assumes that the token is from HTML::TokeParser::Simple. It also requires the latest version because the "as_is" method is new.
My version will also preserve the attribute sequence. Also note the the token, as mentioned, is still an array reference, so you can access them if you must, or do everything simpler by using the supplied methods. Since the token data is also the instance data, if you change the arrayref's data directly, you are also changing the instance data, which is why the above code still work. Hmm... this gives me more ideas of what could be included in the module. Cheers, New address of my CGI Course.
In Section
Seekers of Perl Wisdom
|
|