aboutsummaryrefslogtreecommitdiff
path: root/textproc/p5-SGML-Parser-OpenSP/files
diff options
context:
space:
mode:
authorChin-San Huang <chinsan@FreeBSD.org>2007-07-28 19:31:51 +0000
committerChin-San Huang <chinsan@FreeBSD.org>2007-07-28 19:31:51 +0000
commit7e4b26ddf079748ee1fa2a574d74ffc34a35c19d (patch)
tree84023e2e9ad97f3eba8ca2fc6898110e32cecabc /textproc/p5-SGML-Parser-OpenSP/files
parent568bb68fdaa4fd77b0802427348314984d031099 (diff)
downloadports-7e4b26ddf079748ee1fa2a574d74ffc34a35c19d.tar.gz
ports-7e4b26ddf079748ee1fa2a574d74ffc34a35c19d.zip
Add p5-SGML-Parser-OpenSP 0.100r1, parse SGML documents using OpenSP.
PR: ports/114975 Submitted by: Naram Qashat <cyberbotx at cyberbotx.com> Approved by: rafan (mentor, implicit)
Notes
Notes: svn path=/head/; revision=196500
Diffstat (limited to 'textproc/p5-SGML-Parser-OpenSP/files')
-rw-r--r--textproc/p5-SGML-Parser-OpenSP/files/patch-MANIFEST12
-rw-r--r--textproc/p5-SGML-Parser-OpenSP/files/patch-Makefile.PL13
-rw-r--r--textproc/p5-SGML-Parser-OpenSP/files/patch-OpenSP.xs11
-rw-r--r--textproc/p5-SGML-Parser-OpenSP/files/patch-t-20passfd.t50
-rw-r--r--textproc/p5-SGML-Parser-OpenSP/files/patch-t-21parsestring.t69
-rw-r--r--textproc/p5-SGML-Parser-OpenSP/files/patch-t-22mwarnings.t71
6 files changed, 226 insertions, 0 deletions
diff --git a/textproc/p5-SGML-Parser-OpenSP/files/patch-MANIFEST b/textproc/p5-SGML-Parser-OpenSP/files/patch-MANIFEST
new file mode 100644
index 000000000000..3c864e75fe9f
--- /dev/null
+++ b/textproc/p5-SGML-Parser-OpenSP/files/patch-MANIFEST
@@ -0,0 +1,12 @@
+--- MANIFEST.orig 2007-07-29 03:17:26.000000000 +0800
++++ MANIFEST 2007-07-29 03:17:35.000000000 +0800
+@@ -23,6 +23,9 @@
+ t/17splitmessage.t
+ t/18halt.t
+ t/19refcounting.t
++t/20passfd.t
++t/21parsestring.t
++t/22mwarnings.t
+ t/98podsyn.t
+ t/99podcov.t
+ lib/SGML/Parser/OpenSP.pm
diff --git a/textproc/p5-SGML-Parser-OpenSP/files/patch-Makefile.PL b/textproc/p5-SGML-Parser-OpenSP/files/patch-Makefile.PL
new file mode 100644
index 000000000000..7811b2b55c16
--- /dev/null
+++ b/textproc/p5-SGML-Parser-OpenSP/files/patch-Makefile.PL
@@ -0,0 +1,13 @@
+--- Makefile.PL.orig 2007-07-29 03:05:27.000000000 +0800
++++ Makefile.PL 2007-07-29 03:06:38.000000000 +0800
+@@ -26,6 +26,10 @@
+ Test::Exception => 0,
+ File::Temp => 0,
+ },
++ PM => {
++ 'lib/SGML/Parser/OpenSP.pm' => '$(INST_LIB)/SGML/Parser/OpenSP.pm',
++ 'lib/SGML/Parser/OpenSP/Tools.pm' => '$(INST_LIB)/SGML/Parser/OpenSP/Tools.pm'
++ },
+ ($] >= 5.005 ?
+ (ABSTRACT_FROM => 'lib/SGML/Parser/OpenSP.pm',
+ AUTHOR => 'Bjoern Hoehrmann <bjoern@hoehrmann.de>') : ()),
diff --git a/textproc/p5-SGML-Parser-OpenSP/files/patch-OpenSP.xs b/textproc/p5-SGML-Parser-OpenSP/files/patch-OpenSP.xs
new file mode 100644
index 000000000000..1b2dc7cf1336
--- /dev/null
+++ b/textproc/p5-SGML-Parser-OpenSP/files/patch-OpenSP.xs
@@ -0,0 +1,11 @@
+--- OpenSP.xs.orig 2007-07-29 02:53:09.000000000 +0800
++++ OpenSP.xs 2007-07-29 02:53:39.000000000 +0800
+@@ -445,7 +445,7 @@
+ AV* av = (AV*)rv;
+ I32 len = av_len(av);
+
+- for (I32 i = 0; i < len; ++i)
++ for (I32 i = 0; i <= len; ++i)
+ {
+ SV** svp = av_fetch(av, i, 0);
+
diff --git a/textproc/p5-SGML-Parser-OpenSP/files/patch-t-20passfd.t b/textproc/p5-SGML-Parser-OpenSP/files/patch-t-20passfd.t
new file mode 100644
index 000000000000..429cdc5ab8e3
--- /dev/null
+++ b/textproc/p5-SGML-Parser-OpenSP/files/patch-t-20passfd.t
@@ -0,0 +1,50 @@
+--- /dev/null Fri Jul 27 20:05:08 2007
++++ t/20passfd.t Fri Jul 27 20:06:50 2007
+X@@ -0,0 +1,46 @@
++# 20passfd.t -- ...
++#
++# $Id: 20passfd.t,v 1.4 2005/08/14 18:07:19 hoehrmann Exp $
++
++use strict;
++use warnings;
++use Test::More tests => 7;
++use Test::Exception;
++use File::Spec qw();
++
++use constant NO_DOCTYPE => File::Spec->catfile('samples', 'no-doctype.xml');
++use constant TEST_CATALOG => File::Spec->catfile('samples', 'test.soc');
++
++BEGIN { use_ok('SGML::Parser::OpenSP') };
++require_ok('SGML::Parser::OpenSP');
++my $p = SGML::Parser::OpenSP->new;
++isa_ok($p, 'SGML::Parser::OpenSP');
++
++sub TestHandler20::new { bless{ok1=>0},shift }
++sub TestHandler20::start_element { shift->{ok1}++ }
++
++sub TestHandler21::new { bless{ok1=>0},shift }
++sub TestHandler21::start_element { shift->{ok1}++ }
++
++#
++# Check pass as filename (should work on all platforms).
++$p = SGML::Parser::OpenSP->new;
++my $h1 = TestHandler20->new;
++$p->handler($h1);
++$p->pass_file_descriptor(0);
++lives_ok { $p->parse_string("<no-doctype></no-doctype>") } 'parse_string with temp file name';
++is($h1->{ok1}, 1, "temp file name handler called");
++undef $p;
++
++#
++# Check pass as file descriptor (not on Win32).
++SKIP: {
++ skip 'passing fds for temp files not supported on Win32', 2 if $^O eq 'MSWin32';
++ $p = SGML::Parser::OpenSP->new;
++ my $h2 = TestHandler21->new;
++ $p->handler($h2);
++ $p->pass_file_descriptor(1);
++ lives_ok { $p->parse_string("<no-doctype></no-doctype>") } 'parse by fd';
++ is($h2->{ok1}, 1, "temp file descriptor handler called");
++ undef $p;
++}
+
diff --git a/textproc/p5-SGML-Parser-OpenSP/files/patch-t-21parsestring.t b/textproc/p5-SGML-Parser-OpenSP/files/patch-t-21parsestring.t
new file mode 100644
index 000000000000..10d57aa49886
--- /dev/null
+++ b/textproc/p5-SGML-Parser-OpenSP/files/patch-t-21parsestring.t
@@ -0,0 +1,69 @@
+--- /dev/null Fri Jul 27 20:05:08 2007
++++ t/21parsestring.t Fri Jul 27 20:06:55 2007
+X@@ -0,0 +1,65 @@
++# 06parseliteral.t -- ...
++#
++# $Id: 21parsestring.t,v 1.1 2006/03/06 08:51:59 tbe Exp $
++
++use strict;
++use warnings;
++use Test::More tests => 13;
++use Test::Exception;
++use File::Spec qw();
++
++use constant NO_DOCTYPE => File::Spec->catfile('samples', 'no-doctype.xml');
++use constant TEST_CATALOG => File::Spec->catfile('samples', 'test.soc');
++
++BEGIN { use_ok('SGML::Parser::OpenSP') };
++require_ok('SGML::Parser::OpenSP');
++my $p = SGML::Parser::OpenSP->new;
++isa_ok($p, 'SGML::Parser::OpenSP');
++
++#########################################################
++## Parse using ->parse_string().
++#########################################################
++
++sub TestHandler1::new { bless{ok1=>0,ok2=>0,ok3=>0,ok4=>0,ok5=>0,
++ ok6=>0,ok7=>0,ok8=>0,ok9=>0,oka=>0},shift }
++sub TestHandler1::start_element {
++ my $s = shift;
++ my $e = shift;
++
++ return unless defined $s;
++ return unless defined $e;
++
++ $s->{ok1}++ if UNIVERSAL::isa($s, 'TestHandler1');
++
++ # Name
++ $s->{ok2}++ if exists $e->{Name};
++ $s->{ok3}++ if $e->{Name} =~ /no-doctype/i;
++
++ # Attributes
++ $s->{ok4}++ if exists $e->{Attributes};
++ $s->{ok5}++ if UNIVERSAL::isa($e->{Attributes}, "HASH");
++ $s->{ok6}++ if scalar(keys(%{$_[1]->{Attributes}})) == 0;
++
++ # Included
++ $s->{ok7}++ if exists $e->{Included};
++ $s->{ok8}++ if $e->{Included} == 0;
++
++ # ContentType
++ $s->{ok9}++ if exists $e->{ContentType};
++}
++
++my $h1 = TestHandler1->new;
++
++$p->handler($h1);
++lives_ok { $p->parse_string("<no-doctype></no-doctype>") }
++ 'parsing with parse_string()';
++
++ok($h1->{ok1}, 'self to handler');
++ok($h1->{ok2}, 'has name');
++ok($h1->{ok3}, 'proper name');
++ok($h1->{ok4}, 'has attrs');
++ok($h1->{ok5}, 'attrs hash ref');
++ok($h1->{ok6}, 'proper attrs');
++ok($h1->{ok7}, 'has included');
++ok($h1->{ok8}, 'included == 0');
++ok($h1->{ok9}, 'has content type');
+
diff --git a/textproc/p5-SGML-Parser-OpenSP/files/patch-t-22mwarnings.t b/textproc/p5-SGML-Parser-OpenSP/files/patch-t-22mwarnings.t
new file mode 100644
index 000000000000..244ac911870b
--- /dev/null
+++ b/textproc/p5-SGML-Parser-OpenSP/files/patch-t-22mwarnings.t
@@ -0,0 +1,71 @@
+--- /dev/null Fri Jul 27 20:05:08 2007
++++ t/22mwarnings.t Fri Jul 27 20:06:59 2007
+@@ -0,0 +1,67 @@
++# 10errors.t -- ...
++#
++# $Id: 22mwarnings.t,v 1.1 2006/11/07 11:14:13 hoehrmann Exp $
++
++use strict;
++use warnings;
++use Test::More tests => 7;
++use Test::Exception;
++use File::Spec qw();
++
++use constant NO_DOCTYPE => File::Spec->catfile('samples', 'no-doctype.xml');
++use constant TEST_CATALOG => File::Spec->catfile('samples', 'test.soc');
++
++BEGIN { use_ok('SGML::Parser::OpenSP') };
++require_ok('SGML::Parser::OpenSP');
++my $p = SGML::Parser::OpenSP->new;
++isa_ok($p, 'SGML::Parser::OpenSP');
++
++#########################################################
++## Error reporting
++#########################################################
++
++sub TestHandler5::new { bless{ok=>0},shift }
++sub TestHandler5::error
++{
++ return unless @_ == 2;
++ $_[0]->{ok}++ if $_[1]->{Message} =~ /:8:7:W:/;
++}
++
++my $h5 = TestHandler5->new;
++$p->catalogs(TEST_CATALOG);
++$p->warnings('xml');
++$p->handler($h5);
++lives_ok { $p->parse("<LITERAL>" . <<"__DOC__");
++<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
++ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
++<html xmlns="http://www.w3.org/1999/xhtml">
++<head>
++<title></title>
++</head>
++<body>
++<p>foo & bar</p>
++</body>
++</html>
++__DOC__
++} 'ampersand as data';
++
++is($h5->{ok}, 1, 'ampersand as data generates warning');
++
++# special case
++$p->warnings(qw/non-sgml-char-ref valid no-duplicate xml/);
++
++lives_ok { $p->parse("<LITERAL>" . <<"__DOC__");
++<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
++ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
++<html xmlns="http://www.w3.org/1999/xhtml">
++<head>
++<title></title>
++</head>
++<body>
++<p>foo & bar</p>
++</body>
++</html>
++__DOC__
++} 'ampersand as data';
++
++is($h5->{ok}, 2, 'ampersand as data generates warning');
+