kêàÑ}·:Ñ}·:ÿÿÿby nameby named kê^ '¤�[Ð}·:Ñ}·:Ñ}·:!$° [./lpp_nameó/¤�4 R I freeware.perl.html.parser { freeware.perl.html.parser.rte 03.13.0000.0000 01 N U en_US Perl HTML Parser module [ >0 { *prereq freeware.perl.rte 5.6.0.1 *prereq perl.rte 5.5.3.0 } *prereq freeware.perl.html.tagset.rte 3.3.0.0 % /usr 6 /usr/local 4 /usr/local/man 2 /usr/local/man/man3 149 /usr/local/lib 2 /usr/local/lib/HTML-Parser-3.13 65 /usr/local/lib/HTML-Parser-3.13/t 123 /usr/local/lib/HTML-Parser-3.13/eg 19 /usr/lpp 2 /usr/lpp/freeware.perl.html.parser /usr/opt 2 /usr/opt/perl5 2 /usr/opt/perl5/lib 2 /usr/opt/perl5/lib/site_perl 2 /usr/opt/perl5/lib/site_perl/5.005 2 /usr/opt/perl5/lib/site_perl/5.005/aix 4 /usr/opt/perl5/lib/site_perl/5.005/aix/auto 2 /usr/opt/perl5/lib/site_perl/5.005/aix/auto/HTML 2 /usr/opt/perl5/lib/site_perl/5.005/aix/auto/HTML/Parser 116 /usr/opt/perl5/lib/site_perl/5.005/aix/HTML 127 INSTWORK 62 62 % % % % ] } kêRò†íAÈ}·:Ï}·:Ï}·:!0?4./usr/lpp/freeware.perl.html.parseró/íA kêÀÛ†¤�ÎuÏ}·:Ï}·:Ï}·:! ¨$Îu./usr/lpp/freeware.perl.html.parser/liblpp.aó/¤� 29624 0 0 128 26460 0 3234 3508 0 985103815 0 0 644 32 freeware.perl.html.parser.rte.al` ./usr/local/man/man3/HTML__Filter.3 ./usr/local/man/man3/HTML__HeadParser.3 ./usr/local/man/man3/HTML__LinkExtor.3 ./usr/local/man/man3/HTML__Parser.3 ./usr/local/man/man3/HTML__TokeParser.3 ./usr/local/man/man3/HTML__Entities.3 ./usr/local/lib/HTML-Parser-3.13/Changes ./usr/local/lib/HTML-Parser-3.13/MANIFEST ./usr/local/lib/HTML-Parser-3.13/README ./usr/local/lib/HTML-Parser-3.13/ANNOUNCEMENT ./usr/local/lib/HTML-Parser-3.13/TODO ./usr/local/lib/HTML-Parser-3.13/mkhctype ./usr/local/lib/HTML-Parser-3.13/mkpfunc ./usr/local/lib/HTML-Parser-3.13/t/xml-mode.t ./usr/local/lib/HTML-Parser-3.13/t/filter.t ./usr/local/lib/HTML-Parser-3.13/t/tokeparser.t ./usr/local/lib/HTML-Parser-3.13/t/linkextor-rel.t ./usr/local/lib/HTML-Parser-3.13/t/linkextor-base.t ./usr/local/lib/HTML-Parser-3.13/t/crashme.t ./usr/local/lib/HTML-Parser-3.13/t/default.t ./usr/local/lib/HTML-Parser-3.13/t/headparser.t ./usr/local/lib/HTML-Parser-3.13/t/handler-eof.t ./usr/local/lib/HTML-Parser-3.13/t/uentities.t ./usr/local/lib/HTML-Parser-3.13/t/argspec-bad.t ./usr/local/lib/HTML-Parser-3.13/t/headparser-http.t ./usr/local/lib/HTML-Parser-3.13/t/dtext.t ./usr/local/lib/HTML-Parser-3.13/t/magic.t ./usr/local/lib/HTML-Parser-3.13/t/options.t ./usr/local/lib/HTML-Parser-3.13/t/entities.t ./usr/local/lib/HTML-Parser-3.13/t/largetags.t ./usr/local/lib/HTML-Parser-3.13/t/ignore.t ./usr/local/lib/HTML-Parser-3.13/t/argspec.t ./usr/local/lib/HTML-Parser-3.13/t/comment.t ./usr/local/lib/HTML-Parser-3.13/t/declaration.t ./usr/local/lib/HTML-Parser-3.13/t/unbroken-text.t ./usr/local/lib/HTML-Parser-3.13/t/offset.t ./usr/local/lib/HTML-Parser-3.13/t/handler.t ./usr/local/lib/HTML-Parser-3.13/t/api_version.t ./usr/local/lib/HTML-Parser-3.13/t/parsefile.t ./usr/local/lib/HTML-Parser-3.13/t/parser.t ./usr/local/lib/HTML-Parser-3.13/t/process.t ./usr/local/lib/HTML-Parser-3.13/t/cases.t ./usr/local/lib/HTML-Parser-3.13/t/marked-sect.t ./usr/local/lib/HTML-Parser-3.13/eg/hstrip ./usr/local/lib/HTML-Parser-3.13/eg/hrefsub ./usr/local/lib/HTML-Parser-3.13/eg/hanchors ./usr/local/lib/HTML-Parser-3.13/eg/htextsub ./usr/local/lib/HTML-Parser-3.13/eg/htext ./usr/local/lib/HTML-Parser-3.13/eg/htitle ./usr/opt/perl5/lib/site_perl/5.005/aix/auto/HTML/Parser/Parser.so ./usr/opt/perl5/lib/site_perl/5.005/aix/auto/HTML/Parser/Parser.bs ./usr/opt/perl5/lib/site_perl/5.005/aix/auto/HTML/Parser/.packlist ./usr/opt/perl5/lib/site_perl/5.005/aix/HTML/Parser.pm ./usr/opt/perl5/lib/site_perl/5.005/aix/HTML/Entities.pm ./usr/opt/perl5/lib/site_perl/5.005/aix/HTML/Filter.pm ./usr/opt/perl5/lib/site_perl/5.005/aix/HTML/HeadParser.pm ./usr/opt/perl5/lib/site_perl/5.005/aix/HTML/TokeParser.pm ./usr/opt/perl5/lib/site_perl/5.005/aix/HTML/LinkExtor.pm ./usr/local ./usr/local/man ./usr/local/man/man3 ./usr/local/lib ./usr/local/lib/HTML-Parser-3.13 ./usr/local/lib/HTML-Parser-3.13/t ./usr/local/lib/HTML-Parser-3.13/eg ./usr/opt/perl5 ./usr/opt/perl5/lib ./usr/opt/perl5/lib/site_perl ./usr/opt/perl5/lib/site_perl/5.005 ./usr/opt/perl5/lib/site_perl/5.005/aix ./usr/opt/perl5/lib/site_perl/5.005/aix/auto ./usr/opt/perl5/lib/site_perl/5.005/aix/auto/HTML ./usr/opt/perl5/lib/site_perl/5.005/aix/auto/HTML/Parser ./usr/opt/perl5/lib/site_perl/5.005/aix/HTML 1307 4970 128 975505796 0 0 644 39 freeware.perl.html.parser.rte.copyright` Perl HTML Parser Module, version 3.13 Copyright 1999-2000, Gisle Aas. Copyright 1999-2000, Michael A. Chase. All rights reserved. Plaese refer to the README file delivered in the directory /usr/local/lib/HTML-Parser-3.13 for complete details. The other files delivered in the same directory should also be read. Packaging is Copyright (C) 2000 BULL SA. This LPP shall not be redistributed commercially. Software, information and material distributed as freeware or shareware (hereinafter the "Materials") are provided "as is", without warranty of any kind. Bull and its suppliers disclaim all warranties whether expressed or implied, including, but not limited to the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of the Materials is with you. Neither Bull nor its suppliers warrant that the functions contained in the Materials will meet your requirements or that the Materials will be error free. Bull and its suppliers shall in no event be liable for direct or indirect damage caused to the User or to third parties by use of the Materials, whether in an action of contract, negligence or other tortious action, arising out of or in connection with the use or performance of the Materials. 13890 19014 3508 985103823 0 0 644 39 freeware.perl.html.parser.rte.inventory` /usr/local/man/man3/HTML__Filter.3: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 6776 checksum = "59559 7 " /usr/local/man/man3/HTML__HeadParser.3: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 7705 checksum = "16863 8 " /usr/local/man/man3/HTML__LinkExtor.3: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 7600 checksum = "46229 8 " /usr/local/man/man3/HTML__Parser.3: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 34892 checksum = "01925 35 " /usr/local/man/man3/HTML__TokeParser.3: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 10104 checksum = "13219 10 " /usr/local/man/man3/HTML__Entities.3: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 6168 checksum = "09989 7 " /usr/local/lib/HTML-Parser-3.13/Changes: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 18132 checksum = "26780 18 " /usr/local/lib/HTML-Parser-3.13/MANIFEST: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 2483 checksum = "36547 3 " /usr/local/lib/HTML-Parser-3.13/README: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 1906 checksum = "21331 2 " /usr/local/lib/HTML-Parser-3.13/ANNOUNCEMENT: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 2068 checksum = "24152 3 " /usr/local/lib/HTML-Parser-3.13/TODO: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 1087 checksum = "37295 2 " /usr/local/lib/HTML-Parser-3.13/mkhctype: owner = root group = system mode = 755 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 1331 checksum = "30231 2 " /usr/local/lib/HTML-Parser-3.13/mkpfunc: owner = root group = system mode = 755 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 595 checksum = "28030 1 " /usr/local/lib/HTML-Parser-3.13/t/xml-mode.t: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 2125 checksum = "45314 3 " /usr/local/lib/HTML-Parser-3.13/t/filter.t: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 945 checksum = "27508 1 " /usr/local/lib/HTML-Parser-3.13/t/tokeparser.t: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 2701 checksum = "27506 3 " /usr/local/lib/HTML-Parser-3.13/t/linkextor-rel.t: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 970 checksum = "27863 1 " /usr/local/lib/HTML-Parser-3.13/t/linkextor-base.t: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 1057 checksum = "40507 2 " /usr/local/lib/HTML-Parser-3.13/t/crashme.t: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 774 checksum = "43897 1 " /usr/local/lib/HTML-Parser-3.13/t/default.t: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 864 checksum = "54505 1 " /usr/local/lib/HTML-Parser-3.13/t/headparser.t: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 2899 checksum = "26310 3 " /usr/local/lib/HTML-Parser-3.13/t/handler-eof.t: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 655 checksum = "07113 1 " /usr/local/lib/HTML-Parser-3.13/t/uentities.t: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 1952 checksum = "45142 2 " /usr/local/lib/HTML-Parser-3.13/t/argspec-bad.t: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 1047 checksum = "20138 2 " /usr/local/lib/HTML-Parser-3.13/t/headparser-http.t: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 484 checksum = "15308 1 " /usr/local/lib/HTML-Parser-3.13/t/dtext.t: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 988 checksum = "10190 1 " /usr/local/lib/HTML-Parser-3.13/t/magic.t: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 989 checksum = "12018 1 " /usr/local/lib/HTML-Parser-3.13/t/options.t: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 919 checksum = "15212 1 " /usr/local/lib/HTML-Parser-3.13/t/entities.t: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 8585 checksum = "51278 9 " /usr/local/lib/HTML-Parser-3.13/t/largetags.t: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 735 checksum = "31667 1 " /usr/local/lib/HTML-Parser-3.13/t/ignore.t: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 600 checksum = "10183 1 " /usr/local/lib/HTML-Parser-3.13/t/argspec.t: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 3424 checksum = "53592 4 " /usr/local/lib/HTML-Parser-3.13/t/comment.t: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 457 checksum = "19173 1 " /usr/local/lib/HTML-Parser-3.13/t/declaration.t: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 769 checksum = "28729 1 " /usr/local/lib/HTML-Parser-3.13/t/unbroken-text.t: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 1115 checksum = "31514 2 " /usr/local/lib/HTML-Parser-3.13/t/offset.t: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 825 checksum = "13921 1 " /usr/local/lib/HTML-Parser-3.13/t/handler.t: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 1398 checksum = "18652 2 " /usr/local/lib/HTML-Parser-3.13/t/api_version.t: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 368 checksum = "33605 1 " /usr/local/lib/HTML-Parser-3.13/t/parsefile.t: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 1112 checksum = "19462 2 " /usr/local/lib/HTML-Parser-3.13/t/parser.t: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 3805 checksum = "23584 4 " /usr/local/lib/HTML-Parser-3.13/t/process.t: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 851 checksum = "20885 1 " /usr/local/lib/HTML-Parser-3.13/t/cases.t: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 2992 checksum = "27532 3 " /usr/local/lib/HTML-Parser-3.13/t/marked-sect.t: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 1601 checksum = "03856 2 " /usr/local/lib/HTML-Parser-3.13/eg/hstrip: owner = root group = system mode = 755 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 1957 checksum = "06158 2 " /usr/local/lib/HTML-Parser-3.13/eg/hrefsub: owner = root group = system mode = 755 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 2263 checksum = "47841 3 " /usr/local/lib/HTML-Parser-3.13/eg/hanchors: owner = root group = system mode = 755 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 1084 checksum = "57724 2 " /usr/local/lib/HTML-Parser-3.13/eg/htextsub: owner = root group = system mode = 755 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 580 checksum = "48365 1 " /usr/local/lib/HTML-Parser-3.13/eg/htext: owner = root group = system mode = 755 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 548 checksum = "12087 1 " /usr/local/lib/HTML-Parser-3.13/eg/htitle: owner = root group = system mode = 755 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 506 checksum = "16015 1 " /usr/opt/perl5/lib/site_perl/5.005/aix/auto/HTML/Parser/Parser.so: owner = root group = system mode = 555 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 57627 checksum = "03288 57 " /usr/opt/perl5/lib/site_perl/5.005/aix/auto/HTML/Parser/Parser.bs: owner = root group = system mode = 444 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 0 checksum = "00000 0 " /usr/opt/perl5/lib/site_perl/5.005/aix/auto/HTML/Parser/.packlist: owner = root group = system mode = 644 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 469 checksum = "51804 1 " /usr/opt/perl5/lib/site_perl/5.005/aix/HTML/Parser.pm: owner = root group = system mode = 444 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 28664 checksum = "39768 28 " /usr/opt/perl5/lib/site_perl/5.005/aix/HTML/Entities.pm: owner = root group = system mode = 444 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 11247 checksum = "64340 11 " /usr/opt/perl5/lib/site_perl/5.005/aix/HTML/Filter.pm: owner = root group = system mode = 444 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 2686 checksum = "58333 3 " /usr/opt/perl5/lib/site_perl/5.005/aix/HTML/HeadParser.pm: owner = root group = system mode = 444 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 6212 checksum = "46421 7 " /usr/opt/perl5/lib/site_perl/5.005/aix/HTML/TokeParser.pm: owner = root group = system mode = 444 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 8813 checksum = "45721 9 " /usr/opt/perl5/lib/site_perl/5.005/aix/HTML/LinkExtor.pm: owner = root group = system mode = 444 type = FILE class = apply,inventory,freeware.perl.html.parser.rte size = 4428 checksum = "47654 5 " /usr/local: owner = bin group = bin mode = 755 type = DIRECTORY class = apply,inventory,freeware.perl.html.parser.rte /usr/local/man: owner = root group = system mode = 755 type = DIRECTORY class = apply,inventory,freeware.perl.html.parser.rte /usr/local/man/man3: owner = root group = system mode = 755 type = DIRECTORY class = apply,inventory,freeware.perl.html.parser.rte /usr/local/lib: owner = root group = system mode = 755 type = DIRECTORY class = apply,inventory,freeware.perl.html.parser.rte /usr/local/lib/HTML-Parser-3.13: owner = root group = system mode = 755 type = DIRECTORY class = apply,inventory,freeware.perl.html.parser.rte /usr/local/lib/HTML-Parser-3.13/t: owner = root group = system mode = 755 type = DIRECTORY class = apply,inventory,freeware.perl.html.parser.rte /usr/local/lib/HTML-Parser-3.13/eg: owner = root group = system mode = 755 type = DIRECTORY class = apply,inventory,freeware.perl.html.parser.rte /usr/opt/perl5: owner = root group = system mode = 755 type = DIRECTORY class = apply,inventory,freeware.perl.html.parser.rte /usr/opt/perl5/lib: owner = root group = system mode = 755 type = DIRECTORY class = apply,inventory,freeware.perl.html.parser.rte /usr/opt/perl5/lib/site_perl: owner = root group = system mode = 755 type = DIRECTORY class = apply,inventory,freeware.perl.html.parser.rte /usr/opt/perl5/lib/site_perl/5.005: owner = root group = system mode = 755 type = DIRECTORY class = apply,inventory,freeware.perl.html.parser.rte /usr/opt/perl5/lib/site_perl/5.005/aix: owner = root group = system mode = 755 type = DIRECTORY class = apply,inventory,freeware.perl.html.parser.rte /usr/opt/perl5/lib/site_perl/5.005/aix/auto: owner = root group = system mode = 755 type = DIRECTORY class = apply,inventory,freeware.perl.html.parser.rte /usr/opt/perl5/lib/site_perl/5.005/aix/auto/HTML: owner = root group = system mode = 755 type = DIRECTORY class = apply,inventory,freeware.perl.html.parser.rte /usr/opt/perl5/lib/site_perl/5.005/aix/auto/HTML/Parser: owner = root group = system mode = 755 type = DIRECTORY class = apply,inventory,freeware.perl.html.parser.rte /usr/opt/perl5/lib/site_perl/5.005/aix/HTML: owner = root group = system mode = 755 type = DIRECTORY class = apply,inventory,freeware.perl.html.parser.rte 2818 21982 4970 975505908 0 0 755 36 freeware.perl.html.parser.rte.post_i` #!/usr/bin/ksh LANG=C VERBOSE=${VERBOSE:-"0"} # simple debug system appname="${0##*/}" # $(basename $0) # Pre- and Post install template scripts # Copyright (C) 2000 GROUPE BULL # all rights reserved. # # author: Ciaran Deignan (Ciaran.Deignan@bull.net) # started: July 1997, last modified July 2000 # version: 2.0 #------------------------------------------------------------------ # GLOBAL UTILITIES #------------------------------------------------------------------ # Debug message print function (v1.0 - July 1998) debug() { integer lev=$1 shift [ $VERBOSE -ge $lev ] && print -- "$@" >&2 return 0 } # error handler (v2.1 - July 1998): cmd() { debug 7 "CMD: execute '$@'" eval '"$@"' [ $? -ne 0 ] && debug 0 "$appname: CMD: error detected in '$@'" \ && exit 2 } typeset -xf cmd debug [ $VERBOSE -gt 9 ] && set -x #------------------------------------------------------------------ debug 2 "$appname: starting execution, params <$*>"; # Function to update the file /usr/local/info/dir # This function should be used if the LPP delivers files into # /usr/local/info # NOTE: the file /usr/local/info/dir should *never* be delivered directly... update_info_dir() { if ! [ -d /usr/local/info ] then debug 1 "No info directory found !" debug 1 "stopping" return 0 fi if type gen-dir-node >/dev/null 2>&1 then print "Updating info \"root\" file (/usr/local/info/dir)" cmd cd /usr/local/info [ -f dir ] && cmd mv dir dir.bak cmd gen-dir-node /usr/local/info/ > dir cmd chmod 444 dir fi } # Perl module update function... update_perllocal () { if [ "$PERLLIB" = "" ] || [ ! -d "$PERLLIB" ] then print "update_perllocal: PERLLIB not defined (=$PERLLIB)" return 0 fi archdir=${archdir:-"aix"} # the directory /usr/local/lib/perl5/ ($PERLLIB) should exist, or might # be a symbolic link to /usr/opt/perl5/lib.... if ! cd $PERLLIB/. then print "Perl not installed correctly, can't find directory" print "$PERLLIB" exit 1 fi if ! ls */$archdir/perllocal.pod > /dev/null 2>&1 then filename=$(ls -td 5.*/$archdir | line) if [ "$filename" = "" ] then cmd print "Perl not installed correctly, can't find \c" cmd print "directory $PERLLIB/5.00*/$archdir" exit 3 fi filename="$filename/perllocal.pod" else filename=$(cmd ls -t */$archdir/perllocal.pod | line) fi # use a "hello-script" to add info to perllocal.pod.... cmd cat >>$filename < L =over 4 =item * C =item * C =item * C =item * C =back MODULEINFO } #PERLLIB=/usr/local/lib/perl5/ PERLLIB=/usr/opt/perl5/lib/ #archdir=ia64-aix update_perllocal exit 0 3560 25692 19014 985103813 0 0 755 35 freeware.perl.html.parser.rte.pre_i` #!/usr/bin/ksh LANG=C VERBOSE=${VERBOSE:-"0"} # simple debug system appname="${0##*/}" # $(basename $0) # Pre- and Post install template scripts # Copyright (C) 2000 GROUPE BULL # all rights reserved. # # author: Ciaran Deignan (Ciaran.Deignan@bull.net) # started: July 1997, last modified July 2000 # version: 2.0 #------------------------------------------------------------------ # GLOBAL UTILITIES #------------------------------------------------------------------ # Debug message print function (v1.0 - July 1998) debug() { integer lev=$1 shift [ $VERBOSE -ge $lev ] && print -- "$@" >&2 return 0 } # error handler (v2.1 - July 1998): cmd() { debug 7 "CMD: execute '$@'" eval '"$@"' [ $? -ne 0 ] && debug 0 "$appname: CMD: error detected in '$@'" \ && exit 2 } typeset -xf cmd debug [ $VERBOSE -gt 9 ] && set -x #------------------------------------------------------------------ debug 2 "$appname: starting execution, params <$*>"; slibclean # Function to allow perl modules compiled for a "freeware" (/usr/local) # perl to be installed on top of an "IBM" (/usr/opt/perl5) perl. make_perl_f2i_links() { # Clean up historic symbolic links if there's any... [ -h /usr/opt/perl5/lib ] && rm /usr/opt/perl5/lib # Make /usr/local/lib/perl5 be a symbolic link to IBM perl lib dir. if [ ! -e /usr/local/lib/perl5 ] && [ -d /usr/opt/perl5/lib ] then [ -d /usr/local/lib ] || cmd mkdir -p /usr/local/lib cmd ln -s /usr/opt/perl5/lib /usr/local/lib/perl5 fi if [ ! -e /usr/local/bin/perl ] && [ -e /usr/opt/perl5/bin/perl ] then [ -d /usr/local/bin ] || cmd mkdir /usr/local/bin cmd ln -s /usr/opt/perl5/bin/perl /usr/local/bin/perl fi } # Function to allow perl modules compiled for an "IBM" (/usr/opt/perl5) # perl to be installed on top of a "freeware" (/usr/local) perl. make_perl_i2f_links() { # Clean up historic symbolic links if there's any... [ -h /usr/local/lib/perl5 ] && rm /usr/local/lib/perl5 # Make /usr/opt/perl5/lib be a symbolic link to standard perl lib dir. if [ ! -e /usr/opt/perl5/lib ] && [ -d /usr/local/lib/perl5 ] then [ -d /usr/opt/perl5 ] || cmd mkdir -p /usr/opt/perl5 cmd ln -s /usr/local/lib/perl5 /usr/opt/perl5/lib elif [ ! -e /usr/opt/perl5/lib/5.00503 ] # If "lib" directory already exists, just make 5.00503 link... then cmd cd /usr/local/lib/perl5 if [ -d 5.6.0 ] then cmd ln -s /usr/local/lib/perl5/5.6.0 /usr/opt/perl5/lib/5.00503 elif [ -d 5.6.1 ] then cmd ln -s /usr/local/lib/perl5/5.6.1 /usr/opt/perl5/lib/5.00503 fi fi if [ ! -e /usr/opt/perl5/bin/perl ] && [ -e /usr/local/bin/perl ] then [ -d /usr/opt/perl5/bin ] || cmd mkdir /usr/opt/perl5/bin cmd ln -s /usr/local/bin/perl /usr/opt/perl5/bin/perl fi } mkgrp_usr() { if [ $# -ne 2 ] then debug 0 "Missing module-name parameter in remove_perllocal" debug 0 "can't remove module info from perllocal." return 1 fi user="$1"; group="$2" # First create new group... if ! lsgroup $group >/dev/null then print "making group '$group'" if ! mkgroup $group then print "Can't make group '$group'" print "Stopping" exit 2 fi else print "Group $group exists" fi if ! lsuser $user >/dev/null then echo "making user $user" if ! mkuser account_locked=true gecos="Automatic account" \ pgrp=$group login=false rlogin=false su=false \ sugroups="" $user then echo "Can't create user '$user'" echo "Stopping" exit 2 fi else echo "User $user exists" fi } make_perl_i2f_links exit 0 619 26460 21982 985103817 0 0 644 34 freeware.perl.html.parser.rte.size` ./usr 6 ./usr/local 4 ./usr/local/man 2 ./usr/local/man/man3 149 ./usr/local/lib 2 ./usr/local/lib/HTML-Parser-3.13 65 ./usr/local/lib/HTML-Parser-3.13/t 123 ./usr/local/lib/HTML-Parser-3.13/eg 19 ./usr/lpp 2 ./usr/lpp/freeware.perl.html.parser ./usr/opt 2 ./usr/opt/perl5 2 ./usr/opt/perl5/lib 2 ./usr/opt/perl5/lib/site_perl 2 ./usr/opt/perl5/lib/site_perl/5.005 2 ./usr/opt/perl5/lib/site_perl/5.005/aix 4 ./usr/opt/perl5/lib/site_perl/5.005/aix/auto 2 ./usr/opt/perl5/lib/site_perl/5.005/aix/auto/HTML 2 ./usr/opt/perl5/lib/site_perl/5.005/aix/auto/HTML/Parser 116 ./usr/opt/perl5/lib/site_perl/5.005/aix/HTML 127 3012 29624 25692 975505936 0 0 755 38 freeware.perl.html.parser.rte.unpost_i` #!/usr/bin/ksh LANG=C VERBOSE=${VERBOSE:-"0"} # simple debug system appname="${0##*/}" # $(basename $0) # Pre- and Post install template scripts # Copyright (C) 2000 GROUPE BULL # all rights reserved. # # author: Ciaran Deignan (Ciaran.Deignan@bull.net) # started: July 1997, last modified July 2000 # version: 2.0 #------------------------------------------------------------------ # GLOBAL UTILITIES #------------------------------------------------------------------ # Debug message print function (v1.0 - July 1998) debug() { integer lev=$1 shift [ $VERBOSE -ge $lev ] && print -- "$@" >&2 return 0 } # error handler (v2.1 - July 1998): cmd() { debug 7 "CMD: execute '$@'" eval '"$@"' [ $? -ne 0 ] && debug 0 "$appname: CMD: error detected in '$@'" \ && print exit 2 } typeset -xf cmd debug [ $VERBOSE -gt 9 ] && set -x #------------------------------------------------------------------ debug 2 "$appname: starting execution, params <$*>"; # Function to update the file /usr/local/info/dir # This function should be used if the LPP delivers files into # /usr/local/info # NOTE: the file /usr/local/info/dir should *never* be delivered directly... update_info_dir() { if ! [ -d /usr/local/info ] then debug 1 "No info directory found !" debug 1 "stopping" return 0 fi if type gen-dir-node >/dev/null 2>&1 then print "Updating info \"root\" file (/usr/local/info/dir)" cmd cd /usr/local/info [ -f dir ] && cmd mv dir dir.bak cmd gen-dir-node /usr/local/info/ > dir cmd chmod 444 dir fi } # Perl module update function... remove_perllocal () { if [ $# -ne 1 ] then debug 0 "Missing module-name parameter in remove_perllocal" debug 0 "can't remove module info from perllocal." return 0 fi modulename="$1" if [ "$PERLLIB" = "" ] || [ ! -d "$PERLLIB" ] then print "remove_perllocal: PERLLIB not defined (=$PERLLIB)" return 0 fi archdir=${archdir:-"aix"} # the directory /usr/local/lib/perl5/ ($PERLLIB) should exist, or might # be a symbolic link to /usr/opt/perl5/lib.... if ! cd $PERLLIB/. then print "Perl not installed correctly, can't find directory" print "$PERLLIB" exit 1 fi if ! ls */$archdir/perllocal.pod > /dev/null 2>&1 then filename=$(ls -td 5.*/$archdir | line) if [ "$filename" = "" ] then cmd print "Perl not installed correctly, can't find \c" cmd print "directory $PERLLIB/5.00*/$archdir" exit 3 fi filename="$filename/perllocal.pod" else filename=$(cmd ls -t */$archdir/perllocal.pod | line) fi # use a small perl script to remove the module info # (I hope this isn't too "wildcard"...) cmd perl -w -n -i.bak -e ' $line = $_; if (defined ($flag) && ($flag == 2)) { undef $flag ;} $flag=1 if $line =~ /^=head2\s+.*L<'"$modulename"'>/; print $line if !defined($flag); $flag=2 if $line =~ /^=back/;' $filename } #PERLLIB=/usr/local/lib/perl5/ PERLLIB=/usr/opt/perl5/lib/ #archdir=ia64-aix remove_perllocal "HTML::Parser" exit 0 420 0 26460 0 0 0 0 0 ` 7 128 3508 4970 19014 21982 25692 26460 freeware.perl.html.parser.rte.alfreeware.perl.html.parser.rte.copyrightfreeware.perl.html.parser.rte.inventoryfreeware.perl.html.parser.rte.post_ifreeware.perl.html.parser.rte.pre_ifreeware.perl.html.parser.rte.sizefreeware.perl.html.parser.rte.unpost_iew kêŽÉ¤�xÊ}·:rA%:�Õž:!$9x./usr/local/man/man3/HTML__Filter.3libló/¤�.rn '' }` ''' $RCSfile$$Revision$$Date$ ''' ''' $Log$ ''' .de Sh .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .de Sp .if t .sp .5v .if n .sp .. .de Ip .br .ie \\n(.$>=3 .ne \\$3 .el .ne 3 .IP "\\$1" \\$2 .. .de Vb .ft CW .nf .ne \\$1 .. .de Ve .ft R .fi .. ''' ''' ''' Set up \*(-- to give an unbreakable dash; ''' string Tr holds user defined translation string. ''' Bell System Logo is used as a dummy character. ''' .tr \(*W-|\(bv\*(Tr .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" "" ''' \*(M", \*(S", \*(N" and \*(T" are the equivalent of ''' \*(L" and \*(R", except that they are used on ".xx" lines, ''' such as .IP and .SH, which do another additional levels of ''' double-quote interpretation .ds M" """ .ds S" """ .ds N" """"" .ds T" """"" .ds L' ' .ds R' ' .ds M' ' .ds S' ' .ds N' ' .ds T' ' 'br\} .el\{\ .ds -- \(em\| .tr \*(Tr .ds L" `` .ds R" '' .ds M" `` .ds S" '' .ds N" `` .ds T" '' .ds L' ` .ds R' ' .ds M' ` .ds S' ' .ds N' ` .ds T' ' .ds PI \(*p 'br\} .\" If the F register is turned on, we'll generate .\" index entries out stderr for the following things: .\" TH Title .\" SH Header .\" Sh Subsection .\" Ip Item .\" X<> Xref (embedded .\" Of course, you have to process the output yourself .\" in some meaninful fashion. .if \nF \{ .de IX .tm Index:\\$1\t\\n%\t"\\$2" .. .nr % 0 .rr F .\} .TH lib::HTML::Filter 3 "perl 5.005, patch 03" "10/Dec/1999" "User Contributed Perl Documentation" .UC .if n .hy 0 .if n .na .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .de CQ \" put $1 in typewriter font .ft CW 'if n "\c 'if t \\&\\$1\c 'if n \\&\\$1\c 'if n \&" \\&\\$2 \\$3 \\$4 \\$5 \\$6 \\$7 '.ft R .. .\" @(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2 . \" AM - accent mark definitions .bd B 3 . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds ? ? . ds ! ! . ds / . ds q .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds ? \s-2c\h'-\w'c'u*7/10'\u\h'\*(#H'\zi\d\s+2\h'\w'c'u*8/10' . ds ! \s-2\(or\s+2\h'-\w'\(or'u'\v'-.8m'.\v'.8m' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' . ds q o\h'-\w'o'u*8/10'\s-4\v'.4m'\z\(*i\v'-.4m'\s+4\h'\w'o'u*8/10' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds v \\k:\h'-(\\n(.wu*9/10-\*(#H)'\v'-\*(#V'\*(#[\s-4v\s0\v'\*(#V'\h'|\\n:u'\*(#] .ds _ \\k:\h'-(\\n(.wu*9/10-\*(#H+(\*(#F*2/3))'\v'-.4m'\z\(hy\v'.4m'\h'|\\n:u' .ds . \\k:\h'-(\\n(.wu*8/10)'\v'\*(#V*4/10'\z.\v'-\*(#V*4/10'\h'|\\n:u' .ds 3 \*(#[\v'.2m'\s-2\&3\s0\v'-.2m'\*(#] .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E .ds oe o\h'-(\w'o'u*4/10)'e .ds Oe O\h'-(\w'O'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds v \h'-1'\o'\(aa\(ga' . ds _ \h'-1'^ . ds . \h'-1'. . ds 3 3 . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE . ds oe oe . ds Oe OE .\} .rm #[ #] #H #V #F C .SH "NAME" HTML::Filter \- Filter HTML text through the parser .SH "NOTE" This module is deprecated. \f(CWHTML::Parser\fR now provides the functionally of \f(CWHTML::Filter\fR much more efficiently with the the \f(CWdefault\fR handler. .SH "SYNOPSIS" .PP .Vb 2 \& require HTML::Filter; \& $p = HTML::Filter->new->parse_file("index.html"); .Ve .SH "DESCRIPTION" \f(CWHTML::Filter\fR is an HTML parser that by default prints the original text of each HTML element (a slow version of \fIcat\fR\|(1) basically). The callback methods may be overridden to modify the filtering for some HTML elements and you can override \fIoutput()\fR method which is called to print the HTML text. .PP \f(CWHTML::Filter\fR is a subclass of \f(CWHTML::Parser\fR. This means that the document should be given to the parser by calling the \f(CW$p\fR\->\fIparse()\fR or \f(CW$p\fR\->\fIparse_file()\fR methods. .SH "EXAMPLES" The first example is a filter that will remove all comments from an HTML file. This is achieved by simply overriding the comment method to do nothing. .PP .Vb 4 \& package CommentStripper; \& require HTML::Filter; \& @ISA=qw(HTML::Filter); \& sub comment { } # ignore comments .Ve The second example shows a filter that will remove any s found in the HTML file. We specialize the \fIstart()\fR and \fIend()\fR methods to count table tags and then make output not happen when inside a table. .PP .Vb 9 \& package TableStripper; \& require HTML::Filter; \& @ISA=qw(HTML::Filter); \& sub start \& { \& my $self = shift; \& $self->{table_seen}++ if $_[0] eq "table"; \& $self->SUPER::start(@_); \& } .Ve .Vb 6 \& sub end \& { \& my $self = shift; \& $self->SUPER::end(@_); \& $self->{table_seen}-- if $_[0] eq "table"; \& } .Ve .Vb 7 \& sub output \& { \& my $self = shift; \& unless ($self->{table_seen}) { \& $self->SUPER::output(@_); \& } \& } .Ve If you want to collect the parsed text internally you might want to do something like this: .PP .Vb 5 \& package FilterIntoString; \& require HTML::Filter; \& @ISA=qw(HTML::Filter); \& sub output { push(@{$_[0]->{fhtml}}, $_[1]) } \& sub filtered_html { join("", @{$_[0]->{fhtml}}) } .Ve .SH "SEE ALSO" the \fIHTML::Parser\fR manpage .SH "COPYRIGHT" Copyright 1997-1999 Gisle Aas. .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .rn }` '' .IX Title "lib::HTML::Filter 3" .IX Name "HTML::Filter - Filter HTML text through the parser" .IX Header "NAME" .IX Header "NOTE" .IX Header "SYNOPSIS" .IX Header "DESCRIPTION" .IX Header "EXAMPLES" .IX Header "SEE ALSO" .IX Header "COPYRIGHT" kê®Æ¤�Ê}·:rA%:‚Õž:!${./usr/local/man/man3/HTML__HeadParser.3ó/¤�.rn '' }` ''' $RCSfile$$Revision$$Date$ ''' ''' $Log$ ''' .de Sh .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .de Sp .if t .sp .5v .if n .sp .. .de Ip .br .ie \\n(.$>=3 .ne \\$3 .el .ne 3 .IP "\\$1" \\$2 .. .de Vb .ft CW .nf .ne \\$1 .. .de Ve .ft R .fi .. ''' ''' ''' Set up \*(-- to give an unbreakable dash; ''' string Tr holds user defined translation string. ''' Bell System Logo is used as a dummy character. ''' .tr \(*W-|\(bv\*(Tr .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" "" ''' \*(M", \*(S", \*(N" and \*(T" are the equivalent of ''' \*(L" and \*(R", except that they are used on ".xx" lines, ''' such as .IP and .SH, which do another additional levels of ''' double-quote interpretation .ds M" """ .ds S" """ .ds N" """"" .ds T" """"" .ds L' ' .ds R' ' .ds M' ' .ds S' ' .ds N' ' .ds T' ' 'br\} .el\{\ .ds -- \(em\| .tr \*(Tr .ds L" `` .ds R" '' .ds M" `` .ds S" '' .ds N" `` .ds T" '' .ds L' ` .ds R' ' .ds M' ` .ds S' ' .ds N' ` .ds T' ' .ds PI \(*p 'br\} .\" If the F register is turned on, we'll generate .\" index entries out stderr for the following things: .\" TH Title .\" SH Header .\" Sh Subsection .\" Ip Item .\" X<> Xref (embedded .\" Of course, you have to process the output yourself .\" in some meaninful fashion. .if \nF \{ .de IX .tm Index:\\$1\t\\n%\t"\\$2" .. .nr % 0 .rr F .\} .TH lib::HTML::HeadParser 3 "perl 5.005, patch 03" "9/Dec/1999" "User Contributed Perl Documentation" .UC .if n .hy 0 .if n .na .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .de CQ \" put $1 in typewriter font .ft CW 'if n "\c 'if t \\&\\$1\c 'if n \\&\\$1\c 'if n \&" \\&\\$2 \\$3 \\$4 \\$5 \\$6 \\$7 '.ft R .. .\" @(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2 . \" AM - accent mark definitions .bd B 3 . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds ? ? . ds ! ! . ds / . ds q .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds ? \s-2c\h'-\w'c'u*7/10'\u\h'\*(#H'\zi\d\s+2\h'\w'c'u*8/10' . ds ! \s-2\(or\s+2\h'-\w'\(or'u'\v'-.8m'.\v'.8m' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' . ds q o\h'-\w'o'u*8/10'\s-4\v'.4m'\z\(*i\v'-.4m'\s+4\h'\w'o'u*8/10' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds v \\k:\h'-(\\n(.wu*9/10-\*(#H)'\v'-\*(#V'\*(#[\s-4v\s0\v'\*(#V'\h'|\\n:u'\*(#] .ds _ \\k:\h'-(\\n(.wu*9/10-\*(#H+(\*(#F*2/3))'\v'-.4m'\z\(hy\v'.4m'\h'|\\n:u' .ds . \\k:\h'-(\\n(.wu*8/10)'\v'\*(#V*4/10'\z.\v'-\*(#V*4/10'\h'|\\n:u' .ds 3 \*(#[\v'.2m'\s-2\&3\s0\v'-.2m'\*(#] .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E .ds oe o\h'-(\w'o'u*4/10)'e .ds Oe O\h'-(\w'O'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds v \h'-1'\o'\(aa\(ga' . ds _ \h'-1'^ . ds . \h'-1'. . ds 3 3 . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE . ds oe oe . ds Oe OE .\} .rm #[ #] #H #V #F C .SH "NAME" HTML::HeadParser \- Parse section of a HTML document .SH "SYNOPSIS" .PP .Vb 3 \& require HTML::HeadParser; \& $p = HTML::HeadParser->new; \& $p->parse($text) and print "not finished"; .Ve .Vb 3 \& $p->header('Title') # to access .... \& $p->header('Content-Base') # to access \& $p->header('Foo') # to access .Ve .SH "DESCRIPTION" The \fIHTML::HeadParser\fR is a specialized (and lightweight) \fIHTML::Parser\fR that will only parse the ... section of an HTML document. The \fIparse()\fR method will return a FALSE value as soon as some element or body text are found, and should not be called again after this. .PP The \fIHTML::HeadParser\fR keeps a reference to a header object, and the parser will update this header object as the various elements of the section of the HTML document are recognized. The following header fields are affected: .Ip "Content-Base:" 4 The \fIContent-Base\fR header is initialized from the element. .Ip "Title:" 4 The \fITitle\fR header is initialized from the ... element. .Ip "Isindex:" 4 The \fIIsindex\fR header will be added if there is a element in the . The header value is initialized from the \fIprompt\fR attribute if it is present. If no \fIprompt\fR attribute is given it will have \*(L'?\*(R' as the value. .Ip "X\-Meta-Foo:" 4 All elements will initialize headers with the prefix \*(L"\f(CWX-Meta-\fR\*(R" on the name. If the element contains a \f(CWhttp-equiv\fR attribute, then it will be honored as the header name. .SH "METHODS" The following methods (in addition to those provided by the superclass) are available: .Ip "$hp = \s-1HTML::\s0HeadParser->new( [$header] )" 4 The object constructor. The optional \f(CW$header\fR argument should be a reference to an object that implement the \fIheader()\fR and \fIpush_header()\fR methods as defined by the \fI\s-1HTTP::\s0Headers\fR class. Normally it will be of some class that isa or delegates to the \fI\s-1HTTP::\s0Headers\fR class. .Sp If no \f(CW$header\fR is given \fI\s-1HTML::\s0HeadParser\fR will create an \fI\s-1HTTP::\s0Header\fR object by itself (initially empty). .Ip "$hp->header;" 4 Returns a reference to the header object. .Ip "$hp->header( $key )" 4 Returns a header value. It is just a shorter way to write \f(CW$hp->header->header($key)\fR. .SH "EXAMPLE" .Sp .Vb 9 \& $h = HTTP::Headers->new; \& $p = HTML::HeadParser->new($h); \& $p->parse(<Stupid example \& \& Normal text starts here. \& EOT \& undef $p; \& print $h->title; # should print "Stupid example" .Ve .SH "SEE ALSO" the \fIHTML::Parser\fR manpage, the \fIHTTP::Headers\fR manpage .Sp The \fIHTTP::Headers\fR class is distributed as part of the \fIlibwww-perl\fR package. .SH "COPYRIGHT" Copyright 1996-1999 Gisle Aas. All rights reserved. .Sp This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .rn }` '' .IX Title "lib::HTML::HeadParser 3" .IX Name "HTML::HeadParser - Parse section of a HTML document" .IX Header "NAME" .IX Header "SYNOPSIS" .IX Header "DESCRIPTION" .IX Item "Content-Base:" .IX Item "Title:" .IX Item "Isindex:" .IX Item "X\-Meta-Foo:" .IX Header "METHODS" .IX Item "$hp = \s-1HTML::\s0HeadParser->new( [$header] )" .IX Item "$hp->header;" .IX Item "$hp->header( $key )" .IX Header "EXAMPLE" .IX Header "SEE ALSO" .IX Header "COPYRIGHT" \w'O'u* kêø¤�°Ê}·:rA%:‚Õž:!$…°./usr/local/man/man3/HTML__LinkExtor.3ó/¤�.rn '' }` ''' $RCSfile$$Revision$$Date$ ''' ''' $Log$ ''' .de Sh .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .de Sp .if t .sp .5v .if n .sp .. .de Ip .br .ie \\n(.$>=3 .ne \\$3 .el .ne 3 .IP "\\$1" \\$2 .. .de Vb .ft CW .nf .ne \\$1 .. .de Ve .ft R .fi .. ''' ''' ''' Set up \*(-- to give an unbreakable dash; ''' string Tr holds user defined translation string. ''' Bell System Logo is used as a dummy character. ''' .tr \(*W-|\(bv\*(Tr .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" "" ''' \*(M", \*(S", \*(N" and \*(T" are the equivalent of ''' \*(L" and \*(R", except that they are used on ".xx" lines, ''' such as .IP and .SH, which do another additional levels of ''' double-quote interpretation .ds M" """ .ds S" """ .ds N" """"" .ds T" """"" .ds L' ' .ds R' ' .ds M' ' .ds S' ' .ds N' ' .ds T' ' 'br\} .el\{\ .ds -- \(em\| .tr \*(Tr .ds L" `` .ds R" '' .ds M" `` .ds S" '' .ds N" `` .ds T" '' .ds L' ` .ds R' ' .ds M' ` .ds S' ' .ds N' ` .ds T' ' .ds PI \(*p 'br\} .\" If the F register is turned on, we'll generate .\" index entries out stderr for the following things: .\" TH Title .\" SH Header .\" Sh Subsection .\" Ip Item .\" X<> Xref (embedded .\" Of course, you have to process the output yourself .\" in some meaninful fashion. .if \nF \{ .de IX .tm Index:\\$1\t\\n%\t"\\$2" .. .nr % 0 .rr F .\} .TH lib::HTML::LinkExtor 3 "perl 5.005, patch 03" "22/Aug/2000" "User Contributed Perl Documentation" .UC .if n .hy 0 .if n .na .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .de CQ \" put $1 in typewriter font .ft CW 'if n "\c 'if t \\&\\$1\c 'if n \\&\\$1\c 'if n \&" \\&\\$2 \\$3 \\$4 \\$5 \\$6 \\$7 '.ft R .. .\" @(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2 . \" AM - accent mark definitions .bd B 3 . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds ? ? . ds ! ! . ds / . ds q .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds ? \s-2c\h'-\w'c'u*7/10'\u\h'\*(#H'\zi\d\s+2\h'\w'c'u*8/10' . ds ! \s-2\(or\s+2\h'-\w'\(or'u'\v'-.8m'.\v'.8m' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' . ds q o\h'-\w'o'u*8/10'\s-4\v'.4m'\z\(*i\v'-.4m'\s+4\h'\w'o'u*8/10' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds v \\k:\h'-(\\n(.wu*9/10-\*(#H)'\v'-\*(#V'\*(#[\s-4v\s0\v'\*(#V'\h'|\\n:u'\*(#] .ds _ \\k:\h'-(\\n(.wu*9/10-\*(#H+(\*(#F*2/3))'\v'-.4m'\z\(hy\v'.4m'\h'|\\n:u' .ds . \\k:\h'-(\\n(.wu*8/10)'\v'\*(#V*4/10'\z.\v'-\*(#V*4/10'\h'|\\n:u' .ds 3 \*(#[\v'.2m'\s-2\&3\s0\v'-.2m'\*(#] .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E .ds oe o\h'-(\w'o'u*4/10)'e .ds Oe O\h'-(\w'O'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds v \h'-1'\o'\(aa\(ga' . ds _ \h'-1'^ . ds . \h'-1'. . ds 3 3 . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE . ds oe oe . ds Oe OE .\} .rm #[ #] #H #V #F C .SH "NAME" HTML::LinkExtor \- Extract links from an HTML document .SH "SYNOPSIS" .PP .Vb 7 \& require HTML::LinkExtor; \& $p = HTML::LinkExtor->new(\e&cb, "http://www.sn.no/"); \& sub cb { \& my($tag, %links) = @_; \& print "$tag @{[%links]}\en"; \& } \& $p->parse_file("index.html"); .Ve .SH "DESCRIPTION" \fIHTML::LinkExtor\fR is an HTML parser that extracts links from an HTML document. The \fIHTML::LinkExtor\fR is a subclass of \fIHTML::Parser\fR. This means that the document should be given to the parser by calling the \f(CW$p\fR\->\fIparse()\fR or \f(CW$p\fR\->\fIparse_file()\fR methods. .Ip "$p = \s-1HTML::\s0LinkExtor->new([$callback[, $base]])" 4 The constructor takes two optional arguments. The first is a reference to a callback routine. It will be called as links are found. If a callback is not provided, then links are just accumulated internally and can be retrieved by calling the \f(CW$p\fR\->\fIlinks()\fR method. .Sp The \f(CW$base\fR argument is an optional base \s-1URL\s0 used to absolutize all URLs found. You need to have the \fI\s-1URI\s0\fR module installed if you provide \f(CW$base\fR. .Sp The callback is called with the lowercase tag name as first argument, and then all link attributes as separate key/value pairs. All non-link attributes are removed. .Ip "$p->links" 4 Returns a list of all links found in the document. The returned values will be anonymous arrays with the follwing elements: .Sp .Vb 1 \& [$tag, $attr => $url1, $attr2 => $url2,...] .Ve The \f(CW$p\fR\->links method will also truncate the internal link list. This means that if the method is called twice without any parsing between them the second call will return an empty list. .Sp Also note that \f(CW$p\fR\->links will always be empty if a callback routine was provided when the \fI\s-1HTML::\s0LinkExtor\fR was created. .SH "EXAMPLE" This is an example showing how you can extract links from a document received using LWP: .PP .Vb 3 \& use LWP::UserAgent; \& use HTML::LinkExtor; \& use URI::URL; .Ve .Vb 2 \& $url = "http://www.sn.no/"; # for instance \& $ua = new LWP::UserAgent; .Ve .Vb 7 \& # Set up a callback that collect image links \& my @imgs = (); \& sub callback { \& my($tag, %attr) = @_; \& return if $tag ne 'img'; # we only look closer at \& push(@imgs, values %attr); \& } .Ve .Vb 3 \& # Make the parser. Unfortunately, we don't know the base yet \& # (it might be diffent from $url) \& $p = HTML::LinkExtor->new(\e&callback); .Ve .Vb 3 \& # Request document and parse it as it arrives \& $res = $ua->request(HTTP::Request->new(GET => $url), \& sub {$p->parse($_[0])}); .Ve .Vb 3 \& # Expand all image URLs to absolute ones \& my $base = $res->base; \& @imgs = map { $_ = url($_, $base)->abs; } @imgs; .Ve .Vb 2 \& # Print them out \& print join("\en", @imgs), "\en"; .Ve .SH "SEE ALSO" the \fIHTML::Parser\fR manpage, the \fIHTML::Tagset\fR manpage, the \fILWP\fR manpage, the \fIURI::URL\fR manpage .SH "COPYRIGHT" Copyright 1996-2000 Gisle Aas. .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .rn }` '' .IX Title "lib::HTML::LinkExtor 3" .IX Name "HTML::LinkExtor - Extract links from an HTML document" .IX Header "NAME" .IX Header "SYNOPSIS" .IX Header "DESCRIPTION" .IX Item "$p = \s-1HTML::\s0LinkExtor->new([$callback[, $base]])" .IX Item "$p->links" .IX Header "EXAMPLE" .IX Header "SEE ALSO" .IX Header "COPYRIGHT" kêฤ�LˆÊ}·:rA%:‚Õž:!$HLˆ./usr/local/man/man3/HTML__Parser.3.3ó/¤�.rn '' }` ''' $RCSfile$$Revision$$Date$ ''' ''' $Log$ ''' .de Sh .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .de Sp .if t .sp .5v .if n .sp .. .de Ip .br .ie \\n(.$>=3 .ne \\$3 .el .ne 3 .IP "\\$1" \\$2 .. .de Vb .ft CW .nf .ne \\$1 .. .de Ve .ft R .fi .. ''' ''' ''' Set up \*(-- to give an unbreakable dash; ''' string Tr holds user defined translation string. ''' Bell System Logo is used as a dummy character. ''' .tr \(*W-|\(bv\*(Tr .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" "" ''' \*(M", \*(S", \*(N" and \*(T" are the equivalent of ''' \*(L" and \*(R", except that they are used on ".xx" lines, ''' such as .IP and .SH, which do another additional levels of ''' double-quote interpretation .ds M" """ .ds S" """ .ds N" """"" .ds T" """"" .ds L' ' .ds R' ' .ds M' ' .ds S' ' .ds N' ' .ds T' ' 'br\} .el\{\ .ds -- \(em\| .tr \*(Tr .ds L" `` .ds R" '' .ds M" `` .ds S" '' .ds N" `` .ds T" '' .ds L' ` .ds R' ' .ds M' ` .ds S' ' .ds N' ` .ds T' ' .ds PI \(*p 'br\} .\" If the F register is turned on, we'll generate .\" index entries out stderr for the following things: .\" TH Title .\" SH Header .\" Sh Subsection .\" Ip Item .\" X<> Xref (embedded .\" Of course, you have to process the output yourself .\" in some meaninful fashion. .if \nF \{ .de IX .tm Index:\\$1\t\\n%\t"\\$2" .. .nr % 0 .rr F .\} .TH Parser 3 "perl 5.005, patch 03" "17/Sep/2000" "User Contributed Perl Documentation" .UC .if n .hy 0 .if n .na .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .de CQ \" put $1 in typewriter font .ft CW 'if n "\c 'if t \\&\\$1\c 'if n \\&\\$1\c 'if n \&" \\&\\$2 \\$3 \\$4 \\$5 \\$6 \\$7 '.ft R .. .\" @(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2 . \" AM - accent mark definitions .bd B 3 . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds ? ? . ds ! ! . ds / . ds q .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds ? \s-2c\h'-\w'c'u*7/10'\u\h'\*(#H'\zi\d\s+2\h'\w'c'u*8/10' . ds ! \s-2\(or\s+2\h'-\w'\(or'u'\v'-.8m'.\v'.8m' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' . ds q o\h'-\w'o'u*8/10'\s-4\v'.4m'\z\(*i\v'-.4m'\s+4\h'\w'o'u*8/10' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds v \\k:\h'-(\\n(.wu*9/10-\*(#H)'\v'-\*(#V'\*(#[\s-4v\s0\v'\*(#V'\h'|\\n:u'\*(#] .ds _ \\k:\h'-(\\n(.wu*9/10-\*(#H+(\*(#F*2/3))'\v'-.4m'\z\(hy\v'.4m'\h'|\\n:u' .ds . \\k:\h'-(\\n(.wu*8/10)'\v'\*(#V*4/10'\z.\v'-\*(#V*4/10'\h'|\\n:u' .ds 3 \*(#[\v'.2m'\s-2\&3\s0\v'-.2m'\*(#] .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E .ds oe o\h'-(\w'o'u*4/10)'e .ds Oe O\h'-(\w'O'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds v \h'-1'\o'\(aa\(ga' . ds _ \h'-1'^ . ds . \h'-1'. . ds 3 3 . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE . ds oe oe . ds Oe OE .\} .rm #[ #] #H #V #F C .SH "NAME" HTML::Parser \- HTML parser class .SH "NOTE" This is the new XS based HTML::Parser. It should be completely backwards compatible with HTML::Parser version 2.2x, but has many new features and is significantly faster. .SH "SYNOPSIS" .PP .Vb 1 \& use HTML::Parser (); .Ve .Vb 6 \& # Create parser object \& $p = HTML::Parser->new( api_version => 3, \& start_h => [\e&start, "tagname, attr"], \& end_h => [\e&end, "tagname"], \& marked_sections => 1, \& ); .Ve .Vb 5 \& # Parse document text chunk by chunk \& $p->parse($chunk1); \& $p->parse($chunk2); \& #... \& $p->eof; # signal end of document .Ve .Vb 5 \& # Parse directly from file \& $p->parse_file("foo.html"); \& # or \& open(F, "foo.html") || die; \& $p->parse_file(*F); .Ve HTML::Parser version 2 style subclassing and method callbacks: .PP .Vb 3 \& { \& package MyParser; \& use base 'HTML::Parser'; .Ve .Vb 4 \& sub start { \& my($self, $tagname, $attr, $attrseq, $origtext) = @_; \& #... \& } .Ve .Vb 4 \& sub end { \& my($self, $tagname, $origtext) = @_; \& #... \& } .Ve .Vb 5 \& sub text { \& my($self, $origtext, $is_cdata) = @_; \& #... \& } \& } .Ve .Vb 2 \& my $p = MyParser->new; \& $p->parse_file("foo.html"); .Ve .SH "DESCRIPTION" Objects of the \f(CWHTML::Parser\fR class will recognize markup and separate it from plain text (alias data content) in HTML documents. As different kinds of markup and text are recognized, the corresponding event handlers are invoked. .PP \f(CWHTML::Parser\fR in not a generic SGML parser. We have tried to make it able to deal with the HTML that is actually \*(L"out there\*(R", and it normally parses as closely as possible to the way the popular web browsers do it instead of strictly following one of the many HTML specifications from W3C. Where there is disagreement there is often an option that you can enable to get the official behaviour. .PP The document to be parsed may be supplied in arbitrary chunks. This makes on-the-fly parsing as documents are received from the network possible. .PP If event driven parsing does not feel right for your application, you might want to use \f(CWHTML::TokeParser\fR. It is a \f(CWHTML::Parser\fR subclass that allows a more conventional program structure. .SH "METHODS" The following method is used to construct a new \f(CWHTML::Parser\fR object: .Ip "$p = \s-1HTML::\s0Parser->new( %options_and_handlers )" 5 This class method creates a new \f(CWHTML::Parser\fR object and returns it. Key/value pair arguments may be provided to assign event handlers or initialize parser options. The handlers and parser options can also be set or modified later by method calls described below. .Sp If a top level key is in the form \*(L"_h\*(R" (e.g., \*(L"text_h"} then it assigns a handler to that event, otherwise it initializes a parser option. The event handler specification value must be an array reference. Multiple handlers may also be assigned with the \*(L'handlers => [%handlers]\*(R' option. See examples below. .Sp If \fInew()\fR is called without any arguments, it will create a parser that uses callback methods compatible with version 2 of \f(CWHTML::Parser\fR. See the section on \*(L"version 2 compatibility\*(R" below for details. .Sp Special constructor option \*(L'api_version => 2\*(R' can be used to initialize version 2 callbacks while still setting other options and handlers. The \*(L'api_version => 3\*(R' option can be used if you don't want to set any options and don't want to fall back to v2 compatible mode. .Sp Examples: .Sp .Vb 2 \& $p = HTML::Parser->new(api_version => 3, \& text_h => [ sub {...}, "dtext" ]); .Ve This creates a new parser object with a text event handler subroutine that receives the original text with general entities decoded. .Sp .Vb 2 \& $p = HTML::Parser->new(api_version => 3, \& start_h => [ 'my_start', "self,tokens" ]); .Ve This creates a new parser object with a start event handler method that receives the \f(CW$p\fR and the tokens array. .Sp .Vb 4 \& $p = HTML::Parser->new(api_version => 3, \& handlers => { text => [\e@array, "event,text"], \& comment => [\e@array, "event,text"], \& }); .Ve This creates a new parser object that stores the event type and the original text in \f(CW@array\fR for text and comment events. .PP The following methods feed the \s-1HTML\s0 document to the \f(CWHTML::Parser\fR object: .Ip "$p->parse( $string )" 5 Parse \f(CW$string\fR as the next chunk of the \s-1HTML\s0 document. The return value is normally a reference to the parser object (i.e. \f(CW$p\fR). Handlers invoked should not attempt modify the \f(CW$string\fR in-place until \f(CW$p\fR\->parse returns. .Sp If an invoked event handler aborts parsing by calling \f(CW$p\fR\->eof, then \f(CW$p\fR\->\fIparse()\fR will return a \s-1FALSE\s0 value. .Ip "$p->parse_file( $file )" 5 Parse text directly from a file. The \f(CW$file\fR argument can be a filename, an open file handle, or a reference to a an open file handle. .Sp If \f(CW$file\fR contains a filename and the file can't be opened, then the method returns an undefined value and $! tells why it failed. Otherwise the return value is a reference to the parser object. .Sp If a file handle is passed as the \f(CW$file\fR argument, then the file will normally be read until \s-1EOF\s0, but not closed. .Sp If an invoked event handler aborts parsing by calling \f(CW$p\fR\->eof, then \f(CW$p\fR\->\fIparse_file()\fR may not have read the entire file. .Sp On systems with multi-byte line terminators, the values passed for the offset and length argspecs may be too low if parse_file is called with a file handle that is not in binary mode. .Ip "$p->eof" 5 Signals the end of the \s-1HTML\s0 document. Calling the \f(CW$p\fR\->eof method outside a handler callback will flush any remaining buffered text (which triggers the \f(CWtext\fR event if there is any remaining text). .Sp Calling \f(CW$p\fR\->eof inside a handler will terminate parsing at that point and cause \f(CW$p\fR\->parse to return a \s-1FALSE\s0 value. This also terminates parsing by \f(CW$p\fR\->\fIparse_file()\fR. .Sp The return value is a reference to the parser object. .PP Most parser options are controlled by boolean attributes. Each boolean attribute is enabled by calling the corresponding method with a \s-1TRUE\s0 argument and disabled with a \s-1FALSE\s0 argument. The attribute value is left unchanged if no argument is given. The return value from each method is the old attribute value. .PP Methods that can be used to get and/or set parser options are: .Ip "$p->strict_comment( [$bool] )" 5 By default, comments are terminated by the first occurrence of \*(L"\*(-->\*(R". This is the behaviour of most popular browsers (like Netscape and \s-1MSIE\s0), but it is not correct according to the official \s-1HTML\s0 standard. Officially, you need an even number of \*(L"--\*(R" tokens before the closing \*(L">\*(R" is recognized and there may not be anything but whitespace between an even and an odd \*(L"--\*(R". .Sp The official behaviour is enabled by enabling this attribute. .Ip "$p->strict_names( [$bool] )" 5 By default, almost anything is allowed in tag and attribute names. This is the behaviour of most popular browsers and allows us to parse some broken tags with invalid attr values like: .Sp .Vb 1 \& [PREV .Ve By default, \*(L"\s-1LIST\s0]\*(R" is parsed as a boolean attribute, not as part of the \s-1ALT\s0 value as was clearly intended. This is also what Netscape sees. .Sp The official behaviour is enabled by enabling this attribute. If enabled, it will cause the tag above to be reported as text since \*(L"\s-1LIST\s0]\*(R" is not a legal attribute name. .Ip "$p->boolean_attribute_value( $val )" 5 This method sets the value reported for boolean attributes inside \s-1HTML\s0 start tags. By default, the name of the attribute is also used as its value. This affects the values reported for \f(CWtokens\fR and \f(CWattr\fR argspecs. .Ip "$p->xml_mode( [$bool] )" 5 Enabling this attribute changes the parser to allow some \s-1XML\s0 constructs such as \fIempty element tags\fR and \fI\s-1XML\s0 processing instructions\fR. It disables forcing tag and attribute names to lower case when they are reported by the \f(CWtagname\fR and \f(CWattr\fR argspecs, and suppress special treatment of elements that are parsed as \s-1CDATA\s0 for \s-1HTML\s0. .Sp \fIEmpty element tags\fR look like start tags, but end with the character sequence \*(L"/>\*(R". When recognized by \f(CWHTML::Parser\fR they cause an artificial end event in addition to the start event. The \f(CWtext\fR for the artificial end event will be empty and the \f(CWtokenpos\fR array will be undefined even though the only element in the token array will have the correct tag name. .Sp \fI\s-1XML\s0 processing instructions\fR are terminated by \*(L"?>\*(R" instead of a simple \*(L">\*(R" as is the case for \s-1HTML\s0. .Ip "$p->unbroken_text( [$bool] )" 5 By default, blocks of text are given to the text handler as soon as possible (but the parser makes sure to always break text at the boundary between whitespace and non-whitespace so single words and entities always can be decoded safely). This might create breaks that make it hard to do transformations on the text. When this attribute is enabled, blocks of text are always reported in one piece. This will delay the text event until the following (non-text) event has been recognized by the parser. .Ip "$p->marked_sections( [$bool] )" 5 By default, section markings like are treated like ordinary text. When this attribute is enabled section markings are honoured. .Sp There are currently no events associated with marked section elements. .PP As markup and text is recognized, handlers are invoked. The following method is used to set up handlers for different events: .Ip "$p->handler( event => \e&subroutine, argspec )" 5 .Ip "$p->handler( event => method_name, argspec )" 5 .Ip "$p->handler( event => \e@accum, argspec )" 5 .Ip "$p->handler( event => """" );" 5 .Ip "$p->handler( event => undef );" 5 .Ip "$p->handler( event );" 5 This method assigns a subroutine, method, or array to handle an event. .Sp Event is one of \f(CWtext\fR, \f(CWstart\fR, \f(CWend\fR, \f(CWdeclaration\fR, \f(CWcomment\fR, \f(CWprocess\fR or \f(CWdefault\fR. .Sp \fISubroutine\fR is a reference to a subroutine which is called to handle the event. .Sp \fIMethod_name\fR is the name of a method of \f(CW$p\fR which is called to handle the event. .Sp \fIAccum\fR is a array that will hold the event information as sub-arrays. .Sp If the second argument is "", the event is ignored. If it is undef, the default handler is invoked for the event. .Sp \fIArgspec\fR is a string that describes the information to be reported for the event. Any requested information that does not apply to a specific event is passed as \f(CWundef\fR. If argspec is omitted, then it is left unchanged since last update. .Sp The return value from \f(CW$p\fR\->handle is the old callback routine or a reference to the accumulator array. .Sp Return values from handler callback routines/methods are always ignored. A handler callback can request parsing to be aborted by invoking the \f(CW$p\fR\->eof method. A handler callback is not allowed to invoke \f(CW$p\fR\->\fIparse()\fR or \f(CW$p\fR\->\fIparse_file()\fR. .Sp Examples: .Sp .Vb 1 \& $p->handler(start => "start", 'self, attr, attrseq, text' ); .Ve This causes the \*(L"start\*(R" method of object \f(CW$p\fR to be called for \*(L'start\*(R' events. The callback signature is \f(CW$p\fR\->\fIstart\fR\|(\e%attr, \e@attr_seq, \f(CW$text\fR). .Sp .Vb 1 \& $p->handler(start => \e&start, 'attr, attrseq, text' ); .Ve This causes subroutine \fIstart()\fR to be called for \*(L'start\*(R' events. The callback signature is \fIstart\fR\|(\e%attr, \e@attr_seq, \f(CW$text\fR). .Sp .Vb 1 \& $p->handler(start => \e@accum, '"S", attr, attrseq, text' ); .Ve This causes \*(L'start\*(R' event information to be saved in \f(CW@accum\fR. The array elements will be ['S\*(R', \e%attr, \e@attr_seq, \f(CW$text\fR]. .Sp .Vb 1 \& $p->handler(start => ""); .Ve This causes \*(L'start\*(R' events to be ignored. It also supresses invokations of any default handler for start events. It is equivalent to \f(CW$p\fR\->\fIhandler\fR\|(start => sub {}), but is more efficient. .Sp .Vb 1 \& $p->handler(start => undef); .Ve This causes no handler to be assosiated with start events. If there is a default handler it will be invoked. .Sh "Argspec" Argspec is a string containing a comma separated list that describes the information reported by the event. The following argspec identifier names can be used: .Ip "\f(CWself\fR" 5 Self causes the current object to be passed to the handler. If the handler is a method, this must be the first element in the argspec. .Ip "\f(CWtokens\fR" 5 Tokens causes a reference to an array of token strings to be passed. The strings are exactly as they were found in the original text, no decoding or case changes are applied. .Sp For \f(CWdeclaration\fR events, the array contains each word, comment, and delimited string starting with the declaration type. .Sp For \f(CWcomment\fR events, this contains each sub-comment. If \f(CW$p\fR\->strict_comments is disabled, there will be only one sub-comment. .Sp For \f(CWstart\fR events, this contains the original tag name followed by the attribute name/value pairs. The value of boolean attributes will be either the value set by \f(CW$p\fR\->boolean_attribute_value or the attribute name if no value has been set by \f(CW$p\fR\->boolean_attribute_value. .Sp For \f(CWend\fR events, this contains the original tag name (one token only). .Sp For \f(CWprocess\fR events, this contains the process instructions (one token only). .Sp This passes \f(CWundef\fR for \f(CWtext\fR events. .Ip "\f(CWtokenpos\fR" 5 Tokenpos causes a reference to an array of token positions to be passed. For each string that appears in \f(CWtokens\fR, this array contains two numbers. The first number is the offset of the start of the token in the original \f(CWtext\fR and the second number is the length of the token. .Sp Boolean attributes in a \f(CWstart\fR event will have (0,0) for the attribute value offset and length. .Sp This passes undef if there are no tokens in the event (e.g., \f(CWtext\fR) and for artifical \f(CWend\fR events triggered by empty element tags. .Sp If you are using these offsets and lengths to modify \f(CWtext\fR, you should either work from right to left, or be very careful to calculate the changes to the offsets. .Ip "\f(CWtoken0\fR" 5 Token0 causes the original text of the first token string to be passed. This should always be the same as \f(CW$tokens\fR\->[0]. .Sp For \f(CWdeclaration\fR events, this is the declaration type. .Sp For \f(CWstart\fR and \f(CWend\fR events, this is the tag name. .Sp For \f(CWprocess\fR and non-strict \f(CWcomment\fR events, this is everything inside the tag. .Sp This passes undef if there are no tokens in the event. .Ip "\f(CWtagname\fR" 5 This is the element name (or \fIgeneric identifier\fR in \s-1SGML\s0 jargon) for start and end tags. Since \s-1HTML\s0 is case insensitive this name is forced to lower case to ease string matching. .Sp Since \s-1XML\s0 is case sensitive, the tagname case is not changed when \f(CWxml_mode\fR is enabled. .Sp The declaration type of declaration elements is also passed as a tagname, even if that is a bit strange. In fact, in the current implementation tagname is identical to \f(CWtoken0\fR except that the name may be forced to lower case. .Ip "\f(CWattr\fR" 5 Attr causes a reference to a hash of attribute name/value pairs to be passed. .Sp Boolean attributes\*(R' values are either the value set by \f(CW$p\fR\->boolean_attribute_value or the attribute name if no value has been set by \f(CW$p\fR\->boolean_attribute_value. .Sp This passes undef except for \f(CWstart\fR events. .Sp Unless \f(CWxml_mode\fR is enabled, the attribute names are forced to lower case. .Sp General entities are decoded in the attribute values and one layer of matching quotes enclosing the attribute values are removed. .Ip "\f(CWattrseq\fR" 5 Attrseq causes a reference to an array of attribute names to be passed. This can be useful if you want to walk the \f(CWattr\fR hash in the original sequence. .Sp This passes undef except for \f(CWstart\fR events. .Sp Unless \f(CWxml_mode\fR is enabled, the attribute names are forced to lower case. .Ip "\f(CWtext\fR" 5 Text causes the source text (including markup element delimiters) to be passed. .Ip "\f(CWdtext\fR" 5 Dtext causes the decoded text to be passed. General entities are automatically decoded unless the event was inside a \s-1CDATA\s0 section or was between literal start and end tags (\f(CWscript\fR, \f(CWstyle\fR, \f(CWxmp\fR, and \f(CWplaintext\fR). .Sp The \s-1ISO\s0 8859-1 character set (aka Latin1) is assumed for entity decoding. .Sp It is planned that \f(CWHTML::Parser\fR will get an \f(CWutf8\fR option at some point that will affect the byte sequence that characters with codes greater than 127 will decode into. .Sp This passes undef except for \f(CWtext\fR events. .Ip "\f(CWis_cdata\fR" 5 Is_cdata causes a \s-1TRUE\s0 value to be passed if the event is inside a \s-1CDATA\s0 section or is between literal start and end tags (\f(CWscript\fR, \f(CWstyle\fR, \f(CWxmp\fR, and \f(CWplaintext\fR). .Sp When the flag is \s-1FALSE\s0 for a text event, then you should normally either use \f(CWdtext\fR or decode the entities yourself before the text is processed further. .Ip "\f(CWoffset\fR" 5 Offset causes the byte position in the \s-1HTML\s0 document of the start of the event to be passed. The first byte in the document is 0. .Ip "\f(CWlength\fR" 5 Length causes the number of bytes of the source text of the event to be passed. .Ip "\f(CWevent\fR" 5 Event causes the event name to be passed. .Sp The event name is one of \f(CWtext\fR, \f(CWstart\fR, \f(CWend\fR, \f(CWdeclaration\fR, \f(CWcomment\fR, \f(CWprocess\fR or \f(CWdefault\fR. .Ip "\f(CWline\fR" 5 \fINote: This is not supported yet!\fR .Sp Line causes the line number of the start of the event to be passed. The first line in the document is 1. Line counting doesn't start until at least one handler requests this value. .Ip "\f(CW'...'\fR" 5 A literal string of 0 to 255 characters enclosed in single (') or double (") quotes is passed as entered. .Ip "\f(CWundef\fR" 5 Pass an undefined value. Useful as padding. .Sh "Events" Handlers for the following events can be registered: .Ip "\f(CWtext\fR" 5 This event is triggered when plain text is recognized. The text may contain multiple lines. A sequence of text may be broken between several text events unless \f(CW$p\fR\->unbroken_text is enabled. .Sp The parser will make sure that it does not break a word or a sequence of whitespace between two text events. .Ip "\f(CWstart\fR" 5 This event is triggered when a start tag is recognized. .Sp Example: .Sp .Vb 1 \& .Ve .Ip "\f(CWend\fR" 5 This event is triggered when an end tag is recognized. .Sp Example: .Sp .Vb 1 \& .Ve .Ip "\f(CWdeclaration\fR" 5 This event is triggered when a \fImarkup declaration\fR is recognized. .Sp For typical \s-1HTML\s0 documents, the only declaration you are likely to find is . .Sp Example: .Sp .Vb 2 \& .Ve DTDs inside will confuse \s-1HTML::\s0Parser. .Ip "\f(CWcomment\fR" 5 This event is triggered when a markup comment is recognized. .Sp Example: .Sp .Vb 1 \& .Ve .Ip "\f(CWprocess\fR" 5 This event is triggered when a processing instructions markup is recognized. .Sp The format and content of processing instructions is system and application dependent. .Sp Examples: .Sp .Vb 2 \& \& .Ve .Ip "\f(CWdefault\fR" 5 This event is triggered for events that do not have a specific handler. You can set up a handler for this event to catch stuff you did not want to catch explicitly. .SH "VERSION 2 COMPATIBILITY" When an \f(CWHTML::Parser\fR object is constructed with no arguments, a set of handlers is automatically provided that is compatible with the old HTML::Parser version 2 callback methods. .PP This is equivalent to the following method calls: .PP .Vb 14 \& $p->handler(start => "start", "self, tagname, attr, attrseq, text"); \& $p->handler(end => "end", "self, tagname, text"); \& $p->handler(text => "text", "self, text, is_cdata"); \& $p->handler(process => "process", "self, token0, text"); \& $p->handler(comment => \& sub { \& my($self, $tokens) = @_; \& for (@$tokens) {$self->comment($_);}}, \& "self, tokens"); \& $p->handler(declaration => \& sub { \& my $self = shift; \& $self->declaration(substr($_[0], 2, -1));}, \& "self, text"); .Ve Setup of these handlers can also be requested with the \*(L"api_version => 2\*(R" constructor option. .SH "SUBCLASSING" The \f(CWHTML::Parser\fR class is subclassable. Parser objects are plain hashes and \f(CWHTML::Parser\fR reserves only hash keys that start with \*(L"_hparser\*(R". The parser state can be set up by invoking the \fIinit()\fR method which takes the same arguments as \fInew()\fR. .SH "EXAMPLES" The first simple example shows how you might strip out comments from an HTML document. We achieve this by setting up a comment handler that does nothing and a default handler that will print out anything else: .PP .Vb 4 \& use HTML::Parser; \& HTML::Parser->new(default_h => [sub { print shift }, 'text'], \& comment_h => [""], \& )->parse_file(shift || die) || die $!; .Ve The next example prints out the text that is inside the element of an HTML document. Here we start by setting up a start handler. When it sees the title start tag it enables a text handler that prints any text found and an end handler that will terminate parsing as soon as the title end tag is seen: .PP .Vb 1 \& use HTML::Parser (); .Ve .Vb 8 \& sub start_handler \& { \& return if shift ne "title"; \& my $self = shift; \& $self->handler(text => sub { print shift }, "dtext"); \& $self->handler(end => sub { shift->eof if shift eq "title"; }, \& "tagname,self"); \& } .Ve .Vb 4 \& my $p = HTML::Parser->new(api_version => 3); \& $p->handler( start => \e&start_handler, "tagname,self"); \& $p->parse_file(shift || die) || die $!; \& print "\en"; .Ve More examples are found in the \*(L"eg/\*(R" directory of the \f(CWHTML-Parser\fR distribution; the program \f(CWhrefsub\fR shows how you can edit all links found in a document and \f(CWhtextsub\fR how to edid the text only; the program \f(CWhstrip\fR shows how you can strip out certain tags/elements and/or attributes; and the program \f(CWhtext\fR show how to obtain the plain text, but not any script/style content. .SH "BUGS" \f(CWHTML::Parser\fR will leave <plaintext> mode when it sees </plaintext>. Plaintext mode should not really be escapeable. .PP The <style> and <script> sections do not end with the first \*(L"</\*(R", but need the complete corresponding end tag. .PP When the \fIstrict_comment\fR option is enabled, we still recognize comments where there is something other than whitespace between even and odd \*(L"--\*(R" markers. .PP Once \f(CW$p\fR\->boolean_attribute_value has been set, there is no way to restore the default behaviour. .PP There is currently no way to get both quote characters into the same literal argspec. .PP Empty tags, e.g. \*(L"<>\*(R" and \*(L"</>\*(R", are not recognized. SGML allows them to repeat the previous start tag or close the previous start tag respecitvely. .PP NET tags, e.g. \*(L"code/.../\*(R" are not recognized. This is an SGML shorthand for \*(L"<code>...</code>\*(R". .PP Unclosed start or end tags, e.g. \*(L"<tt<b>...</b</tt>\*(R" are not recognized. .SH "DIAGNOSTICS" The following messages may be produced by HTML::Parser. The notation in this listing is the same as used in the \fIperldiag\fR manpage: .Ip "Not a reference to a hash" 5 (F) The object blessed into or subclassed from \s-1HTML::\s0Parser is not a hash as required by the \s-1HTML::\s0Parser methods. .Ip "Bad signature in parser state object at %p" 5 (F) The _hparser_xs_state element does not refer to a valid state structure. Something must have changed the internal value stored in this hash element, or the memory has been overwritten. .Ip "_hparser_xs_state element is not a reference" 5 (F) The _hparser_xs_state element has been destroyed. .Ip "Can't find \*(N'_hparser_xs_state\*(T' element in \s-1HTML::\s0Parser hash" 5 (F) The _hparser_xs_state element is missing from the parser hash. It was either deleted, or not created when the object was created. .Ip "\s-1API\s0 version %s not supported by \s-1HTML::\s0Parser %s" 5 (F) The constructor option \*(L'api_version\*(R' with an argument greater than or equal to 4 is reserved for future extentions. .Ip "Bad constructor option \*(N'%s\*(T'" 5 (F) An unknown constructor option key was passed to the \fInew()\fR or \fIinit()\fR methods. .Ip "Parse loop not allowed" 5 (F) A handler invoked the \fIparse()\fR or \fIparse_file()\fR method. This is not permitted. .Ip "marked sections not supported" 5 (F) The \f(CW$p\fR\->\fImarked_sections()\fR method was invoked in a \s-1HTML::\s0Parser module that was compiled without support for marked sections. .Ip "Unknown boolean attribute (%d)" 5 (F) Something is wrong with the internal logic that set up aliases for boolean attributes. .Ip "Only code or array references allowed as handler" 5 (F) The second argument for \f(CW$p\fR\->handler must be either a subroutine reference, then name of a subroutine or method, or a reference to an array. .Ip "No handler for %s events" 5 (F) The first argument to \f(CW$p\fR\->handler must be a valid event name; i.e. one of \*(L"start\*(R", \*(L"end\*(R", \*(L"text\*(R", \*(L"process\*(R", \*(L"declaration\*(R" or \*(L"comment\*(R". .Ip "Unrecognized identifier %s in argspec" 5 (F) The identifier is not a known argspec name. Use one of the names mentioned in the argspec section above. .Ip "Literal string is longer than 255 chars in argspec" 5 (F) The current implementation limits the length of literals in an argspec to 255 characters. Make the literal shorter. .Ip "Backslash reserved for literal string in argspec" 5 (F) The backslash character \*(L"\e\*(R" is not allowed in argspec literals. It is reserved to permit quoting inside a literal in a later version. .Ip "Unterminated literal string in argspec" 5 (F) The terminating quote character for a literal was not found. .Ip "Bad argspec (%s)" 5 (F) Only identifier names, literals, spaces and commas are allowed in argspecs. .Ip "Missing comma separator in argspec" 5 (F) Identifiers in an argspec must be separated with \*(L",\*(R". .SH "SEE ALSO" the \fIHTML::Entities\fR manpage, the \fIHTML::TokeParser\fR manpage, the \fIHTML::HeadParser\fR manpage, the \fIHTML::LinkExtor\fR manpage, the \fIHTML::Form\fR manpage .PP the \fIHTML::TreeBuilder\fR manpage (part of the \fIHTML\-Tree\fR distribution) .PP http://www.w3.org/TR/REC\-html40 .PP More information about marked sections and processing instructions may be found at \f(CWhttp://www.sgml.u-net.com/book/sgml-8.htm\fR. .SH "COPYRIGHT" .PP .Vb 2 \& Copyright 1996-2000 Gisle Aas. All rights reserved. \& Copyright 1999-2000 Michael A. Chase. All rights reserved. .Ve This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .rn }` '' .IX Title "Parser 3" .IX Name "HTML::Parser - HTML parser class" .IX Header "NAME" .IX Header "NOTE" .IX Header "SYNOPSIS" .IX Header "DESCRIPTION" .IX Header "METHODS" .IX Item "$p = \s-1HTML::\s0Parser->new( %options_and_handlers )" .IX Item "$p->parse( $string )" .IX Item "$p->parse_file( $file )" .IX Item "$p->eof" .IX Item "$p->strict_comment( [$bool] )" .IX Item "$p->strict_names( [$bool] )" .IX Item "$p->boolean_attribute_value( $val )" .IX Item "$p->xml_mode( [$bool] )" .IX Item "$p->unbroken_text( [$bool] )" .IX Item "$p->marked_sections( [$bool] )" .IX Item "$p->handler( event => \e&subroutine, argspec )" .IX Item "$p->handler( event => method_name, argspec )" .IX Item "$p->handler( event => \e@accum, argspec )" .IX Item "$p->handler( event => """" );" .IX Item "$p->handler( event => undef );" .IX Item "$p->handler( event );" .IX Subsection "Argspec" .IX Item "\f(CWself\fR" .IX Item "\f(CWtokens\fR" .IX Item "\f(CWtokenpos\fR" .IX Item "\f(CWtoken0\fR" .IX Item "\f(CWtagname\fR" .IX Item "\f(CWattr\fR" .IX Item "\f(CWattrseq\fR" .IX Item "\f(CWtext\fR" .IX Item "\f(CWdtext\fR" .IX Item "\f(CWis_cdata\fR" .IX Item "\f(CWoffset\fR" .IX Item "\f(CWlength\fR" .IX Item "\f(CWevent\fR" .IX Item "\f(CWline\fR" .IX Item "\f(CW'...'\fR" .IX Item "\f(CWundef\fR" .IX Subsection "Events" .IX Item "\f(CWtext\fR" .IX Item "\f(CWstart\fR" .IX Item "\f(CWend\fR" .IX Item "\f(CWdeclaration\fR" .IX Item "\f(CWcomment\fR" .IX Item "\f(CWprocess\fR" .IX Item "\f(CWdefault\fR" .IX Header "VERSION 2 COMPATIBILITY" .IX Header "SUBCLASSING" .IX Header "EXAMPLES" .IX Header "BUGS" .IX Header "DIAGNOSTICS" .IX Item "Not a reference to a hash" .IX Item "Bad signature in parser state object at %p" .IX Item "_hparser_xs_state element is not a reference" .IX Item "Can't find \*(N'_hparser_xs_state\*(T' element in \s-1HTML::\s0Parser hash" .IX Item "\s-1API\s0 version %s not supported by \s-1HTML::\s0Parser %s" .IX Item "Bad constructor option \*(N'%s\*(T'" .IX Item "Parse loop not allowed" .IX Item "marked sections not supported" .IX Item "Unknown boolean attribute (%d)" .IX Item "Only code or array references allowed as handler" .IX Item "No handler for %s events" .IX Item "Unrecognized identifier %s in argspec" .IX Item "Literal string is longer than 255 chars in argspec" .IX Item "Backslash reserved for literal string in argspec" .IX Item "Unterminated literal string in argspec" .IX Item "Bad argspec (%s)" .IX Item "Missing comma separator in argspec" .IX Header "SEE ALSO" .IX Header "COPYRIGHT" own kêb� �¤�����������x'��Ê}·:rA%:‚Õž:!������$��l��x'������./usr/local/man/man3/HTML__TokeParser.3��������������ó/������¤�����������.rn '' }` ''' $RCSfile$$Revision$$Date$ ''' ''' $Log$ ''' .de Sh .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .de Sp .if t .sp .5v .if n .sp .. .de Ip .br .ie \\n(.$>=3 .ne \\$3 .el .ne 3 .IP "\\$1" \\$2 .. .de Vb .ft CW .nf .ne \\$1 .. .de Ve .ft R .fi .. ''' ''' ''' Set up \*(-- to give an unbreakable dash; ''' string Tr holds user defined translation string. ''' Bell System Logo is used as a dummy character. ''' .tr \(*W-|\(bv\*(Tr .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" "" ''' \*(M", \*(S", \*(N" and \*(T" are the equivalent of ''' \*(L" and \*(R", except that they are used on ".xx" lines, ''' such as .IP and .SH, which do another additional levels of ''' double-quote interpretation .ds M" """ .ds S" """ .ds N" """"" .ds T" """"" .ds L' ' .ds R' ' .ds M' ' .ds S' ' .ds N' ' .ds T' ' 'br\} .el\{\ .ds -- \(em\| .tr \*(Tr .ds L" `` .ds R" '' .ds M" `` .ds S" '' .ds N" `` .ds T" '' .ds L' ` .ds R' ' .ds M' ` .ds S' ' .ds N' ` .ds T' ' .ds PI \(*p 'br\} .\" If the F register is turned on, we'll generate .\" index entries out stderr for the following things: .\" TH Title .\" SH Header .\" Sh Subsection .\" Ip Item .\" X<> Xref (embedded .\" Of course, you have to process the output yourself .\" in some meaninful fashion. .if \nF \{ .de IX .tm Index:\\$1\t\\n%\t"\\$2" .. .nr % 0 .rr F .\} .TH lib::HTML::TokeParser 3 "perl 5.005, patch 03" "28/Jun/2000" "User Contributed Perl Documentation" .UC .if n .hy 0 .if n .na .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .de CQ \" put $1 in typewriter font .ft CW 'if n "\c 'if t \\&\\$1\c 'if n \\&\\$1\c 'if n \&" \\&\\$2 \\$3 \\$4 \\$5 \\$6 \\$7 '.ft R .. .\" @(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2 . \" AM - accent mark definitions .bd B 3 . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds ? ? . ds ! ! . ds / . ds q .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds ? \s-2c\h'-\w'c'u*7/10'\u\h'\*(#H'\zi\d\s+2\h'\w'c'u*8/10' . ds ! \s-2\(or\s+2\h'-\w'\(or'u'\v'-.8m'.\v'.8m' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' . ds q o\h'-\w'o'u*8/10'\s-4\v'.4m'\z\(*i\v'-.4m'\s+4\h'\w'o'u*8/10' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds v \\k:\h'-(\\n(.wu*9/10-\*(#H)'\v'-\*(#V'\*(#[\s-4v\s0\v'\*(#V'\h'|\\n:u'\*(#] .ds _ \\k:\h'-(\\n(.wu*9/10-\*(#H+(\*(#F*2/3))'\v'-.4m'\z\(hy\v'.4m'\h'|\\n:u' .ds . \\k:\h'-(\\n(.wu*8/10)'\v'\*(#V*4/10'\z.\v'-\*(#V*4/10'\h'|\\n:u' .ds 3 \*(#[\v'.2m'\s-2\&3\s0\v'-.2m'\*(#] .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E .ds oe o\h'-(\w'o'u*4/10)'e .ds Oe O\h'-(\w'O'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds v \h'-1'\o'\(aa\(ga' . ds _ \h'-1'^ . ds . \h'-1'. . ds 3 3 . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE . ds oe oe . ds Oe OE .\} .rm #[ #] #H #V #F C .SH "NAME" HTML::TokeParser \- Alternative HTML::Parser interface .SH "SYNOPSIS" .PP .Vb 5 \& require HTML::TokeParser; \& $p = HTML::TokeParser->new("index.html") || die "Can't open: $!"; \& while (my $token = $p->get_token) { \& #... \& } .Ve .SH "DESCRIPTION" The HTML::TokeParser is an alternative interface to the HTML::Parser class. It basically turns the HTML::Parser inside out. You associate a file (or any IO::Handle object or string) with the parser at construction time and then repeatedly call \f(CW$parser\fR\->get_token to obtain the tags and text found in the parsed document. .PP Calling the methods defined by the HTML::Parser base class will be confusing, so don't do that. Use the following methods instead: .Ip "$p = \s-1HTML::\s0TokeParser->new( $file_or_doc );" 4 The object constructor argument is either a file name, a file handle object, or the complete document to be parsed. .Sp If the argument is a plain scalar, then it is taken as the name of a file to be opened and parsed. If the file can't be opened for reading, then the constructor will return an undefined value and $! will tell you why it failed. .Sp If the argument is a reference to a plain scalar, then this scalar is taken to be the literal document to parse. The value of this scalar should not be changed before all tokens have been extracted. .Sp Otherwise the argument is taken to be some object that the \f(CWHTML::TokeParser\fR can \fIread()\fR from when it needs more data. Typically it will be a filehandle of some kind. The stream will be \fIread()\fR until \s-1EOF\s0, but not closed. .Ip "$p->get_token" 4 This method will return the next \fItoken\fR found in the \s-1HTML\s0 document, or \f(CWundef\fR at the end of the document. The token is returned as an array reference. The first element of the array will be a (mostly) single character string denoting the type of this token: \*(L"S\*(R" for start tag, \*(L"E\*(R" for end tag, \*(L"T\*(R" for text, \*(L"C\*(R" for comment, \*(L"D\*(R" for declaration, and \*(L"\*(PI\*(R" for process instructions. The rest of the array is the same as the arguments passed to the corresponding \s-1HTML::\s0Parser v2 compatible callbacks (see the \fI\s-1HTML::\s0Parser\fR manpage). In summary, returned tokens look like this: .Sp .Vb 6 \& ["S", $tag, %$attr, @$attrseq, $text] \& ["E", $tag, $text] \& ["T", $text, $is_data] \& ["C", $text] \& ["D", $text] \& ["PI", $token0, $text] .Ve .Ip "$p->unget_token($token,...)" 4 If you find out you have read too many tokens you can push them back, so that they are returned the next time \f(CW$p\fR\->get_token is called. .Ip "$p->get_tag( [$tag] )" 4 This method returns the next start or end tag (skipping any other tokens), or \f(CWundef\fR if there are no more tags in the document. If an argument is given, then we skip tokens until the specified tag type is found. The tag is returned as an array reference in the same form as for \f(CW$p\fR\->get_token above, but the type code (first element) is missing and the name of end tags are prefixed with \*(L"/\*(R". This means that the tags returned look like this: .Sp .Vb 2 \& [$tag, %$attr, @$attrseq, $text] \& ["/$tag", $text] .Ve .Ip "$p->get_text( [$endtag] )" 4 This method returns all text found at the current position. It will return a zero length string if the next token is not text. The optional \f(CW$endtag\fR argument specifies that any text occurring before the given tag is to be returned. Any entities will be converted to their corresponding character. .Sp The \f(CW$p\fR\->{textify} attribute is a hash that defines how certain tags can be treated as text. If the name of a start tag matches a key in this hash then this tag is converted to text. The hash value is used to specify which tag attribute to obtain the text from. If this tag attribute is missing, then the upper case name of the tag enclosed in brackets is returned, e.g. \*(L"[\s-1IMG\s0]\*(R". The hash value can also be a subroutine reference. In this case the routine is called with the start tag token content as its argument and the return value is treated as the text. .Sp The default \f(CW$p\fR\->{textify} value is: .Sp .Vb 1 \& {img => "alt", applet => "alt"} .Ve This means that <\s-1IMG\s0> and <\s-1APPLET\s0> tags are treated as text, and that the text to substitute can be found in the \s-1ALT\s0 attribute. .Ip "$p->get_trimmed_text( [$endtag] )" 4 Same as \f(CW$p\fR\->get_text above, but will collapse any sequences of white space to a single space character. Leading and trailing white space is removed. .SH "EXAMPLES" This example extracts all links from a document. It will print one line for each link, containing the URL and the textual description between the <A>...</A> tags: .PP .Vb 2 \& use HTML::TokeParser; \& $p = HTML::TokeParser->new(shift||"index.html"); .Ve .Vb 5 \& while (my $token = $p->get_tag("a")) { \& my $url = $token->[1]{href} || "-"; \& my $text = $p->get_trimmed_text("/a"); \& print "$url\et$text\en"; \& } .Ve This example extract the <TITLE> from the document: .PP .Vb 6 \& use HTML::TokeParser; \& $p = HTML::TokeParser->new(shift||"index.html"); \& if ($p->get_tag("title")) { \& my $title = $p->get_trimmed_text; \& print "Title: $title\en"; \& } .Ve .SH "SEE ALSO" the \fIHTML::Parser\fR manpage .SH "COPYRIGHT" Copyright 1998-2000 Gisle Aas. .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .rn }` '' .IX Title "lib::HTML::TokeParser 3" .IX Name "HTML::TokeParser - Alternative HTML::Parser interface" .IX Header "NAME" .IX Header "SYNOPSIS" .IX Header "DESCRIPTION" .IX Item "$p = \s-1HTML::\s0TokeParser->new( $file_or_doc );" .IX Item "$p->get_token" .IX Item "$p->unget_token($token,...)" .IX Item "$p->get_tag( [$tag] )" .IX Item "$p->get_text( [$endtag] )" .IX Item "$p->get_trimmed_text( [$endtag] )" .IX Header "EXAMPLES" .IX Header "SEE ALSO" .IX Header "COPYRIGHT" kê¼Ñ� �¤�������������Ê}·:rA%:‚Õž:!������$��ù��������./usr/local/man/man3/HTML__Entities.3�3��������������ó/������¤�����������.rn '' }` ''' $RCSfile$$Revision$$Date$ ''' ''' $Log$ ''' .de Sh .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .de Sp .if t .sp .5v .if n .sp .. .de Ip .br .ie \\n(.$>=3 .ne \\$3 .el .ne 3 .IP "\\$1" \\$2 .. .de Vb .ft CW .nf .ne \\$1 .. .de Ve .ft R .fi .. ''' ''' ''' Set up \*(-- to give an unbreakable dash; ''' string Tr holds user defined translation string. ''' Bell System Logo is used as a dummy character. ''' .tr \(*W-|\(bv\*(Tr .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" "" ''' \*(M", \*(S", \*(N" and \*(T" are the equivalent of ''' \*(L" and \*(R", except that they are used on ".xx" lines, ''' such as .IP and .SH, which do another additional levels of ''' double-quote interpretation .ds M" """ .ds S" """ .ds N" """"" .ds T" """"" .ds L' ' .ds R' ' .ds M' ' .ds S' ' .ds N' ' .ds T' ' 'br\} .el\{\ .ds -- \(em\| .tr \*(Tr .ds L" `` .ds R" '' .ds M" `` .ds S" '' .ds N" `` .ds T" '' .ds L' ` .ds R' ' .ds M' ` .ds S' ' .ds N' ` .ds T' ' .ds PI \(*p 'br\} .\" If the F register is turned on, we'll generate .\" index entries out stderr for the following things: .\" TH Title .\" SH Header .\" Sh Subsection .\" Ip Item .\" X<> Xref (embedded .\" Of course, you have to process the output yourself .\" in some meaninful fashion. .if \nF \{ .de IX .tm Index:\\$1\t\\n%\t"\\$2" .. .nr % 0 .rr F .\} .TH lib::HTML::Entities 3 "perl 5.005, patch 03" "17/Sep/2000" "User Contributed Perl Documentation" .UC .if n .hy 0 .if n .na .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .de CQ \" put $1 in typewriter font .ft CW 'if n "\c 'if t \\&\\$1\c 'if n \\&\\$1\c 'if n \&" \\&\\$2 \\$3 \\$4 \\$5 \\$6 \\$7 '.ft R .. .\" @(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2 . \" AM - accent mark definitions .bd B 3 . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds ? ? . ds ! ! . ds / . ds q .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds ? \s-2c\h'-\w'c'u*7/10'\u\h'\*(#H'\zi\d\s+2\h'\w'c'u*8/10' . ds ! \s-2\(or\s+2\h'-\w'\(or'u'\v'-.8m'.\v'.8m' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' . ds q o\h'-\w'o'u*8/10'\s-4\v'.4m'\z\(*i\v'-.4m'\s+4\h'\w'o'u*8/10' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds v \\k:\h'-(\\n(.wu*9/10-\*(#H)'\v'-\*(#V'\*(#[\s-4v\s0\v'\*(#V'\h'|\\n:u'\*(#] .ds _ \\k:\h'-(\\n(.wu*9/10-\*(#H+(\*(#F*2/3))'\v'-.4m'\z\(hy\v'.4m'\h'|\\n:u' .ds . \\k:\h'-(\\n(.wu*8/10)'\v'\*(#V*4/10'\z.\v'-\*(#V*4/10'\h'|\\n:u' .ds 3 \*(#[\v'.2m'\s-2\&3\s0\v'-.2m'\*(#] .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E .ds oe o\h'-(\w'o'u*4/10)'e .ds Oe O\h'-(\w'O'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds v \h'-1'\o'\(aa\(ga' . ds _ \h'-1'^ . ds . \h'-1'. . ds 3 3 . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE . ds oe oe . ds Oe OE .\} .rm #[ #] #H #V #F C .SH "NAME" HTML::Entities \- Encode or decode strings with HTML entities .SH "SYNOPSIS" .PP .Vb 1 \& use HTML::Entities; .Ve .Vb 3 \& $a = "Våre norske tegn bør æres"; \& decode_entities($a); \& encode_entities($a, "\e200-\e377"); .Ve .SH "DESCRIPTION" This module deals with encoding and decoding of strings with HTML character entities. The module provides the following functions: .Ip "decode_entities($string)" 4 This routine replaces \s-1HTML\s0 entities found in the \f(CW$string\fR with the corresponding \s-1ISO\s0\-8859/1 (or with perl-5.6 Unicode) character. Unrecognized entities are left alone. .Ip "encode_entities($string, [$unsafe_chars])" 4 This routine replaces unsafe characters in \f(CW$string\fR with their entity representation. A second argument can be given to specify which characters to concider as unsafe. The default set of characters to expand are control chars, high-bit chars and the \*(L'<\*(R', \*(L'&\*(R', \*(L'>\*(R' and \*(L'"\*(R' characters. .PP Both routines modify the string passed as the first argument if called in a void context. In scalar and array contexts the encoded or decoded string is returned (and the argument string is left unchanged). .PP If you prefer not to import these routines into your namespace you can call them as: .PP .Vb 3 \& use HTML::Entities (); \& $encoded = HTML::Entities::encode($a); \& $decoded = HTML::Entities::decode($a); .Ve The module can also export the \f(CW%char2entity\fR and the \f(CW%entity2char\fR hashes which contain the mapping from all characters to the corresponding entities. .SH "COPYRIGHT" Copyright 1995-2000 Gisle Aas. All rights reserved. .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .rn }` '' .IX Title "lib::HTML::Entities 3" .IX Name "HTML::Entities - Encode or decode strings with HTML entities" .IX Header "NAME" .IX Header "SYNOPSIS" .IX Header "DESCRIPTION" .IX Item "decode_entities($string)" .IX Item "encode_entities($string, [$unsafe_chars])" .IX Header "COPYRIGHT"  kêªÛ� �¤�����������ÔF��Ê}·:G %:‚Õž:!������$��t��ÔF������./usr/local/lib/HTML-Parser-3.13/Changes�p.a�����������������ó/������¤�����������2000-09-17 Gisle Aas <gisle@ActiveState.com> Release 3.13 Experimental support for decoding of Unicode entities. 2000-09-14 Gisle Aas <gisle@ActiveState.com> Release 3.12 Some tweaks to get it to compile with "Optimierender Microsoft (R) 32-Bit C/C++-Compiler, Version 12.00.8168, fuer x86." Patch by Matthias Waldorf <matthias.waldorf@zoom.de>. HTML::Entities documentation spelling patch by David Dyck <dcd@tc.fluke.com>. 2000-08-22 Gisle Aas <gisle@ActiveState.com> Release 3.11 HTML::LinkExtor and eg/hrefsub now obtain %linkElements from the HTML::Tagset module. 2000-06-29 Gisle Aas <gisle@ActiveState.com> Release 3.10 Avoid core dump when stack gets relocated as the result of text handler invocation while $p->unbroken_text is enabled. Needed to refresh the stack pointer. 2000-06-28 Gisle Aas <gisle@ActiveState.com> Release 3.09 Avoid core dump if somebody clobbers the aliased $self argument of a handler. HTML::TokeParser documentation update suggested by Paul Makepeace <Paul.Makepeace@realprogrammers.com>. 2000-05-23 Gisle Aas <gisle@ActiveState.com> Release 3.08 Fix core dump for large start tags. Bug spotted by Alexander Fraser <green795@hotmail.com> Added yet another example program: eg/hanchors Typo fix by Jamie McCarthy <jamie@mccarthy.org> 2000-03-20 Gisle Aas <gisle@aas.no> Release 3.07 Fix perl5.004 builds (was broken in 3.06) Declaration parsing mode now only triggers for <!DOCTYPE ...> and <!ENTITY ...>. Based on patch by la mouton <kero@3sheep.com>. 2000-03-06 Gisle Aas <gisle@aas.no> Release 3.06 Multi-threading/MULTIPLICITY compilation fix. Both Doug MacEachern <dougm@pobox.com> and Matthias Urlichs <smurf@noris.net> provided a patch. Avoid some "statement not reached" warnings from picky compilers. Remove final commas in enums as ANSI C does not allow them and some compilers actually care. Patch by James Walden <jamesw@ichips.intel.com> Added eg/htextsub example program. 2000-01-22 Gisle Aas <gisle@aas.no> Release 3.05 Implemented $p->unbroken_text option Don't parse content of certain HTML elements as CDATA when xml_mode is enabled. Offset was reported with wrong sign for text at end of chunk. 2000-01-15 Gisle Aas <gisle@aas.no> Release 3.04 Backed out 3.03-patch that checked for legal handler and attribute names in the HTML::Parser constructor. Documentation typo fixed by Michael. 2000-01-14 Gisle Aas <gisle@aas.no> Release 3.03 We did not get out of comment mode for comments ending with an odd number of "-" before ">". Patch by la mouton <kero@3sheep.com> Documentation patch by Michael. 1999-12-21 Gisle Aas <gisle@aas.no> Release 3.02 Hide ~-magic IV-pointer to 'struct p_state' behind a reference. This allow copying of the internal _hparser_xs_state element, and will make HTML-Tree-0.61 work again. Introduced $p->init() which might be useful for subclasses that only want the initialization part of the constructor. Filled out DIAGNOSTICS section of the HTML::Parser POD. 1999-12-19 Gisle Aas <gisle@aas.no> Release 3.01 Rely on ~-magic instead of a DESTROY method to deallocate the internal 'struct p_state'. This avoid memory leaks when people simply wipe of the content of the object hash. One of the assertion in hparser.c had opposite logic. This made the parser fail when compiled with a -DDEBUGGING perl. Don't assume any specific order of hash keys in the t/cases.t. This test failed with some newer development releases of perl. 1999-12-14 Gisle Aas <gisle@aas.no> Release 3.00 Documentation update (most of it from Michael) Minor patch to eg/hstrip so that it use a "" handler instead of &ignore. Test suite patches from Michael 1999-12-13 Gisle Aas <gisle@aas.no> Release 2.99_96 Patches from Michael: - A handler of "" means that the event will be ignored. More efficient than using 'sub {}' as handler. - Don't use a perl hash for looking up argspec keywords. - Documentation tweaks. 1999-12-09 Gisle Aas <gisle@aas.no> Release 2.99_95 (this is a 3.00 candidate) Fixed core dump when "<" was followed by an 8-bit character. Spotted and test case provided by Doug MacEachern. Doug had been running HTML-Parser-XS through more that 1 million urls that had been downloaded via LWP. Handlers can now invoke $p->eof to request the parsing to terminate. HTML::HeadParser has been simplified by taking advantage of this. Also added a title-extraction example that uses this. Michael once again fixed my bad English in the HTML::Parser documentation. netscape_buggy_comment will carp instead of warn updated TODO/README Documented that HTML::Filter is depreciated. Made backslash reserved in literal argspec strings. Added several new test scripts. 1999-12-08 Gisle Aas <gisle@aas.no> Release 2.99_94 (should almost be a 3.00 candidate) Renamed 'cdata_flag' as 'is_cdata'. Dropped support for wrapping callback handler and argspec in an array and passing a reference to $p->handler. It created ambiguities when you want to pass a array as handler destination and not update argspec. The wrapping for constructor arguments are unchanged. Reworked the documentation after updates from Michael. Simplified internal check_handler(). It should probably simply be inlined in handler() again. Added argspec 'length' and 'undef' Fix statement-less label. Fix suggested by Matthew Langford <langfml@Eng.Auburn.EDU>. Added two more example programs: eg/hstrip and eg/htext. Various minor patches from Michael. 1999-12-07 Gisle Aas <gisle@aas.no> Release 2.99_93 Documentation update $p->bool_attr_value renamed as $p->boolean_attribute_value Internal renaming: attrspec --> argspec Introduced internal 'enum argcode' in hparser.c Added eg/hrefsub 1999-12-05 Gisle Aas <gisle@aas.no> Release 2.99_92 More documentation patches from Michael Renamed 'token1' as 'token0' as suggested by Michael For artificial end tags we now report 'tokens', but not 'tokenpos'. Boolean attribute values show up as (0, 0) in 'tokenpos' now. If $p->bool_attr_value is set it will influence 'tokens' Fix for core dump when parsing <a "> when $p->strict_names(0). Based on fix by Michael. Will av_extend() the tokens/tokenspos arrays. New test suite script by Michael: t/attrspec.t 1999-12-04 Gisle Aas <gisle@aas.no> Release 2.99_91 Implemented attrspec 'offset' Documentation patch from Michael Some more cleanup/updated TODO 1999-12-03 Gisle Aas <gisle@aas.no> Release 2.99_90 (first beta for 3.00) Using "realloc" as a parameter name in grow_tokens created problems for some people. Fix by Paul Schinder <schinder@pobox.com> Patch by Michael that makes array handler destinations really work. Patch by Michael that make HTML::TokeParser use this. This gave a a speedup of about 80%. Patch by Michael that makes t/cases into a real test. Small HTML::Parser documentation patch by Michael. Renamed attrspec 'origtext' to 'text' and 'decoded_text' to 'dtext' Split up Parser.xs. Moved stuff into hparser.c and util.c Dropped html_ prefix from internal parser functions. Renamed internal function html_handle() as report_event(). 1999-12-02 Gisle Aas <gisle@aas.no> Release 2.99_17 HTML::Parser documentation patch from Michael. Fix memory leaks in html_handler() Patch that makes an array legal as handler destination. Also from Michael. The end of marked sections does not eat successive newline any more. The artificial end event for empty tag in xml_mode did not report an empty origtext. New constructor option: 'api_version' 1999-12-01 Gisle Aas <gisle@aas.no> Release 2.99_16 Support "event" in argspec. It expands to the name of the handler (minus "default"). Fix core dump for large start tags. The tokens_grow() routine needed an adjustment. Added test for this; t/largstags.t. 1999-11-30 Gisle Aas <gisle@aas.no> Release 2.99_15 Major restructuring/simplification of callback interface based on initial work by Michael. The main news is that you now need to tell what arguments you want to be provided to your callbacks. The following parser options has been eliminated: $p->decode_text_entities $p->keep_case $p->v2_compat $p->pass_self $p->attr_pos 1999-11-26 Gisle Aas <gisle@aas.no> Release 2.99_14 Documentation update by Michael A. Chase. Fix for declaration parsing by Michael A. Chase. Workaround for perl5.004_05 bug. Can't return &PL_sv_undef. 1999-11-22 Gisle Aas <gisle@aas.no> Release 2.99_13 New Parser.pm POD based on initial work by Michael A. Chase. All new features should now be described. $p->callback(start => undef) will not reset the callback. $p->xml_mode() did not parse attributes correct because HCTYPE_NOT_SPACE_EQ_SLASH_GT flag was never set. A few more tests. 1999-11-18 Gisle Aas <gisle@aas.no> Release 2.99_12 Implemented $p->attr_pos attribute. This causes attr positions within $origtext of the start tag to be reported instead of the attribute values. The positions are reported as 4 numbers; end of previous attr, start of this attr, start of attr value, and end of attr. This should make substr() manipulations of $origtext easy. Implemented $p->unbroken_text attribute. This makes sure that text segments are never broken and given back as separate text callbacks. It delays text callbacks until some other markup has been recognized. More English corrections by Michael A. Chase. HTML::LinkExtor now recognizes even more URI attributes as suggested by Sean M. Burke <sburke@netadventure.net> Completed marked sections support. It is also now a compile time decision if you want this supported or not. The only drawback of enabling it should be a possible parsing speed reduction. I have not measured this yet. The keys for callbacks initialized in the constructor are now suffixed with "_cb". Renamed $p->pass_cbdata to $p->pass_self. Added magic number to the p_state struct. 1999-11-17 Gisle Aas <gisle@aas.no> Release 2.99_11 Don't leak $@ modifications from HTML::Parser constructor. Included HTML::Parser POD. Marked sections almost work. CDATA and RCDATA should work. For tags that take us into literal_mode; <script>, <style>, <xmp>, we did not recognize the end tag unless it was written in all lower case. 1999-11-16 Gisle Aas <gisle@aas.no> Release 2.99_10 The mkhctype and mkpfunc scripts were using \z inside RE. This did not work for perl5.004. Replaced them with plain old dollar signs. 1999-11-15 Gisle Aas <gisle@aas.no> Release 2.99_09 Grammar fixes by Michael A. Chase <mchase@ix.netcom.com> Some more test suite patches for Win32 by Michael A. Chase <mchase@ix.netcom.com> Implemented $p->strict_names attribute. By default we now allow almost anything in tag and attribute names. This is much closer to the behaviour of some popular browsers. This allows us to parse broken tags like this example from the LWP mailing list: <IMG ALIGN=MIDDLE SRC=newprevlstGr.gif ALT=[PREV LIST] BORDER=0> Introduced some tables in "hctype.h" and "pfunc.h". These are built by the corresponding "mk..." script. 1999-11-10 Gisle Aas <gisle@aas.no> Release 2.99_08 Make Parser.xs compile on perl5.004_05 too. New callback called 'default'. This will be called for any document text no other callback shows an interest in. Patch by Michael A. Chase <mchase@ix.netcom.com> that should help clean up files for the test suite on Win32. Can now set up various attributes with key/value pairs passed to the constructor. $p->parse_file() will open the file in binmode() Pass complete processing instruction tag as second argument to process callback. New boolean attribute v2_compat. This influences how attributes are reported for start tags. HTML::Filter now filters process instructions too. Faster HTML::LinkExtor by taking advantage of the new callback interface. The module now also uses URI.pm (instead of the old URI::URL) to do URI-absolutations. Faster HTML::TokeParser by taking advantage of new accum interface. 1999-11-09 Gisle Aas <gisle@aas.no> Release 2.99_07 Entities in attribute values are now always expanded. If you set the $p->decode_text_entities to a true value, then you don't have to decode the text yourself. In xml_mode we don't report empty element tags as a start tag with an extra parameter any more. Instead we generate an artificial end tag. 'xml_mode' now implies 'keep_case'. The parser now keeps its own copy of the bool_attr_value value. Avoid memory leak for text callbacks Avoid using ERROR as a goto label. Introduced common internal accessor function for all boolean parser attributes. Tweaks to make Parser.xs compile under perl5.004. 1999-11-08 Gisle Aas <gisle@aas.no> Release 2.99_06 Internal fast decode_entities(). By using it we are able to make the HTML::Entities::decode function 6 times faster than the old one implemented in pure Perl. $p->bool_attr_value() can be set to influence the value that boolean attributes will be assigned. The default is to assign a value identical to the attribute name. Process instructions are reported as "PI" in @accum $p->xml_mode(1) modifies how processing instructions are terminated and allows "/>" at the end of start tags. Turn off optimizations when compiling with gcc on Solaris. Avoids what we believe to be a compiler bug. Should probably figure out which versions of gcc have this bug. 1999-11-05 Gisle Aas <gisle@aas.no> Release 2.99_05 The previous release did not even compile. I forgot to try 'make test' before uploading. 1999-11-05 Gisle Aas <gisle@aas.no> Release 2.99_04 Generalized <XMP>-support to cover all literal parsing. Currently activated for <script>, <style>, <xmp> and <plaintext>. 1999-11-05 Gisle Aas <gisle@aas.no> Release 2.99_03 <XMP>-support. Allow ":" in tag and attribute names Include rest of the HTML::* files from the old HTML::Parser package. This should make testing easier. 1999-11-04 Gisle Aas <gisle@aas.no> Release 2.99_02 Implemented keep_case() option. If this attribute is true, then we don't lowercase tag and attribute names. Implemented accum() that takes an array reference. Tokens are pushed onto this array instead of sent to callbacks. Implemented strict_comment(). 1999-11-03 Gisle Aas <gisle@aas.no> Release 2.99_01 Baseline of XS implementation 1999-11-05 Gisle Aas <gisle@aas.no> Release 2.25 Allow ":" in attribute names as a workaround for Microsoft Excel 2000 which generates such files. Make deprecate warning if netscape_buggy_comment() method is used. The method is used in strict_comment(). Avoid duplication of parse_file() method in HTML::HeadParser. 1999-10-29 Gisle Aas <gisle@aas.no> Release 2.24 $p->parse_file() will not close a handle passed to it any more. If passed a filename that can't be opened it will return undef instead of raising an exception, and strings like "*STDIN" are not treated as globs any more. HTML::LinkExtor knowns about background attribute of <tables>. Patch by Clinton Wong <clintdw@netcom.com> HTML::TokeParser will parse large inline strings much faster now. The string holding the document must not be changed during parsing. 1999-06-09 Gisle Aas <gisle@aas.no> Release 2.23 Documentation updates. 1998-12-18 Gisle Aas <aas@sn.no> Release 2.22 Protect HTML::HeadParser from evil $SIG{__DIE__} hooks. 1998-11-13 Gisle Aas <aas@sn.no> Release 2.21 HTML::TokeParser can now parse strings directly and does the right thing if you pass it a GLOB. Based on patch by Sami Itkonen <si@iki.fi>. HTML::Parser now allows space before and after "--" in Netscape comments. Patch by Peter Orbaek <poe@daimi.au.dk>. 1998-07-08 Gisle Aas <aas@sn.no> Release 2.20 Added HTML::TokeParser. Check it out! 1998-07-07 Gisle Aas <aas@sn.no> Release 2.19 Don't end a text chunk with space when we try to avoid breaking up words. 1998-06-22 Gisle Aas <aas@sn.no> Release 2.18 HTML::HeadParser->parse_file will now stop parsing when the <body> starts as it should. HTML::LinkExtor more easily subclassable by introducing the $self->_found_link method. 1998-04-28 Gisle Aas <aas@sn.no> Release 2.17 Never split words (a sequence of non-space) between two invocations of $self->text. This is just a simplification of the code that tried not to break entities. HTML::Parser->parse_file now use smaller chunks as already suggested by the HTML::Parser documentation. 1998-04-02 Gisle Aas <aas@sn.no> Release 2.16 The HTML::Parser could some times break hex entites (like ￿) in the middle. Removed remaining forced dependencies on libwww-perl modules. It means that all tests should now pass, even if libwww-perl was not installed previously. More tests. 1998-04-01 Gisle Aas <aas@sn.no> Release 2.14, HTML::* modules unbundled from libwww-perl-5.22. ult  kêX��¤�����������³ ��Ê}·:G %:‚Õž:!������$ ��Š��³ ������./usr/local/lib/HTML-Parser-3.13/MANIFEST�.a�����������������ó/������¤�����������ANNOUNCEMENT Changes History of this package MANIFEST This file README The Instructions Makefile.PL Will create 'Makefile' to build this extention Parser.pm Bootstrap & documentation Parser.xs XS glue TODO Ideas and things still left to do eg/hanchors Extract all links from a document eg/hrefsub Do substitutions on link attributes eg/hstrip Stip away certains tags/elements and attributes eg/htext Leave only the text eg/htextsub Do substitutions only on the text content eg/htitle Extract document title hints/solaris.pl Avoid compiler bug hparser.h Parser implementation (data structures) hparser.c Parser implementation lib/HTML/Entities.pm Encode and decode entities in strings lib/HTML/Filter.pm HTML::Filter class lib/HTML/HeadParser.pm HTML::HeadParser class lib/HTML/LinkExtor.pm HTML::LinkExtor class lib/HTML/TokeParser.pm HTML::TokeParser class mkhctype Generates 'hctype.h' mkpfunc Generates 'pfunc.h' tokenpos.h Dynamically sized token_pos arrays typemap Convert between HTML::Parser and 'struct p_state' t/api_version.t Test api_version constructor option t/argspec.t Test argspec t/argspec-bad.t Test various bad argspec arguments t/cases.t Test various interesting cases t/comment.t Test comment parsing t/crashme.t Parse random data t/declaration.t Test declaration parsing t/default.t Test default handler t/dtext.t Test dtext decoding of entities t/entities.t Test encoding/decoding of entities t/filter.t Test HTML::Filter t/handler.t Test $p->handler method t/handler-eof.t Test invocation of $p->eof in handlers t/headparser.t Test HTML::HeadParser t/headparser-http.t Test HTML::HeadParser t/ignore.t Test elements ignored by handler = '' or 0 t/largetags.t Test with very large tags t/linkextor-base.t Test HTML::LinkExtor t/linkextor-rel.t Test HTML::LinkExtor t/magic.t Test that checking magic head in p_state works t/marked-sect.t Test marked section support t/offset.t Test attrspec offset t/options.t Test set/get for various parser options t/parser.t Test HTML::Parser subclassing t/parsefile.t Test the $p->parse_file() method t/process.t Test process instruction support t/tokeparser.t Test HTML::TokeParser t/uentities.t Test encoding/decoding of Unicode entities t/unbroken-text.t Test unbroken_text option t/xml-mode.t Test parsing in XML mode util.c Some utility functions style kê S��¤�����������r��Ê}·:G %:‚Õž:!������$ ��˜��r������./usr/local/lib/HTML-Parser-3.13/README��������������ó/������¤�����������HTML-Parser ----------- This is a collection of modules that parse and extract information from HTML documents. Bug reports and discussions about these modules can be sent to the <libwww@perl.org> mailing list. Remember to also look at the HTML-Tree package that creates and extracts information from HTML syntax trees. The modules present in this collection are: HTML::Parser - The parser base class. It receives arbitrary sized chunks of the HTML text, recognizes markup elements, and separates them from the plain text. As different kinds of markup and text are recognized, the corresponding event handlers are invoked. HTML::Entities - Provides functions to encode and decode text with embedded HTML <entities>. HTML::HeadParser - A lightweight HTML::Parser subclass that extracts information from the <HEAD> section of an HTML document. HTML::LinkExtor - An HTML::Parser subclass that extracts links from an HTML document. HTML::TokeParser - An alternative interface to the basic parser that does not require event driven programming. Most simple parsing needs are probably best attacked with this module. Depreciated modules: HTML::Filter - An HTML::Parser subclass that filters HTML text. You will need to make a subclass if you want it to do more than cat(1). PREREQUISITES In order to install and use this package you will need Perl version 5.004 or better. If you intend to use the HTML::HeadParser you need to have libwww-perl installed. INSTALLATION Just follow the usual procedure: perl Makefile.PL make make test make install COPYRIGHT © 1995-2000 Gisle Aas. All rights reserved. © 1999-2000 Michael A. Chase. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. nkExto kêÐÉ��¤�������������Ê}·:G %:‚Õž:!������$ ��š��������./usr/local/lib/HTML-Parser-3.13/ANNOUNCEMENT����������������ó/������¤�����������Subject: HTML-Parser-3.00 After 6 weeks, 17 alpha releases and 7 betas we are now ready to release HTML-Parser-3.00. We would like to thank the CPAN testers team and especially Paul Schinder who helped us avoid many platform compatibility problems. HTML-Parser-3.00 is a complete rewrite of the HTML::Parser core in C with XS bindings. The new parser is significantly faster and has new features that allow better control over HTML and XML document parsing. The speedup when compared to HTML-Parser-2.25 is between 3x and 50x depending on what you are doing. The new parser interface is completely compatible with HTML-Parser-2.25, but some parts of an HTML document are recognized differently: - Anything inside <script> and <style> is returned as cdata text. HTML-Parser-2.25 recognizes markup within these sections. The same is true for the depreciated <xmp> and <plaintext> tags. - Nearly any characters are allowed in tag and attribute names. Previously, strange characters in names caused tags to be parsed as text. This behaviour can be overridden to enforce strict tag and attribute naming. - Processing instruction (<?...> or <?...?>) are reported via the process event handler. New features include: - Direct callbacks to avoid Perl's slower method calls. - Array storage of element information to avoid callbacks completely. - The arguments passed to callbacks or arrays are separately selectable for each element type. This allows more flexibility and faster argument preparation. It also allows more argument types to be added later without interfering with existing programs. - The byte positions of tokens within an element can be reported. This allows direct editing of the token with substr() instead of having to guess where the token is located. - Callbacks can abort parsing. - Marked sections are recognized and applied, but not reported. - XML mode. - Working examples are provided to demonstrate the new features. Enjoy! -- Michael A. Chase and Gisle Aas kêÏ��¤�����������?��Ê}·:G %:‚Õž:!������$0��¡��?������./usr/local/lib/HTML-Parser-3.13/TODO�NC�������������ó/������¤�����������TODO - remove 255 char limit on literal argspec strings - implement backslash escapes in literal argspec string - report 'line' - utf8 mode (where entities expand to utf8 chars instead of latin1 chars) - <![%app1;[...]]> (parameter entities) - $p->ignore_element("script", "style"); - $p->ignore_tag("font", "big", "small"); - limit the length of markup elements that never end. Perhaps by configurable limits on the length that markup can have and still be recongnized. - pic attribute (">" or "?>" are defaults) useful where you want to have "?>" as pic, but don't want the rest of xml_mode. For instance to parse PHP files. SGML FEATURES WE WILL PROBABLY IGNORE FOREVER - Empty tags: <> </> (repeat previous start tag) - <foo<bar> (same as <foo><bar>) - NET tags <name/.../ POSSIBLE OPTIMIZATIONS - none that I can think of right now - run the profiler MINOR "BUGS" (alias FEATURES) - no way to clear "boolean_attribute_value". - <plaintext> ends with </plaintext> and can't be escaped. - <style> and <script> do not end with the first "</". n k긇��í�����������3��Ê}·:G %:‚Õž:!������$0��¢��3������./usr/local/lib/HTML-Parser-3.13/mkhctype�ENT����������������ó/������í�����������#!/usr/bin/perl ($progname = $0) =~ s,.*/,,; print "/* This file is autogenerated by $progname */\n"; print <<'EOT'; #define HCTYPE_SPACE 0x01 #define HCTYPE_NAME_FIRST 0x02 #define HCTYPE_NAME_CHAR 0x04 #define HCTYPE_NOT_SPACE_GT 0x08 #define HCTYPE_NOT_SPACE_EQ_GT 0x10 #define HCTYPE_NOT_SPACE_SLASH_GT 0x20 #define HCTYPE_NOT_SPACE_EQ_SLASH_GT 0x40 #define HCTYPE(c) hctype[(unsigned char)(c)] #define isHCTYPE(c, w) (HCTYPE(c) & (w)) #define isHSPACE(c) isHCTYPE(c, HCTYPE_SPACE) #define isHNAME_FIRST(c) isHCTYPE(c, HCTYPE_NAME_FIRST) #define isHNAME_CHAR(c) isHCTYPE(c, HCTYPE_NAME_CHAR) #define isHNOT_SPACE_GT(c) isHCTYPE(c, HCTYPE_NOT_SPACE_GT) typedef unsigned char hctype_t; EOT print "static hctype_t hctype[] = {\n"; for my $c (0 .. 255) { print " " unless $c % 8; local $_ = chr($c); my $v = 0; if (/^\s$/ || $c == 0xa0) { # isSPACE $v |= 0x1 } elsif ($_ ne ">") { $v |= 0x08; $v |= 0x10 if $_ ne "="; $v |= 0x20 if $_ ne "/"; $v |= 0x40 if $_ ne "="; } if (/^[\w.\-:]$/) { $v |= 0x4; $v |= 0x2 unless /^[\d.-]$/; # XML allow /[:_]/ as first char } printf "0x%02x, ", $v; unless (($c+1) % 8) { printf " /* %3d - %3d */\n", $c - 7, $c; } } print "};\n"; eleme kêι��í�����������S��Ê}·:G %:‚Õž:!������$0��£��S������./usr/local/lib/HTML-Parser-3.13/mkpfunc��ENT����������������ó/������í�����������#!/usr/bin/perl ($progname = $0) =~ s,.*/,,; print "/* This file is autogenerated by $progname */\n"; print "typedef char*(*PFUNC)(PSTATE*, char *beg, char *end, STRLEN offset, SV* self);\n"; print "static PFUNC parsefunc[] = {\n"; for my $c (0..255) { local $_ = chr($c); my $func = "null"; if (/^[A-Za-z]$/) { $func = "start"; } elsif ($_ eq "/") { $func = "end"; } elsif ($_ eq "!") { $func = "decl"; } elsif ($_ eq "?") { $func = "process"; } printf " %-20s /* %3d */\n", "parse_$func,", $c; } print "};\n"; YPE(c kêÎ’�G�¤�����������M��Ê}·:G %:‚Õž:!������0��ÿµ��M������./usr/local/lib/HTML-Parser-3.13/t/xml-mode.t����������������ó/������¤�����������use strict; print "1..3\n"; use HTML::Parser (); my $p = HTML::Parser->new(xml_mode => 1, ); my $text = ""; $p->handler(start => sub { my($tag, $attr) = @_; $text .= "S[$tag"; for my $k (sort keys %$attr) { my $v = $attr->{$k}; $text .= " $k=$v"; } $text .= "]"; }, "tagname,attr"); $p->handler(end => sub { $text .= "E[" . shift() . "]"; }, "tagname"); $p->handler(process => sub { $text .= "PI[" . shift() . "]"; }, "token0"); $p->handler(text => sub { $text .= shift; }, "text"); my $xml = <<'EOT'; <?xml version="1.0"?> <?IS10744:arch name="html"?><!-- comment --> <DOC> <title html="h1">My first architectual document Geir Ove Gronmo, grove@infotek.no This is the first paragraph in this document This is the second paragraph <foo></foo> EOT $p->parse($xml)->eof; print "not " unless $text eq <<'EOT'; print "ok 1\n"; PI[xml version="1.0"] PI[IS10744:arch name="html"] S[DOC] S[title html=h1]My first architectual documentE[title] S[author html=address]Geir Ove Gronmo, grove@infotek.noE[author] S[para]This is the first paragraph in this documentE[para] S[para html=p]This is the second paragraphE[para] S[para]E[para] S[xmp]S[foo]E[foo]E[xmp] E[DOC] EOT $text = ""; $p->xml_mode(0); $p->parse($xml)->eof; print "not " unless $text eq <<'EOT'; print "ok 2\n"; PI[xml version="1.0"?] PI[IS10744:arch name="html"?] S[doc] S[title html=h1]My first architectual documentE[title] S[author html=address]Geir Ove Gronmo, grove@infotek.noE[author] S[para]This is the first paragraph in this documentE[para] S[para html=p]This is the second paragraphE[para] S[para/] S[xmp]E[xmp] E[doc] EOT # Test that we get an empty tag back $p = HTML::Parser->new(api_version => 3, xml_mode => 1); $p->handler("end" => sub { my($tagname, $text) = @_; print "not " unless $tagname eq "Xyzzy" && !length($text); print "ok 3\n"; }, "tagname,text"); $p->parse("and some more")->eof; rse kêŒèG¤�±Ë}·:G %:‚Õž:!0¶±./usr/local/lib/HTML-Parser-3.13/t/filter.ttó/¤�print "1..2\n"; my $HTML = <

