[LON-CAPA-cvs] cvs: doc /loncapafiles html_parser_check.piml

matthew lon-capa-cvs@mail.lon-capa.org
Mon, 06 Dec 2004 20:34:57 -0000


matthew		Mon Dec  6 15:34:57 2004 EDT

  Modified files:              
    /doc/loncapafiles	html_parser_check.piml 
  Log:
  Real Perl can't survive in XML so we have to disguise it.
  
  
Index: doc/loncapafiles/html_parser_check.piml
diff -u doc/loncapafiles/html_parser_check.piml:1.1 doc/loncapafiles/html_parser_check.piml:1.2
--- doc/loncapafiles/html_parser_check.piml:1.1	Mon Dec  6 15:27:38 2004
+++ doc/loncapafiles/html_parser_check.piml	Mon Dec  6 15:34:57 2004
@@ -3,7 +3,7 @@
 <!-- ntpcheck.piml -->
 <!-- Matthew Hall -->
 
-<!-- $Id: html_parser_check.piml,v 1.1 2004/12/06 20:27:38 matthew Exp $ -->
+<!-- $Id: html_parser_check.piml,v 1.2 2004/12/06 20:34:57 matthew Exp $ -->
 
 <!--
 
@@ -35,7 +35,7 @@
 <file>
 <target dist="default">/home/httpd/lonUsers</target>
 <perlscript mode="fg">
-#use the directory
+
 use strict;
 use HTML::Parser;
 
@@ -45,23 +45,23 @@
 ## First test
 ##
 my $text='';
-my $p = HTML::Parser->new(api_version => 3);
-$p->handler(start =>
+my $p = HTML::Parser-&gt;new(api_version =&gt; 3);
+$p-&gt;handler(start =&gt;
 	    sub {
 		 my($tag, $attr) = @_;
 		 $text .= "S[$tag";
 		 for my $k (sort keys %$attr) {
-		     my $v =  $attr->{$k};
+		     my $v =  $attr-&gt;{$k};
 		     $text .= " key $k= value $v";
 		 }
 		 $text .= "]";
 	     }, "tagname,attr");
-$p->handler(text =>
+$p-&gt;handler(text =&gt;
 	     sub {
 		 $text .= 'T{'.shift().'}';
 	     }, "text");
 $text='';
-$p->parse('<img a="b" "=\'"\' c=d />')->eof;
+$p-&gt;parse('&lt;img a="b" "=\'"\' c=d /&gt;')-&gt;eof;
 
 my $first_test_result = $text;
 my $first_expected_result = 
@@ -69,35 +69,31 @@
 if (! $first_test_result) {
     print "Unable to run first HTML::Parser test\n";
 } elsif ($first_test_result ne $first_expected_result) {
-    print <<"END";
+    print &lt;&lt;"END";
 **** WARNING: HTML::Parser is not working properly.
               You are using version $version.  For test 1 it returned
               "$first_test_result"
 END
-} else {
-    print "First HTML::Parser test looks good.\n";
 }
 
 
 ##
 ## Second test
 ##
-$p->xml_mode(1);
+$p-&gt;xml_mode(1);
 $text='';
-$p->parse('<img a="b" "=\'"\' c=d />')->eof;
+$p-&gt;parse('&lt;img a="b" "=\'"\' c=d /&gt;')-&gt;eof;
 my $second_test_result = $text;
 my $second_expected_result = 
     q{S[img key "= value " key a= value b key c= value d]};
 if (! $second_test_result) {
     print "Unable to run second HTML::Parser test\n";
 } elsif ($second_test_result ne $second_expected_result) {
-    print <<"END";
+    print &lt;&lt;"END";
 **** WARNING: HTML::Parser is not working properly.
               You are using version $version.  For test 2 it returned
               "$second_test_result"
 END
-} else {
-    print "Second HTML::Parser test looks good.\n";
 }
 
 </perlscript>