ports/114975: [NEW PORT] www/p5-SGML-Parser-OpenSP: Perl 5 module to interface to the OpenSP parser

Naram Qashat cyberbotx at cyberbotx.com
Sat Jul 28 01:20:01 UTC 2007


>Number:         114975
>Category:       ports
>Synopsis:       [NEW PORT] www/p5-SGML-Parser-OpenSP: Perl 5 module to interface to the OpenSP parser
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jul 28 01:20:01 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Naram Qashat
>Release:        FreeBSD 6.2-RELEASE-p5 i386
>Organization:
>Environment:
System: FreeBSD kirby.cyberbotx.com 6.2-RELEASE-p5 FreeBSD 6.2-RELEASE-p5 #9: Fri Jun 15 22:26:29 EDT 2007
>Description:
SGML::Parser::OpenSP is an interface to the OpenSP parser.  It allows for
Perl scripts to parse an SGML document (including HTML) using the OpenSP
parser.

WWW: http://search.cpan.org/dist/SGML-Parser-OpenSP/

- Naram Qashat
cyberbotx at cyberbotx.com

Generated with FreeBSD Port Tools 0.77

(Just an added note, I have never created a Perl module port before, so
I am not 100% sure I did everything the correct way.  If I did anything
wrong or if something could've been done differently, let me know.)

I'm not sure if www is the correct choice for the primary category, if
not, feel free to change it.  Also, the reason I made the PORTVERSION
be 0.100r1 is because it's really version 0.99 of SGML::Parser::OpenSP
with diffs to make it equivilent to the 0.100 version on the Sourceforge
CVS of this module.

>How-To-Repeat:
>Fix:

--- p5-SGML-Parser-OpenSP-0.100r1.shar begins here ---
# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	p5-SGML-Parser-OpenSP
#	p5-SGML-Parser-OpenSP/Makefile
#	p5-SGML-Parser-OpenSP/distinfo
#	p5-SGML-Parser-OpenSP/pkg-plist
#	p5-SGML-Parser-OpenSP/pkg-descr
#	p5-SGML-Parser-OpenSP/files
#	p5-SGML-Parser-OpenSP/files/patch-MANIFEST
#	p5-SGML-Parser-OpenSP/files/patch-OpenSP.xs
#	p5-SGML-Parser-OpenSP/files/patch-lib-SGML-Parser-OpenSP-Tools.pm
#	p5-SGML-Parser-OpenSP/files/patch-lib-SGML-Parser-OpenSP.pm
#	p5-SGML-Parser-OpenSP/files/patch-t-20passfd.t
#	p5-SGML-Parser-OpenSP/files/patch-t-21parsestring.t
#	p5-SGML-Parser-OpenSP/files/patch-t-22mwarnings.t
#	p5-SGML-Parser-OpenSP/files/patch-Makefile.PL
#
echo c - p5-SGML-Parser-OpenSP
mkdir -p p5-SGML-Parser-OpenSP > /dev/null 2>&1
echo x - p5-SGML-Parser-OpenSP/Makefile
sed 's/^X//' >p5-SGML-Parser-OpenSP/Makefile << 'END-of-p5-SGML-Parser-OpenSP/Makefile'
X# New ports collection makefile for:	p5-SGML-Parser-OpenSP
X# Date created:				27 August 2007
X# Whom:					Naram Qashat <cyberbotx at cyberbotx.com>
X#
X# $FreeBSD$
X#
X
XPORTNAME=	SGML-Parser-OpenSP
XPORTVERSION=	0.100r1
XCATEGORIES=	www perl5
XMASTER_SITES=	${MASTER_SITE_PERL_CPAN}
XMASTER_SITE_SUBDIR=	SGML
XPKGNAMEPREFIX=	p5-
XDISTNAME=	SGML-Parser-OpenSP-0.99
X
XMAINTAINER=	cyberbotx at cyberbotx.com
XCOMMENT=	Perl 5 module to interface to the OpenSP parser
X
XBUILD_DEPENDS=	onsgmls:${PORTSDIR}/textproc/opensp \
X		${SITE_PERL}/File/Temp.pm:${PORTSDIR}/devel/p5-File-Temp \
X		${SITE_PERL}/Class/Accessor.pm:${PORTSDIR}/devel/p5-Class-Accessor
XRUN_DEPENDS=	${BUILD_DEPENDS}
X
X.if !defined(WITHOUT_TESTS)
XBUILD_DEPENDS+=	${SITE_PERL}/Test/Exception.pm:${PORTSDIR}/devel/p5-Test-Exception
X.endif
X
XPERL_CONFIGURE=	yes
X
XMAN3=		SGML::Parser::OpenSP.3 SGML::Parser::OpenSP::Tools.3
X
XCC=		g++
XCFLAGS+=	-I${LOCALBASE}/include
X
X.if !defined(WITHOUT_TESTS)
Xtest:		build
X		@cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} test
X.endif
X
X.include <bsd.port.pre.mk>
X
X.if ${PERL_LEVEL} < 500800
XIGNORE=		requires Perl 5.8.0 or better to run
X.endif
X
X.include <bsd.port.post.mk>
END-of-p5-SGML-Parser-OpenSP/Makefile
echo x - p5-SGML-Parser-OpenSP/distinfo
sed 's/^X//' >p5-SGML-Parser-OpenSP/distinfo << 'END-of-p5-SGML-Parser-OpenSP/distinfo'
XMD5 (SGML-Parser-OpenSP-0.99.tar.gz) = cb08669ed566ef4070671cf57aa749e3
XSHA256 (SGML-Parser-OpenSP-0.99.tar.gz) = 4822da26240b6feb2e435d84053377eb421afda584439b16da0f31f8fcfddc1b
XSIZE (SGML-Parser-OpenSP-0.99.tar.gz) = 33761
END-of-p5-SGML-Parser-OpenSP/distinfo
echo x - p5-SGML-Parser-OpenSP/pkg-plist
sed 's/^X//' >p5-SGML-Parser-OpenSP/pkg-plist << 'END-of-p5-SGML-Parser-OpenSP/pkg-plist'
X%%SITE_PERL%%/%%PERL_ARCH%%/SGML/Parser/OpenSP.pm
X%%SITE_PERL%%/%%PERL_ARCH%%/SGML/Parser/OpenSP/Tools.pm
X%%SITE_PERL%%/%%PERL_ARCH%%/auto/SGML/Parser/OpenSP/.packlist
X%%SITE_PERL%%/%%PERL_ARCH%%/auto/SGML/Parser/OpenSP/OpenSP.bs
X%%SITE_PERL%%/%%PERL_ARCH%%/auto/SGML/Parser/OpenSP/OpenSP.so
X at dirrm %%SITE_PERL%%/%%PERL_ARCH%%/auto/SGML/Parser/OpenSP
X at dirrmtry %%SITE_PERL%%/%%PERL_ARCH%%/auto/SGML/Parser
X at dirrmtry %%SITE_PERL%%/%%PERL_ARCH%%/auto/SGML
X at dirrm %%SITE_PERL%%/mach/SGML/Parser/OpenSP
X at dirrmtry %%SITE_PERL%%/mach/SGML/Parser
X at dirrmtry %%SITE_PERL%%/mach/SGML
END-of-p5-SGML-Parser-OpenSP/pkg-plist
echo x - p5-SGML-Parser-OpenSP/pkg-descr
sed 's/^X//' >p5-SGML-Parser-OpenSP/pkg-descr << 'END-of-p5-SGML-Parser-OpenSP/pkg-descr'
XSGML::Parser::OpenSP is an interface to the OpenSP parser.  It allows for
XPerl scripts to parse an SGML document (including HTML) using the OpenSP
Xparser.
X
XWWW: http://search.cpan.org/dist/SGML-Parser-OpenSP/
X
X- Naram Qashat
Xcyberbotx at cyberbotx.com
END-of-p5-SGML-Parser-OpenSP/pkg-descr
echo c - p5-SGML-Parser-OpenSP/files
mkdir -p p5-SGML-Parser-OpenSP/files > /dev/null 2>&1
echo x - p5-SGML-Parser-OpenSP/files/patch-MANIFEST
sed 's/^X//' >p5-SGML-Parser-OpenSP/files/patch-MANIFEST << 'END-of-p5-SGML-Parser-OpenSP/files/patch-MANIFEST'
X--- MANIFEST.sav	Fri Jul 27 19:52:17 2007
X+++ MANIFEST	Fri Jul 27 19:53:01 2007
X@@ -23,6 +23,9 @@
X t/17splitmessage.t
X t/18halt.t
X t/19refcounting.t
X+t/20passfd.t
X+t/21parsestring.t
X+t/22mwarnings.t
X t/98podsyn.t
X t/99podcov.t
X lib/SGML/Parser/OpenSP.pm
X@@ -31,4 +34,3 @@
X samples/test.soc
X samples/xml.dcl
X samples/xhtml1-strict-s.dtd
X-META.yml                                 Module meta-data (added by MakeMaker)
END-of-p5-SGML-Parser-OpenSP/files/patch-MANIFEST
echo x - p5-SGML-Parser-OpenSP/files/patch-OpenSP.xs
sed 's/^X//' >p5-SGML-Parser-OpenSP/files/patch-OpenSP.xs << 'END-of-p5-SGML-Parser-OpenSP/files/patch-OpenSP.xs'
X--- OpenSP.xs.sav	Fri Jul 27 19:59:34 2007
X+++ OpenSP.xs	Fri Jul 27 20:00:33 2007
X@@ -1,6 +1,6 @@
X // OpenSP.xs -- OpenSP XS Wrapper
X //
X-// $Id: OpenSP.xs,v 1.28 2005/08/16 15:30:22 hoehrmann Exp $
X+// $Id: OpenSP.xs,v 1.29 2006/10/31 07:42:37 hoehrmann Exp $
X 
X // workaround for broken math.h in VC++ 6.0
X #if defined(_MSC_VER) && _MSC_VER < 1300
X@@ -445,7 +445,7 @@
X     AV* av = (AV*)rv;
X     I32 len = av_len(av);
X 
X-    for (I32 i = 0; i < len; ++i)
X+    for (I32 i = 0; i <= len; ++i)
X     {
X         SV** svp = av_fetch(av, i, 0);
X 
END-of-p5-SGML-Parser-OpenSP/files/patch-OpenSP.xs
echo x - p5-SGML-Parser-OpenSP/files/patch-lib-SGML-Parser-OpenSP-Tools.pm
sed 's/^X//' >p5-SGML-Parser-OpenSP/files/patch-lib-SGML-Parser-OpenSP-Tools.pm << 'END-of-p5-SGML-Parser-OpenSP/files/patch-lib-SGML-Parser-OpenSP-Tools.pm'
X--- lib/SGML/Parser/OpenSP/Tools.pm.sav	Fri Jul 27 20:01:41 2007
X+++ lib/SGML/Parser/OpenSP/Tools.pm	Fri Jul 27 20:02:04 2007
X@@ -1,6 +1,6 @@
X # Tools.pm -- SGML::Parser::OpenSP::Tools module
X #
X-# $Id: Tools.pm,v 1.8 2005/08/16 15:30:22 hoehrmann Exp $
X+# $Id: Tools.pm,v 1.9 2006/08/30 14:50:35 hoehrmann Exp $
X 
X package SGML::Parser::OpenSP::Tools;
X use 5.008; 
END-of-p5-SGML-Parser-OpenSP/files/patch-lib-SGML-Parser-OpenSP-Tools.pm
echo x - p5-SGML-Parser-OpenSP/files/patch-lib-SGML-Parser-OpenSP.pm
sed 's/^X//' >p5-SGML-Parser-OpenSP/files/patch-lib-SGML-Parser-OpenSP.pm << 'END-of-p5-SGML-Parser-OpenSP/files/patch-lib-SGML-Parser-OpenSP.pm'
X--- lib/SGML/Parser/OpenSP.pm.sav	Fri Jul 27 20:04:03 2007
X+++ lib/SGML/Parser/OpenSP.pm	Fri Jul 27 20:04:24 2007
X@@ -1,6 +1,6 @@
X # OpenSP.pm -- SGML::Parser::OpenSP module
X #
X-# $Id: OpenSP.pm,v 1.31 2006/08/30 14:34:01 hoehrmann Exp $
X+# $Id: OpenSP.pm,v 1.33 2006/08/30 14:58:16 hoehrmann Exp $
X 
X package SGML::Parser::OpenSP;
X use 5.008; 
END-of-p5-SGML-Parser-OpenSP/files/patch-lib-SGML-Parser-OpenSP.pm
echo x - p5-SGML-Parser-OpenSP/files/patch-t-20passfd.t
sed 's/^X//' >p5-SGML-Parser-OpenSP/files/patch-t-20passfd.t << 'END-of-p5-SGML-Parser-OpenSP/files/patch-t-20passfd.t'
X--- /dev/null	Fri Jul 27 20:05:08 2007
X+++ t/20passfd.t	Fri Jul 27 20:06:50 2007
X@@ -0,0 +1,46 @@
X+# 20passfd.t -- ...
X+#
X+# $Id: 20passfd.t,v 1.4 2005/08/14 18:07:19 hoehrmann Exp $
X+
X+use strict;
X+use warnings;
X+use Test::More tests => 7;
X+use Test::Exception;
X+use File::Spec qw();
X+
X+use constant NO_DOCTYPE   => File::Spec->catfile('samples', 'no-doctype.xml');
X+use constant TEST_CATALOG => File::Spec->catfile('samples', 'test.soc');
X+
X+BEGIN { use_ok('SGML::Parser::OpenSP') };
X+require_ok('SGML::Parser::OpenSP');
X+my $p = SGML::Parser::OpenSP->new;
X+isa_ok($p, 'SGML::Parser::OpenSP');
X+
X+sub TestHandler20::new { bless{ok1=>0},shift }
X+sub TestHandler20::start_element { shift->{ok1}++ }
X+
X+sub TestHandler21::new { bless{ok1=>0},shift }
X+sub TestHandler21::start_element { shift->{ok1}++ }
X+
X+#
X+# Check pass as filename (should work on all platforms).
X+$p = SGML::Parser::OpenSP->new;
X+my $h1 = TestHandler20->new;
X+$p->handler($h1);
X+$p->pass_file_descriptor(0);
X+lives_ok { $p->parse_string("<no-doctype></no-doctype>") } 'parse_string with temp file name';
X+is($h1->{ok1}, 1, "temp file name handler called");
X+undef $p;
X+
X+#
X+# Check pass as file descriptor (not on Win32).
X+SKIP: {
X+  skip 'passing fds for temp files not supported on Win32', 2 if $^O eq 'MSWin32';
X+  $p = SGML::Parser::OpenSP->new;
X+  my $h2 = TestHandler21->new;
X+  $p->handler($h2);
X+  $p->pass_file_descriptor(1);
X+  lives_ok { $p->parse_string("<no-doctype></no-doctype>") } 'parse by fd';
X+  is($h2->{ok1}, 1, "temp file descriptor handler called");
X+  undef $p;
X+}
END-of-p5-SGML-Parser-OpenSP/files/patch-t-20passfd.t
echo x - p5-SGML-Parser-OpenSP/files/patch-t-21parsestring.t
sed 's/^X//' >p5-SGML-Parser-OpenSP/files/patch-t-21parsestring.t << 'END-of-p5-SGML-Parser-OpenSP/files/patch-t-21parsestring.t'
X--- /dev/null	Fri Jul 27 20:05:08 2007
X+++ t/21parsestring.t	Fri Jul 27 20:06:55 2007
X@@ -0,0 +1,65 @@
X+# 06parseliteral.t -- ...
X+#
X+# $Id: 21parsestring.t,v 1.1 2006/03/06 08:51:59 tbe Exp $
X+
X+use strict;
X+use warnings;
X+use Test::More tests => 13;
X+use Test::Exception;
X+use File::Spec qw();
X+
X+use constant NO_DOCTYPE   => File::Spec->catfile('samples', 'no-doctype.xml');
X+use constant TEST_CATALOG => File::Spec->catfile('samples', 'test.soc');
X+
X+BEGIN { use_ok('SGML::Parser::OpenSP') };
X+require_ok('SGML::Parser::OpenSP');
X+my $p = SGML::Parser::OpenSP->new;
X+isa_ok($p, 'SGML::Parser::OpenSP');
X+
X+#########################################################
X+## Parse using ->parse_string().
X+#########################################################
X+
X+sub TestHandler1::new { bless{ok1=>0,ok2=>0,ok3=>0,ok4=>0,ok5=>0,
X+                              ok6=>0,ok7=>0,ok8=>0,ok9=>0,oka=>0},shift }
X+sub TestHandler1::start_element {
X+    my $s = shift;
X+    my $e = shift;
X+    
X+    return unless defined $s;
X+    return unless defined $e;
X+    
X+    $s->{ok1}++ if UNIVERSAL::isa($s, 'TestHandler1');
X+
X+    # Name
X+    $s->{ok2}++ if exists $e->{Name};
X+    $s->{ok3}++ if $e->{Name} =~ /no-doctype/i;
X+    
X+    # Attributes
X+    $s->{ok4}++ if exists $e->{Attributes};
X+    $s->{ok5}++ if UNIVERSAL::isa($e->{Attributes}, "HASH");
X+    $s->{ok6}++ if scalar(keys(%{$_[1]->{Attributes}})) == 0;
X+    
X+    # Included
X+    $s->{ok7}++ if exists $e->{Included};
X+    $s->{ok8}++ if $e->{Included} == 0;
X+    
X+    # ContentType
X+    $s->{ok9}++ if exists $e->{ContentType};
X+}
X+
X+my $h1 = TestHandler1->new;
X+
X+$p->handler($h1);
X+lives_ok { $p->parse_string("<no-doctype></no-doctype>") }
X+  'parsing with parse_string()';
X+
X+ok($h1->{ok1}, 'self to handler');
X+ok($h1->{ok2}, 'has name');
X+ok($h1->{ok3}, 'proper name');
X+ok($h1->{ok4}, 'has attrs');
X+ok($h1->{ok5}, 'attrs hash ref');
X+ok($h1->{ok6}, 'proper attrs');
X+ok($h1->{ok7}, 'has included');
X+ok($h1->{ok8}, 'included == 0');
X+ok($h1->{ok9}, 'has content type');
END-of-p5-SGML-Parser-OpenSP/files/patch-t-21parsestring.t
echo x - p5-SGML-Parser-OpenSP/files/patch-t-22mwarnings.t
sed 's/^X//' >p5-SGML-Parser-OpenSP/files/patch-t-22mwarnings.t << 'END-of-p5-SGML-Parser-OpenSP/files/patch-t-22mwarnings.t'
X--- /dev/null	Fri Jul 27 20:05:08 2007
X+++ t/22mwarnings.t	Fri Jul 27 20:06:59 2007
X@@ -0,0 +1,67 @@
X+# 10errors.t -- ...
X+#
X+# $Id: 22mwarnings.t,v 1.1 2006/11/07 11:14:13 hoehrmann Exp $
X+
X+use strict;
X+use warnings;
X+use Test::More tests => 7;
X+use Test::Exception;
X+use File::Spec qw();
X+
X+use constant NO_DOCTYPE   => File::Spec->catfile('samples', 'no-doctype.xml');
X+use constant TEST_CATALOG => File::Spec->catfile('samples', 'test.soc');
X+
X+BEGIN { use_ok('SGML::Parser::OpenSP') };
X+require_ok('SGML::Parser::OpenSP');
X+my $p = SGML::Parser::OpenSP->new;
X+isa_ok($p, 'SGML::Parser::OpenSP');
X+
X+#########################################################
X+## Error reporting
X+#########################################################
X+
X+sub TestHandler5::new         { bless{ok=>0},shift }
X+sub TestHandler5::error
X+{
X+    return unless @_ == 2;
X+    $_[0]->{ok}++ if $_[1]->{Message} =~ /:8:7:W:/;
X+}
X+
X+my $h5 = TestHandler5->new;
X+$p->catalogs(TEST_CATALOG);
X+$p->warnings('xml');
X+$p->handler($h5);
X+lives_ok { $p->parse("<LITERAL>" . <<"__DOC__");
X+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
X+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
X+<html xmlns="http://www.w3.org/1999/xhtml">
X+<head>
X+<title></title>
X+</head>
X+<body>
X+<p>foo & bar</p>
X+</body>
X+</html>
X+__DOC__
X+} 'ampersand as data';
X+
X+is($h5->{ok}, 1, 'ampersand as data generates warning');
X+
X+# special case
X+$p->warnings(qw/non-sgml-char-ref valid no-duplicate xml/);
X+
X+lives_ok { $p->parse("<LITERAL>" . <<"__DOC__");
X+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
X+    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
X+<html xmlns="http://www.w3.org/1999/xhtml">
X+<head>
X+<title></title>
X+</head>
X+<body>
X+<p>foo & bar</p>
X+</body>
X+</html>
X+__DOC__
X+} 'ampersand as data';
X+
X+is($h5->{ok}, 2, 'ampersand as data generates warning');
END-of-p5-SGML-Parser-OpenSP/files/patch-t-22mwarnings.t
echo x - p5-SGML-Parser-OpenSP/files/patch-Makefile.PL
sed 's/^X//' >p5-SGML-Parser-OpenSP/files/patch-Makefile.PL << 'END-of-p5-SGML-Parser-OpenSP/files/patch-Makefile.PL'
X--- Makefile.PL.sav	Fri Jul 27 20:21:42 2007
X+++ Makefile.PL	Fri Jul 27 20:24:54 2007
X@@ -26,6 +26,10 @@
X       Test::Exception => 0,
X       File::Temp      => 0,
X     },
X+    PM                => {
X+      'lib/SGML/Parser/OpenSP.pm' => '$(INST_LIB)/SGML/Parser/OpenSP.pm',
X+      'lib/SGML/Parser/OpenSP/Tools.pm' => '$(INST_LIB)/SGML/Parser/OpenSP/Tools.pm'
X+    },
X     ($] >= 5.005 ?
X       (ABSTRACT_FROM  => 'lib/SGML/Parser/OpenSP.pm',
X        AUTHOR         => 'Bjoern Hoehrmann <bjoern at hoehrmann.de>') : ()),
END-of-p5-SGML-Parser-OpenSP/files/patch-Makefile.PL
exit
--- p5-SGML-Parser-OpenSP-0.100r1.shar ends here ---

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list