Bar

123
EOT use HTML::Filter; use SelectSaver; my $tmpfile = "test-$$.htm"; die "$tmpfile already exists" if -e $tmpfile; open(HTML, ">$tmpfile") or die "$!"; { my $save = new SelectSaver(HTML); HTML::Filter->new->parse($HTML)->eof; } close(HTML); open(HTML, $tmpfile) or die "$!"; local($/) = undef; my $FILTERED = ; close(HTML); #print $FILTERED; print "not " unless $FILTERED eq $HTML; print "ok 1\n"; { package MyFilter; @ISA=qw(HTML::Filter); sub comment {} sub output { push(@{$_[0]->{fhtml}}, $_[1]) } sub filtered_html { join("", @{$_[0]->{fhtml}}) } } my $f2 = MyFilter->new->parse_file($tmpfile)->filtered_html; unlink($tmpfile) or warn "Can't unlink $tmpfile: $!"; #print $f2; print "not " unless $f2 !~ /Foo/ && $f2 =~ /Bar/; print "ok 2\n"; ->parse kêò+ G¤�� Ë}·:G %:‚Õž:! ¶� ./usr/local/lib/HTML-Parser-3.13/t/tokeparser.tó/¤�print "1..6\n"; use strict; use HTML::TokeParser; # First we create an HTML document to test my $file = "ttest$$.htm"; die "$file already exists" if -e $file; open(F, ">$file") or die "Can't create $file: $!"; print F <<'EOT'; close(F); This is the <title>

