r48294 - in /branches/upstream/libxml-quote-perl: ./ current/ current/debian/ current/t/
opensides-guest at users.alioth.debian.org
opensides-guest at users.alioth.debian.org
Sat Dec 5 21:48:28 UTC 2009
Author: opensides-guest
Date: Sat Dec 5 21:48:23 2009
New Revision: 48294
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=48294
Log:
[svn-inject] Installing original source of libxml-quote-perl
Added:
branches/upstream/libxml-quote-perl/
branches/upstream/libxml-quote-perl/current/
branches/upstream/libxml-quote-perl/current/Changes
branches/upstream/libxml-quote-perl/current/MANIFEST
branches/upstream/libxml-quote-perl/current/Makefile.PL (with props)
branches/upstream/libxml-quote-perl/current/Quote.pm
branches/upstream/libxml-quote-perl/current/Quote.xs
branches/upstream/libxml-quote-perl/current/README
branches/upstream/libxml-quote-perl/current/debian/
branches/upstream/libxml-quote-perl/current/debian/changelog
branches/upstream/libxml-quote-perl/current/debian/compat
branches/upstream/libxml-quote-perl/current/debian/control
branches/upstream/libxml-quote-perl/current/debian/copyright
branches/upstream/libxml-quote-perl/current/debian/rules (with props)
branches/upstream/libxml-quote-perl/current/debian/watch
branches/upstream/libxml-quote-perl/current/t/
branches/upstream/libxml-quote-perl/current/t/benchmark.pl (with props)
branches/upstream/libxml-quote-perl/current/t/quote.t (with props)
Added: branches/upstream/libxml-quote-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-quote-perl/current/Changes?rev=48294&op=file
==============================================================================
--- branches/upstream/libxml-quote-perl/current/Changes (added)
+++ branches/upstream/libxml-quote-perl/current/Changes Sat Dec 5 21:48:23 2009
@@ -1,0 +1,11 @@
+Revision history for Perl extension XML::Quote.
+
+1.02 Fri Jan 31 13:20:01 2003
+ - minor utf8-related fix
+
+1.01 Sat Jan 25 13:17:40 2003
+ - add xml_quote_min
+
+1.00 Thu Jan 23 18:17:48 2003
+ - original version
+
Added: branches/upstream/libxml-quote-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-quote-perl/current/MANIFEST?rev=48294&op=file
==============================================================================
--- branches/upstream/libxml-quote-perl/current/MANIFEST (added)
+++ branches/upstream/libxml-quote-perl/current/MANIFEST Sat Dec 5 21:48:23 2009
@@ -1,0 +1,8 @@
+Changes
+MANIFEST
+Makefile.PL
+README
+Quote.pm
+Quote.xs
+t/benchmark.pl
+t/quote.t
Added: branches/upstream/libxml-quote-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-quote-perl/current/Makefile.PL?rev=48294&op=file
==============================================================================
--- branches/upstream/libxml-quote-perl/current/Makefile.PL (added)
+++ branches/upstream/libxml-quote-perl/current/Makefile.PL Sat Dec 5 21:48:23 2009
@@ -1,0 +1,15 @@
+#!/usr/bin/perl
+use ExtUtils::MakeMaker;
+# $Version: release/perl/base/XML-Quote/Makefile.PL,v 1.2 2003/01/24 13:41:54 godegisel Exp $
+
+WriteMakefile(
+ 'NAME' => 'XML::Quote',
+ 'VERSION_FROM' => 'Quote.pm',
+ 'PREREQ_PM' => {},
+ ($] >= 5.005 ?
+ (ABSTRACT_FROM => 'Quote.pm',
+ AUTHOR => 'Sergey Skvortsov <skv at protey.ru>') : ()),
+ 'LIBS' => [''],
+ 'DEFINE' => '',
+ 'INC' => '',
+);
Propchange: branches/upstream/libxml-quote-perl/current/Makefile.PL
------------------------------------------------------------------------------
svn:executable =
Added: branches/upstream/libxml-quote-perl/current/Quote.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-quote-perl/current/Quote.pm?rev=48294&op=file
==============================================================================
--- branches/upstream/libxml-quote-perl/current/Quote.pm (added)
+++ branches/upstream/libxml-quote-perl/current/Quote.pm Sat Dec 5 21:48:23 2009
@@ -1,0 +1,127 @@
+package XML::Quote;
+# $Version: release/perl/base/XML-Quote/Quote.pm,v 1.6 2003/01/31 09:03:57 godegisel Exp $
+
+use strict;
+use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
+
+require Exporter;
+require DynaLoader;
+require AutoLoader;
+
+ at ISA = qw(Exporter DynaLoader);
+ at EXPORT = qw(
+ xml_quote
+ xml_dequote
+);
+ at EXPORT_OK = qw(
+ xml_quote
+ xml_dequote
+ xml_quote_min
+);
+%EXPORT_TAGS = (
+ all => [qw(
+ xml_quote
+ xml_dequote
+ xml_quote_min
+ )],
+);
+$VERSION = '1.02';
+
+bootstrap XML::Quote $VERSION;
+
+1;
+__END__
+=pod
+
+=head1 NAME
+
+XML::Quote - XML quote/dequote functions
+
+=head1 SYNOPSIS
+
+ use strict;
+ use XML::Quote qw(:all);
+
+ my $str=q{666 > 444 & "apple" < 'earth'};
+ print xml_quote($str),"\n";
+ # 666 > 444 & "apple" < 'earth'
+
+ my $str2=q{666 > 444 & "apple" < 'earth'};
+ print xml_dequote($str2),"\n";
+ # 666 > 444 & "apple" < 'earth'
+
+ my $str3=q{666 > 444 & "apple" < 'earth'};
+ print xml_quote_min($str3),"\n";
+ # 666 > 444 & "apple" < 'earth'
+
+=head1 DESCRIPTION
+
+This module provides functions to quote/dequote strings in "xml"-way.
+
+All functions are written in XS and are very fast; they correctly process
+utf8, tied, overloaded variables and all the rest of perl "magic".
+
+=head1 FUNCTIONS
+
+=over 4
+
+=item $quoted = xml_quote($str);
+
+This function replaces all occurences of symbols '&', '"', ''', '>', '<'
+to '&', '"', ''', '>', '<' respectively.
+
+Returns quoted string or undef if $str is undef.
+
+=item $dequoted = xml_dequote($str);
+
+This function replaces all occurences of '&', '"', ''', '>',
+'<' to '&', '"', ''', '>', '<' respectively.
+All other entities (for example ) will not be touched.
+
+Returns dequoted string or undef if $str is undef.
+
+=item $quoted = xml_quote_min($str);
+
+This function replaces all occurences of symbols '&', '"', '<'
+to '&', '"', '<' respectively. Symbols ''' and '>' are not
+replaced.
+
+Returns quoted string or undef if $str is undef.
+
+=back
+
+=head1 EXPORT
+
+xml_quote(), xml_dequote() are exported as default.
+
+=head1 PERFORMANCE
+
+You can use t/benchmark.pl to test the perfomance. Here is the result
+on my P4 box.
+
+ Benchmark: timing 1000000 iterations of perl quote, xs quote...
+ perl quote: 108 wallclock secs (88.08 usr + 0.01 sys = 88.09 CPU) @ 11351.64/s (n=1000000)
+ xs quote: 20 wallclock secs (16.78 usr + 0.00 sys = 16.78 CPU) @ 59591.20/s (n=1000000)
+
+ Benchmark: timing 1000000 iterations of perl dequote, xs dequote...
+ perl dequote: 106 wallclock secs (85.22 usr + 0.09 sys = 85.31 CPU) @ 11721.54/s (n=1000000)
+ xs dequote: 19 wallclock secs (15.92 usr + 0.02 sys = 15.94 CPU) @ 62743.13/s (n=1000000)
+
+=head1 AUTHOR
+
+Sergey Skvortsov E<lt>skv at protey.ruE<gt>
+
+=head1 SEE ALSO
+
+L<http://www.w3.org/TR/REC-xml>,
+L<perlre>
+
+=head1 COPYRIGHT
+
+Copyright 2003 Sergey Skvortsov E<lt>skv at protey.ruE<gt>.
+All rights reserved.
+
+This library is free software; you can redistribute it
+and/or modify it under the same terms as Perl itself.
+
+=cut
Added: branches/upstream/libxml-quote-perl/current/Quote.xs
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-quote-perl/current/Quote.xs?rev=48294&op=file
==============================================================================
--- branches/upstream/libxml-quote-perl/current/Quote.xs (added)
+++ branches/upstream/libxml-quote-perl/current/Quote.xs Sat Dec 5 21:48:23 2009
@@ -1,0 +1,486 @@
+/* $Version: release/perl/base/XML-Quote/Quote.xs,v 1.12 2003/01/31 09:16:58 godegisel Exp $ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+#ifdef __cplusplus
+}
+#endif
+
+#define XQ_DEBUG 0
+
+#ifdef SVf_UTF8
+#define XML_Util_UTF8
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+
+// '"'==0x22 " 5
+// '&'==0x26 & 4
+// '\''==0x27 ' 5
+// '<'==0x3C < 3
+// '>'==0x3E > 3
+
+static STRLEN XQ_quote_add[] = {
+// 0x00 - 0x0F
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+// 0x10 - 0x1F
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+// 0x20 - 0x2F
+0,0,5,0,0,0,4,5,0,0,0,0,0,0,0,0,
+// 0x30 - 0x3F
+0,0,0,0,0,0,0,0,0,0,0,0,3,0,3,0,
+};
+
+static STRLEN XQ_quote_add_min[] = {
+// 0x00 - 0x0F
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+// 0x10 - 0x1F
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+// 0x20 - 0x2F
+0,0,5,0,0,0,4,0,0,0,0,0,0,0,0,0,
+// 0x30 - 0x3F
+0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,0,
+};
+
+//////////////////////////////////////////////////////////////////////////////
+
+static SV *
+xml_quote(SV * srcSV) {
+ SV * dstSV;
+ unsigned char * src, * src2;
+ unsigned char * dst;
+ unsigned char c;
+ STRLEN src_len, src_len2, dst_len, offset;
+
+ src=SvPV(srcSV, src_len); //length without trailing \0
+
+#if XQ_DEBUG
+ warn("source=%s\n",src);
+ warn("src=%p\n",src);
+#endif
+
+ dst_len=src_len;
+ src2=src;
+ src_len2=src_len;
+
+#if XQ_DEBUG
+ warn("source length=%i\n",src_len);
+#endif
+
+ // calculate target string length
+ while(src_len2--) {
+ c=*src2++;
+ if(c < 0x3F && (offset=XQ_quote_add[c]) ) {
+#if XQ_DEBUG
+ warn("add offset=%i [symbol=%i]\n",offset,c);
+#endif
+ dst_len+=offset;
+ }
+/* table lookup is faster (or not?...)
+ if(c > 0x3E || c < 0x22) { // || < 0x22
+ continue;
+ }
+ if('&'==c) { // 0x26
+ // &
+ dst_len+=4;
+ }else if('"'==c) { // 0x22
+ // "
+ dst_len+=5;
+ }else if('\''==c) { // 0x27
+ // '
+ dst_len+=5;
+ }else if('<'==c) { // 0x3C
+ // <
+ dst_len+=3;
+ }else if('>'==c) { // 0x3E
+ // >
+ dst_len+=3;
+ }//if
+*/
+ }//while
+
+ if(dst_len == src_len) {
+#if XQ_DEBUG
+ warn("nothing to quote\n");
+#endif
+ // nothing to quote
+ dstSV=newSVpv(src, dst_len);
+#ifdef XML_Util_UTF8
+ if(SvUTF8(srcSV))
+ SvUTF8_on(dstSV);
+#endif
+ return dstSV;
+ }
+
+#if XQ_DEBUG
+ warn("dest length=%i\n",dst_len);
+#endif
+
+ dstSV=newSV(dst_len);
+ SvCUR_set(dstSV, dst_len);
+ SvPOK_on(dstSV);
+#ifdef XML_Util_UTF8
+ if(SvUTF8(srcSV))
+ SvUTF8_on(dstSV);
+#endif
+
+ dst=SvPVX(dstSV);
+
+ while(src_len--) { // \0 also copied
+ c=*src++;
+#if XQ_DEBUG
+ warn("src_len=%i symbol=%c src=%lx\n",src_len,c,src);
+#endif
+// if(c > 0x3E || c < 0x22) {
+ if(c > 0x3E || ! XQ_quote_add[c]) {
+ *dst++=c;
+ continue;
+ }
+/* it's overkill
+#ifdef XML_Util_UTF8
+ // really 'dst_len' has other semantic (i.e. 'sym_len')
+ // I just reuse it ;)
+ dst_len=PL_utf8skip[c]; //dst_len=UTF8SKIP(c);
+ if(dst_len > 1) {
+ *dst++=c;
+ while(--dst_len) {
+ *dst++=*src++;
+ src_len--;
+ }
+ continue;
+ }
+#endif
+*/
+ *dst++='&';
+ if('&'==c) { // 0x26
+ // &
+ *dst++='a'; *dst++='m'; *dst++='p';
+ }else if('>'==c) { // 0x3E
+ // >
+ *dst++='g'; *dst++='t';
+ }else if('<'==c) { // 0x3C
+ // <
+ *dst++='l'; *dst++='t';
+ }else if('"'==c) { // 0x22
+ // "
+ *dst++='q'; *dst++='u'; *dst++='o'; *dst++='t';
+// }else if('\''==c) { // 0x27
+ }else {
+ // '
+ *dst++='a'; *dst++='p'; *dst++='o'; *dst++='s';
+ }//if
+ *dst++=';';
+ }//while
+
+ return dstSV;
+}
+//////////////////////////////////////////////////////////////////////////////
+
+static SV *
+xml_quote_min(SV * srcSV) {
+ SV * dstSV;
+ unsigned char * src, * src2;
+ unsigned char * dst;
+ unsigned char c;
+ STRLEN src_len, src_len2, dst_len, offset;
+
+ src=SvPV(srcSV, src_len); //length without trailing \0
+
+#if XQ_DEBUG
+ warn("source=%s\n",src);
+ warn("src=%p\n",src);
+#endif
+
+ dst_len=src_len;
+ src2=src;
+ src_len2=src_len;
+
+#if XQ_DEBUG
+ warn("source length=%i\n",src_len);
+#endif
+
+ // calculate target string length
+ while(src_len2--) {
+ c=*src2++;
+ if(c < 0x3D && (offset=XQ_quote_add_min[c]) ) {
+#if XQ_DEBUG
+ warn("add offset=%i [symbol=%i]\n",offset,c);
+#endif
+ dst_len+=offset;
+ }
+ }//while
+
+ if(dst_len == src_len) {
+#if XQ_DEBUG
+ warn("nothing to quote\n");
+#endif
+ // nothing to quote
+ dstSV=newSVpv(src, dst_len);
+#ifdef XML_Util_UTF8
+ if(SvUTF8(srcSV))
+ SvUTF8_on(dstSV);
+#endif
+ return dstSV;
+ }
+
+#if XQ_DEBUG
+ warn("dest length=%i\n",dst_len);
+#endif
+
+ dstSV=newSV(dst_len);
+ SvCUR_set(dstSV, dst_len);
+ SvPOK_on(dstSV);
+#ifdef XML_Util_UTF8
+ if(SvUTF8(srcSV))
+ SvUTF8_on(dstSV);
+#endif
+
+ dst=SvPVX(dstSV);
+
+ while(src_len--) { // \0 also copied
+ c=*src++;
+#if XQ_DEBUG
+ warn("src_len=%i symbol=%c src=%lx\n",src_len,c,src);
+#endif
+ if(c > 0x3C || ! XQ_quote_add_min[c]) {
+ *dst++=c;
+ continue;
+ }
+
+ *dst++='&';
+ if('&'==c) { // 0x26
+ // &
+ *dst++='a'; *dst++='m'; *dst++='p';
+ }else if('<'==c) { // 0x3C
+ // <
+ *dst++='l'; *dst++='t';
+// }else if('"'==c) { // 0x22
+ }else {
+ // "
+ *dst++='q'; *dst++='u'; *dst++='o'; *dst++='t';
+ }//if
+ *dst++=';';
+ }//while
+
+ return dstSV;
+}
+//////////////////////////////////////////////////////////////////////////////
+static SV *
+xml_dequote(SV * srcSV) {
+ SV * dstSV;
+ unsigned char * src, *src2;
+ unsigned char * dst;
+ unsigned char c,c1,c2,c3,c4;
+ STRLEN src_len, src_len2, dst_len;
+
+ src=SvPV(srcSV, src_len); //length without trailing \0
+// warn("src_len=%i",src_len);
+ src2=src;
+ src_len2=src_len;
+ dst_len=src_len;
+
+ // calculate dequoted string length
+ while(src_len >=3) {
+ c=*src++;
+ src_len--;
+
+ if('&'!=c) {
+ continue;
+ }
+ /*
+ &
+ "
+ '
+ <
+ >
+ */
+ c=*src;
+ c1=*(src+1);
+ c2=*(src+2);
+ if(c2==';' && c1=='t' && (c=='l' || c=='g')) {
+ dst_len-=3;
+ src+=3;
+ src_len-=3;
+ continue;
+ }
+
+ if(src_len >= 4) {
+ c3=*(src+3);
+ }else {
+ continue;
+ }
+
+ if(c=='a' && c1=='m' && c2=='p' && c3==';') {
+ dst_len-=4;
+ src+=4;
+ src_len-=4;
+ continue;
+ }
+
+ if(src_len >= 5) {
+ c4=*(src+4);
+ }else {
+ continue;
+ }
+
+ if(c4==';'
+ && (
+ (c=='q' && c1=='u' && c2=='o' && c3=='t')
+ ||
+ (c=='a' && c1=='p' && c2=='o' && c3=='s')
+ )
+ ) {
+ dst_len-=5;
+ src+=5;
+ src_len-=5;
+ continue;
+ }//if
+ }//while
+
+ if(dst_len == src_len2) {
+ // nothing to dequote
+ dstSV=newSVpv(src2, dst_len);
+#ifdef XML_Util_UTF8
+ if(SvUTF8(srcSV))
+ SvUTF8_on(dstSV);
+#endif
+// warn("nothing to dequote");
+ return dstSV;
+ }
+
+// dstSV=newSVpv("", dst_len);
+ dstSV=newSV(dst_len);
+ SvCUR_set(dstSV, dst_len);
+ SvPOK_on(dstSV);
+#ifdef XML_Util_UTF8
+ if(SvUTF8(srcSV))
+ SvUTF8_on(dstSV);
+#endif
+ dst=SvPVX(dstSV);
+
+ while(src_len2>=3) { // 3 is min length of quoted symbol
+ c=*src2++;
+ src_len2--;
+ if('&'!=c) {
+ *dst++=c;
+ continue;
+ }
+ c=*src2;
+ c1=*(src2+1);
+ c2=*(src2+2);
+
+ // 1. test len=3: < >
+ if(c1=='t' && c2==';') {
+ if(c=='l') {
+ *dst++='<';
+ src2+=3;
+ src_len2-=3;
+ continue;
+ }else if(c=='g') {
+ *dst++='>';
+ }else {
+ *dst++='&';
+ continue;
+ }
+ src2+=3;
+ src_len2-=3;
+ continue;
+ }//if lt | gt
+
+
+ // 2. test len=4: &
+ if(src_len2 >= 4) {
+ c3=*(src2+3);
+ }else {
+ *dst++='&';
+ continue;
+ }
+
+ if(c=='a' && c1=='m' && c2=='p' && c3==';') {
+ *dst++='&';
+ src2+=4;
+ src_len2-=4;
+ continue;
+ }
+
+ // 3. test len=5: " '
+ if(src_len2 >= 5) {
+ c4=*(src2+4);
+ }else {
+ *dst++='&';
+ continue;
+ }
+
+ if(c4==';') {
+ if(c=='q' && c1=='u' && c2=='o' && c3=='t') {
+ *dst++='"';
+ }else if(c=='a' && c1=='p' && c2=='o' && c3=='s') {
+ *dst++='\'';
+ }else {
+ *dst++='&';
+ continue;
+ }
+ src2+=5;
+ src_len2-=5;
+ continue;
+ }//if ;
+
+ *dst++='&';
+ }//while
+
+
+ while(src_len2-- > 0) { // also copy trailing \0
+ *dst++=*src2++;
+ }
+
+ return dstSV;
+}
+//////////////////////////////////////////////////////////////////////////////
+
+MODULE = XML::Quote PACKAGE = XML::Quote
+
+
+SV *
+xml_quote(string)
+ SV *string
+ INIT:
+ if(!SvOK(string)) {
+ XSRETURN_UNDEF;
+ }
+ CODE:
+ RETVAL = xml_quote(string);
+ OUTPUT:
+ RETVAL
+
+
+SV *
+xml_quote_min(string)
+ SV *string
+ INIT:
+ if(!SvOK(string)) {
+ XSRETURN_UNDEF;
+ }
+ CODE:
+ RETVAL = xml_quote_min(string);
+ OUTPUT:
+ RETVAL
+
+
+SV *
+xml_dequote(string)
+ SV *string
+ INIT:
+ if(!SvOK(string)) {
+ XSRETURN_UNDEF;
+ }
+ CODE:
+ RETVAL = xml_dequote(string);
+ OUTPUT:
+ RETVAL
+
Added: branches/upstream/libxml-quote-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-quote-perl/current/README?rev=48294&op=file
==============================================================================
--- branches/upstream/libxml-quote-perl/current/README (added)
+++ branches/upstream/libxml-quote-perl/current/README Sat Dec 5 21:48:23 2009
@@ -1,0 +1,23 @@
+Module: XML::Quote
+
+Description:
+ XML::Quote provides functions to quote/dequote strings in "xml"-way.
+
+Copying:
+ Copyright 2003 Sergey Skvortsov. All rights reserved.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the same terms as Perl itself.
+
+Prerequisites:
+ perl 5.005_03
+
+Build/Installation:
+ Standard build/installation supported by ExtUtils::MakeMaker(3)...
+ perl Makefile.PL
+ make
+ make test
+ make install
+
+Author:
+ Sergey Skvortsov <skv at protey.ru>
Added: branches/upstream/libxml-quote-perl/current/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-quote-perl/current/debian/changelog?rev=48294&op=file
==============================================================================
--- branches/upstream/libxml-quote-perl/current/debian/changelog (added)
+++ branches/upstream/libxml-quote-perl/current/debian/changelog Sat Dec 5 21:48:23 2009
@@ -1,0 +1,5 @@
+libxml-quote-perl (1.02-1) unstable; urgency=low
+
+ * Initial upload (Closes: #532684)
+
+ -- Cajus Pollmeier <cajus at debian.org> Tue, 24 Jun 2009 10:18:00 +0200
Added: branches/upstream/libxml-quote-perl/current/debian/compat
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-quote-perl/current/debian/compat?rev=48294&op=file
==============================================================================
--- branches/upstream/libxml-quote-perl/current/debian/compat (added)
+++ branches/upstream/libxml-quote-perl/current/debian/compat Sat Dec 5 21:48:23 2009
@@ -1,0 +1,1 @@
+5
Added: branches/upstream/libxml-quote-perl/current/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-quote-perl/current/debian/control?rev=48294&op=file
==============================================================================
--- branches/upstream/libxml-quote-perl/current/debian/control (added)
+++ branches/upstream/libxml-quote-perl/current/debian/control Sat Dec 5 21:48:23 2009
@@ -1,0 +1,20 @@
+Source: libxml-quote-perl
+Section: perl
+Priority: optional
+Build-Depends: debhelper (>= 5), perl (>= 5.6.10-12)
+Maintainer: GOsa packages mainteners group <gosa-pkg at oss.gonicus.de>
+Uploaders: Cajus Pollmeier <cajus at debian.org>, Benoit Mortier <benoit.mortier at opensides.be>
+Standards-Version: 3.8.2
+Homepage: http://search.cpan.org/dist/XML-Quote/
+Vcs-Browser: https://oss.gonicus.de/repositories/goto/trunk/libxml-quote-perl
+Vcs-Svn: https://oss.gonicus.de/repositories/goto/trunk/libxml-quote-perl
+
+Package: libxml-quote-perl
+Architecture: any
+Depends: ${perl:Depends}, ${shlibs:Depends}, ${misc:Depends}
+Description: XML quote/dequote functions
+ This module provides functions to quote/dequote strings in "xml"-way.
+ .
+ All functions are written in XS and are very fast; they correctly process
+ utf8, tied, overloaded variables and all the rest of perl "magic".
+ .
Added: branches/upstream/libxml-quote-perl/current/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-quote-perl/current/debian/copyright?rev=48294&op=file
==============================================================================
--- branches/upstream/libxml-quote-perl/current/debian/copyright (added)
+++ branches/upstream/libxml-quote-perl/current/debian/copyright Sat Dec 5 21:48:23 2009
@@ -1,0 +1,24 @@
+This is the debian package for the XML-Quote module.
+It was created by Cajus Pollmeier <pollmeier at gonicus.de>.
+
+It was downloaded from http://search.cpan.org/dist/XML-Quote/
+
+The upstream author is:
+
+Sergey Skvortsov <skv at protey.ru>.
+
+
+Copyright 2003 Sergey Skvortsov <skv at protey.ru>.
+All rights reserved.
+
+This library is free software; you can redistribute it
+and/or modify it under the same terms as Perl itself.
+
+Perl is distributed under your choice of the GNU General Public License or
+the Artistic License. On Debian GNU/Linux systems, the complete text of the
+GNU General Public License can be found in `/usr/share/common-licenses/GPL'
+and the Artistic Licence in `/usr/share/common-licenses/Artistic'.
+
+
+The Debian packaging is (C) 2008, Cajus Pollmeier <pollmeier at gonicus.de> and
+is licensed under the same terms as the software itself (see above).
Added: branches/upstream/libxml-quote-perl/current/debian/rules
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-quote-perl/current/debian/rules?rev=48294&op=file
==============================================================================
--- branches/upstream/libxml-quote-perl/current/debian/rules (added)
+++ branches/upstream/libxml-quote-perl/current/debian/rules Sat Dec 5 21:48:23 2009
@@ -1,0 +1,76 @@
+#!/usr/bin/make -f
+# This debian/rules file is provided as a template for normal perl
+# packages. It was created by Marc Brockschmidt <marc at dch-faq.de> for
+# the Debian Perl Group (http://pkg-perl.alioth.debian.org/) but may
+# be used freely wherever it is useful.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+# If set to a true value then MakeMaker's prompt function will
+# always return the default without waiting for user input.
+export PERL_MM_USE_DEFAULT=1
+
+PERL ?= /usr/bin/perl
+PACKAGE = $(shell dh_listpackages)
+TMP = $(CURDIR)/debian/$(PACKAGE)
+
+# Allow disabling build optimisation by setting noopt in
+# $DEB_BUILD_OPTIONS
+CFLAGS = -Wall -g
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+ CFLAGS += -O0
+else
+ CFLAGS += -O2
+endif
+
+build: build-stamp
+build-stamp:
+ dh_testdir
+ # Add commands to compile the package here
+ $(PERL) Makefile.PL INSTALLDIRS=vendor
+ $(MAKE) OPTIMIZE="$(CFLAGS)" LD_RUN_PATH=""
+ $(MAKE) test
+ touch $@
+
+clean:
+ dh_testdir
+ dh_testroot
+ dh_clean build-stamp install-stamp
+ # Add commands to clean up after the build process here
+ [ ! -f Makefile ] || $(MAKE) realclean
+
+install: install-stamp
+install-stamp: build-stamp
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ # Add commands to install the package into $(TMP)
+ $(MAKE) install DESTDIR=$(TMP) PREFIX=/usr
+ [ ! -d $(TMP)/usr/share/perl5 ] || \
+ rmdir --ignore-fail-on-non-empty --parents --verbose \
+ $(TMP)/usr/share/perl5
+ touch $@
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do here for an architecture-dependent package
+
+# Build architecture-dependent files here.
+binary-arch: build install
+ dh_testdir
+ dh_testroot
+ dh_installdocs README
+ dh_installchangelogs Changes
+ dh_shlibdeps
+ dh_strip
+ dh_perl
+ dh_compress
+ dh_fixperms
+ dh_installdeb
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
Propchange: branches/upstream/libxml-quote-perl/current/debian/rules
------------------------------------------------------------------------------
svn:executable =
Added: branches/upstream/libxml-quote-perl/current/debian/watch
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-quote-perl/current/debian/watch?rev=48294&op=file
==============================================================================
--- branches/upstream/libxml-quote-perl/current/debian/watch (added)
+++ branches/upstream/libxml-quote-perl/current/debian/watch Sat Dec 5 21:48:23 2009
@@ -1,0 +1,4 @@
+# format version number, currently 3; this line is compulsory!
+version=3
+# URL to the package page followed by a regex to search
+http://search.cpan.org/dist/XML-Quote/ .*/XML-Quote-v?(\d[\d_.-]+)\.(?:tar(?:\.gz|\.bz2)?|tgz|zip)$
Added: branches/upstream/libxml-quote-perl/current/t/benchmark.pl
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-quote-perl/current/t/benchmark.pl?rev=48294&op=file
==============================================================================
--- branches/upstream/libxml-quote-perl/current/t/benchmark.pl (added)
+++ branches/upstream/libxml-quote-perl/current/t/benchmark.pl Sat Dec 5 21:48:23 2009
@@ -1,0 +1,82 @@
+#!/usr/bin/perl
+# $Version: release/perl/base/XML-Quote/t/benchmark.pl,v 1.4 2003/01/25 13:17:41 godegisel Exp $
+use strict;
+use XML::Quote;
+use Benchmark;
+use utf8;
+
+use vars qw(@TESTS_0 @TESTS_1);
+
+ at TESTS_0=(
+'plain text without any special symbols',
+q{some symbols & "" ''''><<},
+44,
+123.11,
+'некий "ÑеÑÑ >в <\'ÑÑÑ8 &',
+);
+
+timethese(1_000_000,{
+'xs quote' => sub {
+ my $res;
+ for my $t (@TESTS_0) {
+ $res=xml_quote($t);
+ }
+},
+
+'perl quote' => sub {
+ my $res;
+ for my $t (@TESTS_0) {
+ $res=perl_quote($t);
+ }
+},
+
+});
+
+ at TESTS_1=(
+'plain text without any special symbols',
+q{some symbols & "" ''' > <<},
+44,
+123.11,
+'некий "ÑеÑÑ >в <'ÑÑÑ8 &',
+);
+
+timethese(1_000_000,{
+'xs dequote' => sub {
+ my $res;
+ for my $t (@TESTS_1) {
+ $res=xml_dequote($t);
+ }
+},
+
+'perl dequote' => sub {
+ my $res;
+ for my $t (@TESTS_1) {
+ $res=perl_dequote($t);
+ }
+},
+
+});
+
+sub perl_quote {
+ my $str=shift;
+
+ $str=~s/&/&/g;
+ $str=~s/"/"/g;
+ $str=~s/'/'/g;
+ $str=~s/>/>/g;
+ $str=~s/</</g;
+
+ return $str;
+}
+
+sub perl_dequote {
+ my $str=shift;
+
+ $str=~s/"/"/g;
+ $str=~s/'/'/g;
+ $str=~s/>/>/g;
+ $str=~s/</</g;
+ $str=~s/&/&/g;
+
+ return $str;
+}
Propchange: branches/upstream/libxml-quote-perl/current/t/benchmark.pl
------------------------------------------------------------------------------
svn:executable =
Added: branches/upstream/libxml-quote-perl/current/t/quote.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libxml-quote-perl/current/t/quote.t?rev=48294&op=file
==============================================================================
--- branches/upstream/libxml-quote-perl/current/t/quote.t (added)
+++ branches/upstream/libxml-quote-perl/current/t/quote.t Sat Dec 5 21:48:23 2009
@@ -1,0 +1,197 @@
+#!/usr/bin/perl
+# $Version: release/perl/base/XML-Quote/t/quote.t,v 1.6 2003/01/31 09:13:12 godegisel Exp $
+package TEST_OVERLOAD;
+use overload '""' => sub {${$_[0]} ? 'true' : 'false'};
+
+sub new {
+ my $v=$_[1];
+ bless \$v, $_[0];
+}
+
+package TEST_TIED;
+
+sub TIESCALAR {
+ my $val=$_[1];
+ bless \$val, $_[0];
+}
+
+sub FETCH {
+ uc(${$_[0]});
+}
+
+sub STORE {
+ ${$_[0]}=$_[1];
+}
+
+package main;
+use strict;
+use utf8;
+
+use Test::More tests => 48;
+
+BEGIN {use_ok('XML::Quote')};
+
+my @tests=(
+[
+"amp",
+"amp",
+],
+
+[
+"&",
+"&",
+],
+
+[
+qq{&"'><},
+"&"'><",
+],
+
+[
+"&",
+"&amp;",
+],
+
+[
+"\0",
+"\0",
+],
+
+[
+'plain text without any special symbols',
+'plain text without any special symbols',
+],
+
+[
+44,
+44,
+],
+
+[
+123.11,
+123.11,
+],
+
+[
+'некий "ÑеÑÑ >в <\'ÑÑÑ8 &',
+q{некий "ÑеÑÑ >в <'ÑÑÑ8 &},
+],
+);
+
+my ($to_quote, $expected, $quoted, $dequoted);
+for my $arr (@tests) {
+ my ($to_quote, $expected)=@$arr;
+ my $quoted=XML::Quote::xml_quote($to_quote);
+ is($quoted, $expected, 'xml_quote:'.$to_quote);
+ my $dequoted=XML::Quote::xml_dequote($quoted);
+ is($dequoted, $to_quote, 'xml_dequote:'.$expected);
+}#for
+
+my @tests_min=(
+[
+"amp",
+"amp",
+],
+
+[
+"&",
+"&",
+],
+
+[
+qq{&"'><},
+"&"'><",
+],
+
+[
+"\0",
+"\0",
+],
+
+[
+'plain text without any special symbols',
+'plain text without any special symbols',
+],
+
+[
+44,
+44,
+],
+
+[
+123.11,
+123.11,
+],
+
+[
+'некий "ÑеÑÑ >в <\'ÑÑÑ8 &',
+q{некий "ÑеÑÑ >в <'ÑÑÑ8 &},
+],
+);
+
+
+for my $arr (@tests_min) {
+ my ($to_quote, $expected)=@$arr;
+ my $quoted=XML::Quote::xml_quote_min($to_quote);
+ is($quoted, $expected, 'xml_quote_min:'.$to_quote);
+ my $dequoted=XML::Quote::xml_dequote($quoted);
+ is($dequoted, $to_quote, 'xml_dequote:'.$expected);
+}#for
+
+my @tests_overload=(
+[
+TEST_OVERLOAD->new(1),
+'true',
+],
+
+[
+TEST_OVERLOAD->new(0),
+'false',
+],
+);
+for my $arr (@tests_overload) {
+ my ($to_quote, $expected)=@$arr;
+ my $quoted=XML::Quote::xml_quote($to_quote);
+ is($quoted, $expected, 'over xml_quote:'.$to_quote);
+ my $dequoted=XML::Quote::xml_dequote($quoted);
+ is($dequoted, "$to_quote", 'over xml_dequote:'.$expected);
+}#for
+
+tie(my $tied_scalar,'TEST_TIED');
+$tied_scalar='test&rest';
+my @tests_tied=(
+[
+$tied_scalar,
+'TEST&REST',
+],
+);
+
+use Devel::Peek;
+for my $arr (@tests_tied) {
+ my ($to_quote, $expected)=@$arr;
+ my $quoted=XML::Quote::xml_quote($to_quote);
+ is($quoted, $expected, 'tied xml_quote:'.$to_quote);
+ my $dequoted=XML::Quote::xml_dequote($quoted);
+ is($dequoted, "$to_quote", 'tied xml_dequote:'.$expected);
+}#for
+
+my @tests2=(
+['&','&'],
+['"','"'],
+[''','\''],
+['><','><'],
+['&160','&160'],
+['&;','&;'],
+['&','&'],
+);
+
+#use Devel::Peek;
+for my $arr (@tests2) {
+ my ($bef,$aft)=@$arr;
+# Dump($bef);
+ my $cvt=XML::Quote::xml_dequote($bef);
+# Dump($aft);
+# Dump($cvt);
+ is($cvt, $aft, 'xml_dequote:'.$bef);
+}#for
+
Propchange: branches/upstream/libxml-quote-perl/current/t/quote.t
------------------------------------------------------------------------------
svn:executable =
More information about the Pkg-perl-cvs-commits
mailing list