.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Parser 3pm" .TH Parser 3pm "2021-01-03" "perl v5.32.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" HTML::StripScripts::Parser \- XSS filter using HTML::Parser .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use HTML::StripScripts::Parser(); \& \& my $hss = HTML::StripScripts::Parser\->new( \& \& { \& Context => \*(AqDocument\*(Aq, ## HTML::StripScripts configuration \& Rules => { ... }, \& }, \& \& strict_comment => 1, ## HTML::Parser options \& strict_names => 1, \& \& ); \& \& $hss\->parse_file("foo.html"); \& \& print $hss\->filtered_document; \& \& OR \& \& print $hss\->filter_html($html); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This class provides an easy interface to \f(CW\*(C`HTML::StripScripts\*(C'\fR, using \&\f(CW\*(C`HTML::Parser\*(C'\fR to parse the \s-1HTML.\s0 .PP See HTML::Parser for details of how to customise how the raw \s-1HTML\s0 is parsed into tags, and HTML::StripScripts for details of how to customise the way those tags are filtered. .SH "CONSTRUCTORS" .IX Header "CONSTRUCTORS" .IP "new ( {\s-1CONFIG\s0}, [\s-1PARSER_OPTIONS\s0] )" 4 .IX Item "new ( {CONFIG}, [PARSER_OPTIONS] )" Creates a new \f(CW\*(C`HTML::StripScripts::Parser\*(C'\fR object. .Sp The \s-1CONFIG\s0 parameter has the same semantics as the \s-1CONFIG\s0 parameter to the \f(CW\*(C`HTML::StripScripts\*(C'\fR constructor. .Sp Any \s-1PARSER_OPTIONS\s0 supplied will be passed on to the HTML::Parser init method, allowing you to influence the way the input is parsed. .Sp You cannot use \s-1PARSER_OPTIONS\s0 to set the \f(CW\*(C`HTML::Parser\*(C'\fR event handlers (see \*(L"Events\*(R" in HTML::Parser) since \f(CW\*(C`HTML::StripScripts::Parser\*(C'\fR uses all of the event hooks itself. However, you can use \f(CW\*(C`Rules\*(C'\fR (see \*(L"Rules\*(R" in HTML::StripScripts) to customise the handling of all tags and attributes. .SH "METHODS" .IX Header "METHODS" See HTML::Parser for input methods, HTML::StripScripts for output methods. .ie n .SS """filter_html()""" .el .SS "\f(CWfilter_html()\fP" .IX Subsection "filter_html()" \&\f(CW\*(C`filter_html()\*(C'\fR is a convenience method for filtering \s-1HTML\s0 already loaded into a scalar variable. It combines calls to \f(CW\*(C`HTML::Parser::parse()\*(C'\fR, \&\f(CW\*(C`HTML::Parser::eof()\*(C'\fR and \f(CW\*(C`HTML::StripScripts::filtered_document()\*(C'\fR. .PP .Vb 1 \& $filtered_html = $hss\->filter_html($html); .Ve .SH "SUBCLASSING" .IX Header "SUBCLASSING" The \f(CW\*(C`HTML::StripScripts::Parser\*(C'\fR class is subclassable. Filter objects are plain hashes. The \fBhss_init()\fR method takes the same arguments as \&\fBnew()\fR, and calls the initialization methods of both \f(CW\*(C`HTML::StripScripts\*(C'\fR and \f(CW\*(C`HTML::Parser\*(C'\fR. .PP See \*(L"\s-1SUBCLASSING\*(R"\s0 in HTML::StripScripts and \*(L"\s-1SUBCLASSING\*(R"\s0 in HTML::Parser. .SH "SEE ALSO" .IX Header "SEE ALSO" HTML::StripScripts, HTML::Parser, HTML::StripScripts::LibXML .SH "BUGS" .IX Header "BUGS" None reported. .PP Please report any bugs or feature requests to bug\-html\-stripscripts\-parser@rt.cpan.org, or through the web interface at . .SH "AUTHOR" .IX Header "AUTHOR" Original author Nick Cleaton .PP New code added and module maintained by Clinton Gormley .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (C) 2003 Nick Cleaton. All Rights Reserved. .PP Copyright (C) 2007 Clinton Gormley. All Rights Reserved. .SH "LICENSE" .IX Header "LICENSE" This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.