This is the title again

And this is a link to the Perl Institute EOT END { unlink($file) || warn "Can't unlink $file: $!"; } my $p; $p = HTML::TokeParser->new($file) || die "Can't open $file: $!"; if ($p->get_tag("title")) { my $title = $p->get_trimmed_text; #print "Title: $title\n"; print "not " unless $title eq "This is the "; print "ok 1\n"; } undef($p); # Test with reference to glob open(F, $file) || die "Can't open $file: $!"; $p = HTML::TokeParser->new(\*F); my $scount = 0; my $ecount = 0; my $tcount = 0; my $pcount = 0; while (my $token = $p->get_token) { $scount++ if $token->[0] eq "S"; $ecount++ if $token->[0] eq "E"; $pcount++ if $token->[0] eq "PI"; } undef($p); close F; # Test with glob open(F, $file) || die "Can't open $file: $!"; $p = HTML::TokeParser->new(*F); $tcount++ while $p->get_tag; undef($p); close F; # Test with plain file name $p = HTML::TokeParser->new($file) || die; $tcount++ while $p->get_tag; undef($p); print "Number of tokens found: $tcount/2 = $scount + $ecount\n"; print "Number of process instruction found: $pcount\n"; print "not " unless $tcount == 32 && $scount == 9 && $ecount == 7 && $pcount == 1; print "ok 2\n"; print "not " if HTML::TokeParser->new("/noT/thEre/$$"); print "ok 3\n"; $p = HTML::TokeParser->new($file) || die; $p->get_tag("a"); my $atext = $p->get_text; undef($p); #print "ATEXT: $atext\n"; print "not " unless $atext eq "Perl\240Institute"; print "ok 4\n"; # test parsing of embeded document $p = HTML::TokeParser->new(\<<HTML); <title>Title

Heading

HTML print "not " unless $p->get_tag("h1") && $p->get_trimmed_text eq "Heading"; print "ok 5\n"; undef($p); # test parsing of large embedded documents my $doc = "foo is bar\n\n\n" x 2022; #use Time::HiRes qw(time); my $start = time; $p = HTML::TokeParser->new(\$doc); print "Contruction time: ", time - $start, "\n"; my $count; while (my $t = $p->get_token) { $count++ if $t->[0] eq "S"; } print "Parse time: ", time - $start, "\n"; print "not " unless $count == 2022; print "ok 6\n"; pa kê0@ G¤�ÊË}·:G %:‚Õž:!0¶Ê./usr/local/lib/HTML-Parser-3.13/t/linkextor-rel.tó/¤�print "1..4\n"; require HTML::LinkExtor; $HTML = < This is link and an Image. HTML # Try the callback interface $links = ""; $p = HTML::LinkExtor->new( sub { my($tag, %links) = @_; print "$tag @{[%links]}\n"; $links .= "$tag @{[%links]}\n"; }); $p->parse($HTML); $p->eof; $links =~ m|^base href http://www\.sn\.no/$|m or print "not "; print "ok 1\n"; $links =~ m|^body background http://www\.sn\.no/sn\.gif$|m or print "not "; print "ok 2\n"; $links =~ m|^a href link\.html$|m or print "not "; print "ok 3\n"; # Used to be problems when using the links method on a document with # no links it it. This is a test to prove that it works. $p = new HTML::LinkExtor; $p->parse("this is a document with no links"); $p->eof; @a = $p->links; print "not " if @a != 0; print "ok 4\n"; to gl kê; G¤�!Ë}·:G %:‚Õž:!0¶!./usr/local/lib/HTML-Parser-3.13/t/linkextor-base.tó/¤�# This test that HTML::LinkExtor really absolutize links correctly # when a base URL is given to the constructor. eval { require URI; }; if ($@) { print "1..0\n"; print $@; exit; } print "1..5\n"; require HTML::LinkExtor; # Try with base URL and the $p->links interface. $p = HTML::LinkExtor->new(undef, "http://www.sn.no/foo/foo.html"); $p->parse(<eof; This is link and an Image. HTML @p = $p->links; # There should be 4 links in the document print "not " if @p != 4; print "ok 1\n"; for (@p) { ($t, %attr) = @$_ if $_->[0] eq 'img'; print "@$_\n"; } $t eq 'img' || print "not "; print "ok 2\n"; delete $attr{src} eq "http://www.sn.no/foo/img.jpg" || print "not "; print "ok 3\n"; delete $attr{lowsrc} eq "http://www.sn.no/foo/img.gif" || print "not "; print "ok 4\n"; scalar(keys %attr) && print "not "; # there should be no more attributes print "ok 5\n"; my $sc kêüÑ G¤�Ë}·:G %:‚Õž:!0¶./usr/local/lib/HTML-Parser-3.13/t/crashme.tbasó/¤�#!/usr/bin/perl # This test will simply run the parser on random junk. my $no_tests = shift || 3; print "1..$no_tests\n"; use HTML::Parser (); my $file = "junk$$.html"; die if -e $file; for (1..$no_tests) { open(JUNK, ">$file") || die; for (1 .. rand(5000)) { for (1 .. rand(200)) { print JUNK pack("N", rand(2**32)); } print JUNK ("<", "&", ">")[rand(3)]; # make these a bit more likely } close(JUNK); print "Parse @{[-s $file]} bytes of junk\n"; HTML::Parser->new->parse_file($file); print "ok $_\n"; print_mem(); } unlink($file); sub print_mem { # this probably only works on Linux open(STAT, "/proc/self/status") || return; while () { print if /^VmSize/; } } p kê²ö G¤�`Ë}·:G %:‚Õž:!0¶`./usr/local/lib/HTML-Parser-3.13/t/default.tbasó/¤�use strict; print "1..3\n"; my $text = ""; use HTML::Parser (); my $p = HTML::Parser->new(default_h => [sub { $text .= shift }, "text"], ); my $html = <<'EOT'; foo EOT $p->parse($html)->eof; print "not " unless $text eq $html; print "ok 1\n"; $text = ""; $p->handler(start => sub { }, ""); $p->handler(declaration => sub { }, ""); $p->parse($html)->eof; my $html2; $html2 = $html; $html2 =~ s///; $html2 =~ s/<!DOCTYPE[^>]*>//; print "not " unless $text eq $html2; print "ok 2\n"; $text = ""; $p->handler(start => undef); $p->parse($html)->eof; $html2 = $html; $html2 =~ s/<!DOCTYPE[^>]*>//; print "not " unless $text eq $html2; print "ok 3\n";  kêêå�G�¤�����������S ��Ë}·:G %:‚Õž:!������ ��¶��S ������./usr/local/lib/HTML-Parser-3.13/t/headparser.t��������������ó/������¤�����������print "1..3\n"; { package H; sub new { bless {}, shift; } sub header { my $self = shift; my $key = uc(shift); my $old = $self->{$key}; if (@_) { $self->{$key} = shift; } $old; } sub push_header { my($self, $k, $v) = @_; $k = uc($k); if (exists $self->{$k}) { $self->{$k} = [ $self->{$k} ] unless ref $self->{$k}; push(@{$self->{$k}}, $v); } else { $self->{$k} = $v; } } sub as_string { my $self = shift; my $str = ""; for (sort keys %$self) { if (ref($self->{$_})) { my $v; for $v (@{$self->{$_}}) { $str .= "$_: $v\n"; } } else { $str .= "$_: $self->{$_}\n"; } } $str; } } $HTML = <<'EOT'; <title>Å være eller å ikke være Dette er vanlig tekst. Denne teksten definerer også slutten på <head> delen av dokumentet. Dette er også vanlig tekst som ikke skal blir parset i det hele tatt. EOT $| = 1; #$HTML::HeadParser::DEBUG = 1; require HTML::HeadParser; $p = HTML::HeadParser->new( H->new ); $bad = 0; print "\n#### Parsing full text...\n"; if ($p->parse($HTML)) { $bad++; print "Need more data which should not happen\n"; } else { print $p->as_string; } $p->header('Title') =~ /Å være eller å ikke være/ or $bad++; $p->header('Expires') eq 'Soon' or $bad++; $p->header('Content-Base') eq 'http://www.sn.no' or $bad++; $p->header('Link') =~ // or $bad++; # This header should not be present because the head ended $p->header('Isindex') and $bad++; print "not " if $bad; print "ok 1\n"; # Try feeding one char at a time print "\n\n#### Parsing once char at a time...\n"; $expected = $p->as_string; $p = HTML::HeadParser->new(H->new); while ($HTML =~ /(.)/sg) { print $1; $p->parse($1) or last; } print "«««« Enough!!\n"; $got = $p->as_string; print "$got"; print "not " if $expected ne $got; print "ok 2\n"; # Try reading it from a file print "\n\n#### Parsing from file\n\n"; my $file = "hptest$$.html"; die "$file already exists" if -e $file; open(FILE, ">$file") or die "Can't create $file: $!"; print FILE $HTML; print FILE "

This is more content...

\n" x 2000; print FILE "Buuuh!\n" x 200; close FILE or die "Can't close $file: $!"; $p = HTML::HeadParser->new(H->new); $p->parse_file($file); unlink($file) or warn "Can't unlink $file: $!"; print $p->as_string; print "not " if $p->header("Title") ne "Å være eller å ikke være"; print "ok 3\n"; g and kêúìG¤��Ë}·:G %:‚Õž:!0!¶�./usr/local/lib/HTML-Parser-3.13/t/handler-eof.t.tó/¤�print "1..5\n"; use strict; use HTML::Parser (); my $p = HTML::Parser->new(api_version => 3); $p->handler(start => sub { my $attr = shift; print "ok $attr->{testno}\n" }, "attr"); $p->handler(end => sub { shift->eof }, "self"); my $text; $p->handler(text => sub { $text = shift }, "text"); print "not " unless $p->parse("") == $p; print "ok 2\n"; $text = ''; print "not " if $p->parse(""); print "ok 3\n"; print "not " if $text; print "ok 4\n"; $p->handler(end => sub { $p->parse("foo"); }, ""); eval { $p->parse(""); }; print "not " unless $@ && $@ =~ /Parse loop not allowed/; print "ok 5\n"; n kêJ G¤� Ë}·:G %:‚Õž:!0"¶ ./usr/local/lib/HTML-Parser-3.13/t/uentities.ttó/¤�# Test Unicode entities BEGIN { if ($] < 5.006) { print "This perl does not support Unicode\n"; print "1..0\n"; exit; } } use HTML::Entities; unless (&HTML::Entities::UNICODE_SUPPORT) { print "Unicode entities not selected\n"; print "1..0\n"; exit; } print "1..10\n"; print "not " unless decode_entities("&euro") eq "\x{20AC}"; print "ok 1\n"; print "not " unless decode_entities("å") eq "å"; print "ok 2\n"; print "not " unless decode_entities("񺄠") eq chr(500000); print "ok 3\n"; print "not " unless decode_entities("￿") eq "\x{FFFF}"; print "ok 4\n"; print "not " unless decode_entities("􏿿") eq chr(0x10FFFF); print "ok 5\n"; print "not " unless decode_entities("�") eq chr(0xFFFF_FFFF); print "ok 6\n"; print "not " unless decode_entities("�") eq "\0" && decode_entities("�") eq "\0" && decode_entities("�") eq "\0" && decode_entities("�") eq "\0"; print "ok 7\n"; print "not " unless decode_entities("&#ååå࿿") eq "&#ååå\x{FFF}"; print "ok 8\n"; # This might fail when we get more than 64 bit UVs print "not " unless decode_entities("�") eq "�" and decode_entities("�") eq "�"; print "ok 9\n"; my $err; for ([32, 48], [120, 169], [240, 250], [250, 260], [3000, 3005]) { my $a = join("", map chr, $_->[0] .. $_->[1]); #print join(", ", unpack("U*", $a)), "\n"; my $e = encode_entities($a); my $d = decode_entities($e); print "\n$_->[0] .. $_->[1]\n"; #print "$a\n"; print "$e\n"; unless ($d eq $a) { print "Wrong decoding in range $_->[0] .. $_->[1]\n"; $err++; } } print "not " if $err; print "ok 10\n";  kê4+G¤�Ë}·:G %:‚Õž:!02¶./usr/local/lib/HTML-Parser-3.13/t/argspec-bad.t.tó/¤�print "1..6\n"; use strict; use HTML::Parser (); my $p = HTML::Parser->new(api_version => 3); eval { $p->handler(end => "end", q(xyzzy)); }; print $@; print "not " unless $@ && $@ =~ /^Unrecognized identifier xyzzy in argspec/; print "ok 1\n"; eval { $p->handler(end => "end", q(tagname text)); }; print $@; print "not " unless $@ && $@ =~ /^Missing comma separator in argspec/; print "ok 2\n"; eval { $p->handler(end => "end", q(tagname, "text)); }; print $@; print "not " unless $@ && $@ =~ /^Unterminated literal string in argspec/; print "ok 3\n"; eval { $p->handler(end => "end", q(tagname, "t\\t")); }; print $@; print "not " unless $@ && $@ =~ /^Backslash reserved for literal string in argspec/; print "ok 4\n"; eval { $p->handler(end => "end", '"' . ("x" x 256) . '"'); }; print $@; print "not " unless $@ && $@ =~ /^Literal string is longer than 255 chars in argspec/; print "ok 5\n"; $p->handler(end => sub { print "ok 6\n" if length(shift) eq 255 }, '"' . ("x" x 255) . '"'); $p->parse(""); ( kêvG¤�äË}·:G %:‚Õž:!03¶ä./usr/local/lib/HTML-Parser-3.13/t/headparser-http.tó/¤�eval { require HTML::HeadParser; $p = HTML::HeadParser->new; }; if ($@) { print "1..0\n" if $@ =~ /^Can't locate HTTP/; print $@; exit; } print "1..1\n"; $p = HTML::HeadParser->new($h); $p->parse(<Stupid example Normal text starts here. EOT $h = $p->header; undef $p; print $h->title; # should print "Stupid example" print "\n"; print "not " unless $h->title eq "Stupid example"; print "ok 1\n"; not  kê&G¤�ÜË}·:G %:‚Õž:!04¶Ü./usr/local/lib/HTML-Parser-3.13/t/dtext.ter-htó/¤�print "1..2\n"; use strict; use HTML::Parser (); my $dtext = ""; my $text = ""; sub append { $dtext .= shift; $text .= shift; } my $p = HTML::Parser->new(text_h => [\&append, "dtext, text"], default_h => [\&append, "text, text" ], ); my $doc = <<'EOT'; ååAA<A>AA &xyzzy &xyzzy;  ÿ � � & &aring å EOT $p->parse($doc)->eof; print "not " unless $text eq $doc; print "ok 1\n"; print $dtext; print "not " unless $dtext eq <<"EOT"; print "ok 2\n"; ååAAAA &xyzzy &xyzzy; \1 \377 � � & &aring å EOT  kêâDG¤�ÝË}·:G %:‚Õž:!05¶Ý./usr/local/lib/HTML-Parser-3.13/t/magic.ter-htó/¤�# Check that the magic signature at the top of struct p_state works and that we # catch modifications to _hparser_xs_state gracefully print "1..5\n"; use HTML::Parser; $p = HTML::Parser->new(api_version => 3); $p->xml_mode(1); # We should not be able to simply modify this stuff eval { ${$p->{_hparser_xs_state}} += 4; }; print "not " unless $@ && $@ =~ /^Modification of a read-only value attempted/; print "ok 1\n"; my $x = delete $p->{_hparser_xs_state}; eval { $p->xml_mode(1); }; print "not " unless $@ && $@ =~ /^Can't find '_hparser_xs_state'/; print "ok 2\n"; $p->{_hparser_xs_state} = \($$x + 16); eval { $p->xml_mode(1); }; print "not " unless $@ && $@ =~ /^Bad signature in parser state object/; print "ok 3\n"; $p->{_hparser_xs_state} = 33; eval { $p->xml_mode(1); }; print "not " unless $@ && $@ =~ /^_hparser_xs_state element is not a reference/; print "ok 4\n"; $p->{_hparser_xs_state} = $x; print "not " unless $p->xml_mode(0); print "ok 5\n";  kêHñG¤�—Ë}·:G %:‚Õž:!0>¶—./usr/local/lib/HTML-Parser-3.13/t/options.t-htó/¤�# Test option setting methods print "1..5\n"; use strict; use HTML::Parser (); my $p = HTML::Parser->new(api_version => 3, xml_mode => 1); my $old; $old = $p->boolean_attribute_value("foo"); print "not " if defined $old; print "ok 1\n"; $old = $p->boolean_attribute_value(); print "not " unless $old eq "foo"; print "ok 2\n"; $old = $p->boolean_attribute_value(undef); print "not " unless $old eq "foo" && !defined($p->boolean_attribute_value); print "ok 3\n"; print "not " unless $p->xml_mode(0) && !$p->xml_mode; print "ok 4\n"; my $seen_buggy_comment_warning; $SIG{__WARN__} = sub { local $_ = shift; $seen_buggy_comment_warning++ if /^netscape_buggy_comment\(\) is deprecated/; print; }; print "not " if $p->strict_comment(1) || !$p->strict_comment || $p->netscape_buggy_comment || !$seen_buggy_comment_warning; print "ok 5\n"; x kêÒþG¤�‰!Ë}·:G %:ƒÕž:! p¶‰!./usr/local/lib/HTML-Parser-3.13/t/entities.thtó/¤�use HTML::Entities qw(decode_entities encode_entities); print "1..8\n"; $a = "Våre norske tegn bør æres"; decode_entities($a); print "ok 1\n" if $a eq "Våre norske tegn bør æres"; encode_entities($a); print "ok 2\n" if $a eq "Våre norske tegn bør æres"; $a = "<&>"; print "ok 3\n" if encode_entities($a) eq "<&>"; $a = "abcdef"; print "ok 4\n" if encode_entities($a, 'a-c') eq "abcdef"; # See how well it does against rfc1866... $ent = $plain = ""; while () { next unless /^\s*>>>$ent\n>>>>$plain\n"; $a = $ent; decode_entities($a); print "DDD>$a\n"; print "not " if $a ne $plain; print "ok 5\n"; # Try decoding when the ";" are left out $a = $ent, $a =~ s/;//g; decode_entities($a); print ";;;>$a\n"; print "not " if $a ne $plain; print "ok 6\n"; $a = $plain; encode_entities($a); print "EEE>$a\n"; print "not " if $a ne $ent; print "ok 7\n"; # From: Bill Simpson-Young # Subject: HTML entities problem with 5.11 # To: libwww-perl@ics.uci.edu # Date: Fri, 05 Sep 1997 16:56:55 +1000 # Message-Id: <199709050657.QAA10089@snowy.nsw.cmis.CSIRO.AU> # # Hi. I've got a problem that has surfaced with the changes to # HTML::Entities.pm for 5.11 (it doesn't happen with 5.08). It's happening # in the process of encoding then decoding special entities. Eg, what goes # in as "abc&def&ghi" comes out as "abc&def;&ghi;". print "not " unless decode_entities("abc&def&ghi&abc;&def;") eq "abc&def&ghi&abc;&def;"; print "ok 8\n"; __END__ # Quoted from rfc1866.txt 14. Proposed Entities The HTML DTD references the "Added Latin 1" entity set, which only supplies named entities for a subset of the non-ASCII characters in [ISO-8859-1], namely the accented characters. The following entities should be supported so that all ISO 8859-1 characters may only be referenced symbolically. The names for these entities are taken from the appendixes of [SGML]. Berners-Lee & Connolly Standards Track [Page 75] RFC 1866 Hypertext Markup Language - 2.0 November 1995 Berners-Lee & Connolly Standards Track [Page 76] RFC 1866 Hypertext Markup Language - 2.0 November 1995 resis o kêbFG¤�ßÌ}·:G %:ƒÕž:!0?¶ß./usr/local/lib/HTML-Parser-3.13/t/largetags.ttó/¤�# Exercise the tokenpos buffer allocation routines by feeding it # very large tags. print "1..2\n"; use strict; use HTML::Parser (); my $p = HTML::Parser->new(api_version => 3); $p->handler("start" => sub { my $tp = shift; #print int(@$tp), " - ", join(", ", @$tp), "\n"; print "not " unless @$tp == 2 + 26 * 6 * 4; print "ok 1\n"; }, "tokenpos"); $p->handler("declaration" => sub { my $t = shift; #print int(@$t), " - @$t\n"; print "not " unless @$t == 26 * 6 * 2 + 1; print "ok 2\n"; }, "tokens"); $p->parse("parse("$_=1 "); } $p->parse(">"); $p->parse("parse("$_ -- $_ -- "); } $p->parse(">"); $p->eof; exit; e kê`zG¤�XÌ}·:G %:ƒÕž:!0´X./usr/local/lib/HTML-Parser-3.13/t/ignore.t.ttó/¤� print "1..4\n"; use strict; use HTML::Parser (); my $html = 'text'; my $text = ''; my $p = HTML::Parser->new(default_h => [sub {$text .= shift;}, 'text']); $p->parse($html)->eof; print "not " if $text ne $html; print "ok 1\n"; $text = ''; $p->handler(start => ""); $p->parse($html)->eof; print "not " if $text ne 'text'; print "ok 2\n"; $text = ''; $p->handler(end => 0); $p->parse($html)->eof; print "not " if $text ne 'text'; print "ok 3\n"; $text = ''; $p->handler(start => undef); $p->parse($html)->eof; print "not " if $text ne 'text'; print "ok 4\n";  kê:G¤�` Ì}·:G %:ƒÕž:! ¾´` ./usr/local/lib/HTML-Parser-3.13/t/argspec.tttó/¤� require HTML::Parser; $decl = ''; $com1 = ''; $com2 = ''; $start = ''; $end = ''; $empty = ""; $proc = ''; my $argspec = join ',', qw( self offset length event tagname token0 text is_cdata dtext tokens tokenpos attr attrseq ); my @result = (); my $p = HTML::Parser -> new(default_h => [\@result, $argspec], strict_comment => 1, xml_mode => 1); @tests = ( # string, expected results $decl => [[$p, 0, 52, 'declaration', 'ENTITY', 'ENTITY', '', undef, undef, ['ENTITY', 'nbsp', 'CDATA', '" "', '-- no-break space --'], [2, 6, 9, 4, 16, 5, 22, 8, 31, 20], undef, undef ]], $com1 => [[$p, 52, 16, 'comment', ' Comment ', ' Comment ', '', undef, undef, [' Comment '], [4, 9], undef, undef ]], $com2 => [[$p, 68, 30, 'comment', ' Comment ', ' Comment ', '', undef, undef, [' Comment ', ' Comment '], [4, 9, 18, 9], undef, undef ]], $start => [[$p, 98, 14, 'start', 'a', 'a', '', undef, undef, ['a', 'href', '"foo"'], [1, 1, 3, 4, 8, 5], {'href', 'foo'}, ['href'] ]], $end => [[$p, 112, 4, 'end', 'a', 'a', '', undef, undef, ['a'], [2, 1], undef, undef ]], $empty => [[$p, 116, 16, 'start', 'IMG', 'IMG', "", undef, undef, ['IMG', 'SRC', "'foo'"], [1, 3, 5, 3, 9, 5], {'SRC', 'foo'}, ['SRC'] ], [$p, 132, 0, 'end', 'IMG', 'IMG', '', undef, undef, ['IMG'], undef, undef, undef ], ], $proc => [[$p, 132, 36, 'process', ' something completely different ', ' something completely different ', '', undef, undef, [' something completely different '], [2, 32], undef, undef ]], "$end\n$end" => [[$p, 168, 4, 'end', 'a', 'a', '', undef, undef, ['a'], [2, 1], undef, undef], [$p, 172, 1, 'text', undef, undef, "\n", '', "\n", undef, undef, undef, undef], [$p, 173, 4, 'end', 'a', 'a', '', undef, undef, ['a'], [2, 1], undef, undef ]], ); my $n = @tests / 2; print "1..$n\n"; sub string_tag { my (@pieces) = @_; my $part; foreach $part ( @pieces ) { if (!defined $part) { $part = 'undef'; } elsif (!ref $part) { $part = "'$part'" if $part !~ /^\d+$/; } elsif ('ARRAY' eq ref $part ) { $part = '[' . join(', ', string_tag(@$part)) . ']'; } elsif ('HASH' eq ref $part ) { $part = '{' . join(',', string_tag(%$part)) . '}'; } else { $part = '<' . ref($part) . '>'; } } return join(", ", @pieces ); } my $i = 0; my ($got, $want); while (@tests) { ($html, $expected) = splice @tests, 0, 2; ++$i; print "-" x 50, " $i\n"; print "$html\n"; print "-" x 50, " $i\n"; @result = (); $p->parse($html)->eof; # Compare results for each element expected foreach (@$expected) { $want = string_tag($_); $got = string_tag(shift @result); print " $got\n"; if ($want ne $got) { print "Expected: $want\n"; print( "not " ); last; } } print "ok $i\n"; }  kê¡G¤�ÉÌ}·:G %:ƒÕž:!0ÿ´É./usr/local/lib/HTML-Parser-3.13/t/comment.tttó/¤�print "1..1\n"; use strict; use HTML::Parser; my $p = HTML::Parser->new; my @com; $p->handler(comment => sub { push(@com, shift) }, "token0"); $p->parse(""); $p->parse(""); $p->parse(""); $p->parse(""); $p->eof; my $com = join(":", @com); print "not " unless $com eq ":>", @$t) . "]"; } sub text { $res .= shift; } my $p = HTML::Parser->new(declaration_h => [\&decl, "tokens"], default_h => [\&text, "text"], ); $p->parse(<eof; -- "http://www.w3.org/TR/html40/strict.dtd"> "> "> foo EOT #print $res; print "not " unless $res eq < <"-//W3C//DTD HTML 4.01//EN"> <----> <"http://www.w3.org/TR/html40/strict.dtd">] [ <"">] "> foo EOT no-brea kêþiG¤�[Ì}·:G %:ƒÕž:!0>µ[./usr/local/lib/HTML-Parser-3.13/t/unbroken-text.ttó/¤�use strict; use HTML::Parser; print "1..3\n"; my $text = ""; sub text { my $cdata = shift() ? "CDATA" : "TEXT"; my($offset, $t) = @_; $text .= "[$cdata:$offset:$t]"; } sub tag { $text .= shift; } my $p = HTML::Parser->new(unbroken_text => 1, text_h => [\&text, "is_cdata,offset,text"], start_h => [\&tag, "text"], end_h => [\&tag, "text"], ); $p->parse("foo "); $p->parse("bar "); $p->parse(""); $p->parse("bar\n"); $p->parse(""); $p->parse("xmp"); $p->parse("atend"); print "not " unless $text eq "[TEXT:0:foo bar ][TEXT:13:bar\n][CDATA:28:xmp]"; print "ok 1\n"; $text = ""; $p->eof; print "not " unless $text eq "[TEXT:37:atend]"; print "ok 2\n"; $p = HTML::Parser->new(unbroken_text => 1, text_h => [\&text, "is_cdata,offset,text"], ); $text = ""; $p->parse("foo"); $p->parse("parse(">bar\n"); $p->parse("fooparse("p>xmp"); $p->parse("parse(">bar"); $p->eof; print "not " unless $text eq "[TEXT:0:foo][TEXT:8:bar\nfoo][CDATA:20:xmp][TEXT:29:bar]"; print "ok 3\n"; def,  kêrWG¤�9Ì}·:G %:ƒÕž:!0?µ9./usr/local/lib/HTML-Parser-3.13/t/offset.ttextó/¤�print "1..1\n"; use strict; use HTML::Parser (); my $HTML = <<'EOT'; heisan xmp EOT my $p = HTML::Parser->new(api_version => 3); my $sum_len = 0; my $count = 0; my $err; $p->handler(default => sub { my($offset, $text) = @_; my $copy = $text; $copy =~ s/\n/\\n/g; substr($copy, 30) = "..." if length($copy) > 32; printf ">>> %3d %s\n", $offset, $copy; if ($offset != $sum_len) { print "offset mismatch $offset vs $sum_len\n"; $err++; } $sum_len += length($text); $count++; }, 'offset,text'); for (split(//, $HTML)) { $p->parse($_); } $p->eof; print "not " unless $count > 5 && !$err; print "ok 1\n"; et,text kê8NG¤�vÌ}·:G %:ƒÕž:!0F¶v./usr/local/lib/HTML-Parser-3.13/t/handler.textó/¤�# Test handler method print "1..11\n"; my $testno; use HTML::Parser; { package MyParser; use vars qw(@ISA); @ISA=(HTML::Parser); sub foo { print "ok $_[1]{testno}\n"; } sub bar { print "ok $_[1]\n"; } } $p = MyParser->new(api_version => 3); eval { $p->handler(foo => "foo", "foo"); }; print "not " unless $@ && $@ =~ /^No handler for foo events/; print "ok 1\n"; eval { $p->handler(start => "foo", "foo"); }; print "not " unless $@ && $@ =~ /^Unrecognized identifier foo in argspec/; print "ok 2\n"; my $h = $p->handler(start => "foo", "self,tagname"); print "not " if defined($h); print "ok 3\n"; $x = \substr("xfoo", 1); $p->handler(start => $$x, "self,attr"); $p->parse(""); $p->handler(start => \&MyParser::foo, "self,attr"); $p->parse(""); $p->handler(start => "foo"); $p->parse(""); $p->handler(start => "bar", "self,'7'"); $p->parse(""); eval { $p->handler(start => {}, "self"); }; print "not " unless $@ && $@ =~ /^Only code or array references allowed as handler/; print "ok 8\n"; $a = []; $p->handler(start => $a); $h = $p->handler("start"); print "not " unless $p->handler("start", "foo") == $a; print "ok 9\n"; print "not " unless $p->handler("start", \&MyParser::foo, "") eq "foo"; print "ok 10\n"; print "not " unless $p->handler("start") == \&MyParser::foo; print "ok 11\n"; en kêȧG¤�pÌ}·:G %:ƒÕž:!0G¶p./usr/local/lib/HTML-Parser-3.13/t/api_version.tttó/¤�print "1..3\n"; use strict; use HTML::Parser (); my $p = HTML::Parser->new(api_version => 3); print "not " if $p->handler("start"); print "ok 1\n"; eval { my $p = HTML::Parser->new(api_version => 4); print "not "; }; print $@; print "ok 2\n"; $p = HTML::Parser->new(api_version => 2); print "not " unless $p->handler("start") eq "start"; print "ok 3\n";  kêJö G¤�XÌ}·:G %:ƒÕž:!0H¶X./usr/local/lib/HTML-Parser-3.13/t/parsefile.ttó/¤�print "1..6\n"; my $filename = "file$$.htm"; die "$filename is already there" if -e $filename; open(FILE, ">$filename") || die "Can't create $filename: $!"; print FILE <<'EOT'; close(FILE); Heisan EOT my $testno = 1; { package MyParser; require HTML::Parser; @ISA=qw(HTML::Parser); sub start { my($self, $tag, $attr) = @_; print "not " unless $tag eq "title"; print "ok $testno\n"; $testno++; } } MyParser->new->parse_file($filename); open(FILE, $filename) || die; MyParser->new->parse_file(*FILE); seek(FILE, 0, 0) || die; MyParser->new->parse_file(\*FILE); close(FILE); require IO::File; my $io = IO::File->new($filename) || die; MyParser->new->parse_file($io); $io->seek(0, 0) || die; MyParser->new->parse_file(*$io); my $text = ''; $io->seek(0, 0) || die; MyParser->new( start_h => [ sub{ shift->eof; }, "self" ], text_h => [ sub{ $text = shift; }, "text" ])->parse_file(*$io); print "not " if $text; print "ok $testno\n"; $testno++; close($io); # needed because of bug in perl undef($io); unlink($filename) or warn "Can't unlink $filename: $!";  kêR!G¤�ÝÌ}·:H %:ƒÕž:!U¶Ý./usr/local/lib/HTML-Parser-3.13/t/parser.t.ttó/¤�print "1..7\n"; $HTML = <<'HTML'; Various entities. The parser must never break them in the middle: / / È ௖ ￿ å-Å

camel
and this is not. that Netscape hates --> < this > was not a tag. HTML #------------------------------------------------------------------- { package P; require HTML::Parser; @ISA=qw(HTML::Parser); $OUT=''; $COUNT=0; sub new { my $class = shift; my $self = $class->SUPER::new; $OUT = ''; die "Can only have one" if $COUNT++; $self; } sub DESTROY { my $self = shift; eval { $self->SUPER::DESTROY; }; $COUNT--; } sub declaration { my($self, $decl) = @_; $OUT .= "[[$decl]]|"; } sub start { my($self, $tag, $attr) = @_; $attr = join("/", map "$_=$attr->{$_}", sort keys %$attr); $attr = "/$attr" if length $attr; $OUT .= "<<$tag$attr>>|"; } sub end { my($self, $tag) = @_; $OUT .= ">>$tag<<|"; } sub comment { my($self, $comment) = @_; $OUT .= "##$comment##|"; } sub text { my($self, $text) = @_; #$text =~ s/\n/\\n/g; #$text =~ s/\t/\\t/g; #$text =~ s/ /·/g; $OUT .= "$text|"; } sub result { $OUT; } } my $testno = 1; for $chunksize (64*1024, 64, 13, 3, 1, "file", "filehandle") { #for $chunksize (1) { print "\n"; if ($chunksize =~ /^file/) { print "Parsing from $chunksize\n"; } else { print "Parsing using $chunksize byte chunks\n"; } my $p = P->new; if ($chunksize =~ /^file/) { # First we must create the file my $tmpfile = "tmp-$$.html"; my $file = $tmpfile; die "$file already exists" if -e $file; open(FILE, ">$file") or die "Can't create $file: $!"; binmode FILE; print FILE $HTML; close(FILE); if ($chunksize eq "filehandle") { require FileHandle; my $fh = FileHandle->new($file) || die "Can't open $file: $!"; $file = $fh; } # then we can parse it. $p->parse_file($file); close $file if $chunksize eq "filehandle"; unlink($tmpfile) || warn "Can't unlink $tmpfile: $!"; } else { my $copy = $HTML; while (length $copy) { my $chunk = substr($copy, 0, $chunksize); substr($copy, 0, $chunksize) = ''; $p->parse($chunk); } $p->eof; } my $res = $p->result; my $bad; # Then we start looking for things that should not happen if ($res =~ /\s\|\s/) { print "broken space\n"; $bad++; } for ( # Make sure entities are not broken '/', '/', 'È', '௖', '￿', 'å', 'Å', # Some elements that should be produced "|[[DOCTYPE HTML]]|", "|## this is\na comment ##|", "|<