W
weston
In an article on Stonehenge.com on using libxml2 to strip html from a
document, I came across a part of the listing that I'm having trouble
understanding. Randall apparently creates a hash of approved tags and
their attributes with these lines:
=9= my %PERMITTED =
=10= map { my($k, @v) = split; ($k, {map {$_, 1} @v}) }
=11= split /\n/, <<'END';
=12= a href name target class title
=13= b
=14= big
=15= blockquote class
....
=49= END
(See http://www.stonehenge.com/merlyn/PerlJournal/col02.html )
I keep trying to parse line 10 in my head and am not getting a lot of
mental traction in really understanding how this works. Anybody want to
help?
document, I came across a part of the listing that I'm having trouble
understanding. Randall apparently creates a hash of approved tags and
their attributes with these lines:
=9= my %PERMITTED =
=10= map { my($k, @v) = split; ($k, {map {$_, 1} @v}) }
=11= split /\n/, <<'END';
=12= a href name target class title
=13= b
=14= big
=15= blockquote class
....
=49= END
(See http://www.stonehenge.com/merlyn/PerlJournal/col02.html )
I keep trying to parse line 10 in my head and am not getting a lot of
mental traction in really understanding how this works. Anybody want to
help?