r24567 - in /trunk/libdata-javascript-perl: ./ debian/ t/
ansgar-guest at users.alioth.debian.org
ansgar-guest at users.alioth.debian.org
Sun Aug 24 13:34:09 UTC 2008
Author: ansgar-guest
Date: Sun Aug 24 13:34:06 2008
New Revision: 24567
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=24567
Log:
* New upstream release.
* Add myself to Uploaders.
* Refresh debian/rules for debhelper 7
* Convert debian/copyright to proposed machine-readable format
* Remove COPYING (licensing information is now included in JavaScript.pm)
* debian/control: Remove trailing ", " from Depends, remove leading space
from Description, do not capitalize short description
* Install example.pl in /usr/share/doc/libdata-javascript-perl instead of
/usr/share/perl5/Data
* Do not install README (includes only a copy of example.pl and its output)
Added:
trunk/libdata-javascript-perl/debian/libdata-javascript-perl.docs
trunk/libdata-javascript-perl/debian/libdata-javascript-perl.examples
trunk/libdata-javascript-perl/t/1-load.t
- copied unchanged from r24566, branches/upstream/libdata-javascript-perl/current/t/1-load.t
trunk/libdata-javascript-perl/t/2-import.t
- copied unchanged from r24566, branches/upstream/libdata-javascript-perl/current/t/2-import.t
trunk/libdata-javascript-perl/t/3-js12.t
- copied unchanged from r24566, branches/upstream/libdata-javascript-perl/current/t/3-js12.t
trunk/libdata-javascript-perl/t/3-noArgs.t
- copied unchanged from r24566, branches/upstream/libdata-javascript-perl/current/t/3-noArgs.t
trunk/libdata-javascript-perl/t/3-undef.t
- copied unchanged from r24566, branches/upstream/libdata-javascript-perl/current/t/3-undef.t
trunk/libdata-javascript-perl/t/4-escape.t
- copied unchanged from r24566, branches/upstream/libdata-javascript-perl/current/t/4-escape.t
Removed:
trunk/libdata-javascript-perl/COPYING
trunk/libdata-javascript-perl/t/1.t
trunk/libdata-javascript-perl/t/2.t
trunk/libdata-javascript-perl/t/3.t
trunk/libdata-javascript-perl/t/4.t
trunk/libdata-javascript-perl/t/5.t
Modified:
trunk/libdata-javascript-perl/CHANGES
trunk/libdata-javascript-perl/JavaScript.pm
trunk/libdata-javascript-perl/MANIFEST
trunk/libdata-javascript-perl/TODO
trunk/libdata-javascript-perl/debian/changelog
trunk/libdata-javascript-perl/debian/compat
trunk/libdata-javascript-perl/debian/control
trunk/libdata-javascript-perl/debian/copyright
trunk/libdata-javascript-perl/debian/rules
Modified: trunk/libdata-javascript-perl/CHANGES
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-javascript-perl/CHANGES?rev=24567&op=diff
==============================================================================
--- trunk/libdata-javascript-perl/CHANGES (original)
+++ trunk/libdata-javascript-perl/CHANGES Sun Aug 24 13:34:06 2008
@@ -1,6 +1,20 @@
Revision history for Perl extension Data::JavaScript.
-1.11 Tue Nov 15 14:30:22 EST 2005
+1.13 Thu Aug 14 11:01:10 EDT 2008
+ - Finished implementing import
+ - "Simplified"/unified __quotemeta code forks
+
+1.12 Wed Aug 13 22:48:12 EDT 2008
+ - Some minor refactoring, including the removal of a dependency on
+ Exporter
+ - Fixed a misnumbered test in 1_11, which was intended to be a
+ development release.
+ - Escape </script> based on reports of certain stupid browsers
+ ceasing to parse JavaScript upon encountering this string,
+ even in strings.
+ - Added explicit license
+
+1_11 Tue Nov 15 14:30:22 EST 2005
- Touched up documentation
- Fixed syntax errors for hash key names that are also JS keywords
Reported by Kevin J. of Activestate
Modified: trunk/libdata-javascript-perl/JavaScript.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-javascript-perl/JavaScript.pm?rev=24567&op=diff
==============================================================================
--- trunk/libdata-javascript-perl/JavaScript.pm (original)
+++ trunk/libdata-javascript-perl/JavaScript.pm Sun Aug 24 13:34:06 2008
@@ -1,32 +1,53 @@
package Data::JavaScript;
require 5;
-use vars qw(@EXPORT @EXPORT_OK @ISA %OPT $VERSION);
+use vars qw(@EXPORT @EXPORT_OK %OPT $VERSION);
%OPT = (JS=>1.3);
-$VERSION = 1.11;
-
-use Exporter;
+$VERSION = 1.13;
+
@EXPORT = qw(jsdump hjsdump);
@EXPORT_OK = '__quotemeta';
- at ISA = qw(Exporter);
use strict;
require Encode unless $] < 5.007;
sub import{
+ my $package = shift;
+
foreach( @_ ){
if(ref($_) eq 'HASH'){
- foreach my $opt ( 'UNDEF', 'JS' ){
- if(exists($_->{$opt})){
- $OPT{$opt} = $_->{$opt};
- }
+ $OPT{JS} = $$_{JS} if exists($$_{JS});
+ $OPT{UNDEF} = $$_{UNDEF} if exists($$_{UNDEF});
+ }
+ }
+ $OPT{UNDEF} ||= $OPT{JS} > 1.2 ? 'undefined' : q('');
+
+ #use (); #imports nothing, as package is not supplied
+ if( defined $package ){
+ no strict 'refs';
+
+ #Remove options hash
+ my @import = grep { ! length ref } @_;
+
+ if( scalar @import ){
+ if( grep {/^:all$/} @import ){
+ @import = (@EXPORT, @EXPORT_OK) }
+ else{
+ #only user-specfied subset of @EXPORT, @EXPORT_OK
+ my $q = qr/@{[join('|', @EXPORT, @EXPORT_OK)]}/;
+ @import = grep { $_ =~ /$q/ } @import;
}
}
+ else{
+ @import = @EXPORT;
+ }
+
+ my $caller = caller;
+ for my $func (@import) {
+ *{"$caller\::$func"} = \&$func;
+ }
}
- $OPT{UNDEF} = exists($OPT{UNDEF}) || $OPT{JS} > 1.2 ? 'undefined' : q('');
- Data::JavaScript->export_to_level(1, grep {!ref($_)} @_);
-}
-
-#XXX version, ECMAscript even. Charset!
+}
+
sub hjsdump {
my @res = (qq(<script type="text/javascript" language="JavaScript$OPT{JS}" />),
'<!--', &jsdump(@_), '// -->', '</script>');
@@ -44,52 +65,49 @@
wantarray ? @res : join("\n", @res, "");
}
+
+my $QMver;
if( $] < 5.007 ){
- eval <<'EO5';
-sub __quotemeta {
- local $_ = shift;
-
- s<([^ \x21-\x5B\x5D-\x7E]+)>{sprintf(join('', '\x%02X' x length$1), unpack'C*',$1)}ge;
-
- #This is kind of ugly/inconsistent output for munged UTF-8
- s/\\x09/\\t/g;
- s/\\x0A/\\n/g;
- s/\\x0D/\\r/g;
- s/"/\\"/g;
- s/\\x5C/\\\\/g;
-
- return $_;
-}
+ $QMver=<<'EO5';
+ s<([^ \x21-\x5B\x5D-\x7E]+)>{sprintf(join('', '\x%02X' x length$1), unpack'C*',$1)}ge;
EO5
}
- else{
- eval<<'EO58';
-sub __quotemeta {
- local $_ = shift;
- if( $OPT{JS} >= 1.3 && Encode::is_utf8($_) ){
- s<([\x{0080}-\x{fffd}]+)>{sprintf '\u%0*v4X', '\u', $1}ge;
+else{
+ $QMver=<<'EO58';
+ if( $OPT{JS} >= 1.3 && Encode::is_utf8($_) ){
+ s<([\x{0080}-\x{fffd}]+)>{sprintf '\u%0*v4X', '\u', $1}ge;
+ }
+
+ {
+ use bytes;
+ s<((?:[^ \x21-\x7E]|(?:\\(?!u)))+)>{sprintf '\x%0*v2X', '\x', $1}ge;
+ }
+EO58
+}
+
+eval 'sub __quotemeta {local $_ = shift;' . $QMver . <<'EOQM';
+
+ #This is kind of ugly/inconsistent output for munged UTF-8
+ #tr won't work because we need the escaped \ for JS output
+ s/\\x09/\\t/g;
+ s/\\x0A/\\n/g;
+ s/\\x0D/\\r/g;
+ s/"/\\"/g;
+ s/\\x5C/\\\\/g;
+
+ #Escape </script> for stupid browsers that stop parsing
+ s%</script>%\\x3C\\x2Fscript\\x3E%g;
+
+ return $_;
}
-
- {
- use bytes;
- s<((?:[^ \x21-\x7E]|(?:\\(?!u)))+)>{sprintf '\x%0*v2X', '\x', $1}ge;
- }
-
- s/\\x09/\\t/g;
- s/\\x0A/\\n/g;
- s/\\x0D/\\r/g;
- s/"/\\"/g;
- s/\\x5C/\\\\/g;
-
- return $_;
-}
-EO58
-}
+EOQM
+
sub __jsdump {
my ($sym, $elem, $dict, $undef) = @_;
-
- unless (ref($elem)) {
+ my $ref;
+
+ unless( $ref = ref($elem) ){
unless( defined($elem) ){
return "$sym = @{[defined($undef) ? $undef : $OPT{UNDEF}]};";
}
@@ -111,7 +129,8 @@
}
$dict->{$elem} = $sym;
- if (UNIVERSAL::isa($elem, 'ARRAY')) {
+ #isa over ref in case we're given objects
+ if( $ref eq 'ARRAY' || UNIVERSAL::isa($elem, 'ARRAY') ){
my @list = ("$sym = new Array;");
my $n = 0;
foreach (@$elem) {
@@ -121,8 +140,7 @@
}
return @list;
}
-
- if (UNIVERSAL::isa($elem, 'HASH')) {
+ elsif( $ref eq 'HASH' || UNIVERSAL::isa($elem, 'HASH') ){
my @list = ("$sym = new Object;");
my ($k, $old_k, $v);
foreach $k (sort keys %$elem) {
@@ -132,6 +150,9 @@
}
return @list;
}
+ else{
+ return "//Unknown reference: $sym=$ref";
+ }
}
@@ -152,7 +173,7 @@
=head1 DESCRIPTION
-This module is mainly inteded for CGI programming, when a perl script
+This module is mainly intended for CGI programming, when a perl script
generates a page with client side JavaScript code that needs access to
structures created on the server.
@@ -176,6 +197,11 @@
Other useful values might be C<0>, C<null>, or C<NaN>.
+=head1 EXPORT
+
+In addition, althought the module no longer uses Exporter, it heeds its
+import conventions; C<qw(:all>), C<()>, etc.
+
=over
=item jsdump('name', \$reference, [$undef]);
@@ -195,10 +221,16 @@
hjsdump is identical to jsdump except that it wraps the content in script tags.
+=back
+
+=head1 EXPORTABLE
+
+=over
+
=item __quotemeta($str)
-Not exported by default, this function escapes non-printable and Unicode
-characters to promote playing nice with others.
+This function escapes non-printable and Unicode characters (where possible)
+to promote playing nice with others.
=back
@@ -207,7 +239,8 @@
Previously, the module eval'd any data it received that looked like a number;
read: real, hexadecimal, octal, or engineering notations. It now passes all
non-decimal values through as strings. You will need to C<eval> on the client
-or server side if you wish to use other notations as numbers.
+or server side if you wish to use other notations as numbers. This is meant
+to protect people who store ZIP codes with leading 0's.
Unicode support requires perl 5.8 or later. Older perls will gleefully escape
the non-printable portions of any UTF-8 they are fed, likely munging it in
@@ -215,9 +248,26 @@
problem and there is sufficient interest it may be possible to hack-in UTF-8
escaping for older perls.
+=head1 LICENSE
+
+=over
+
+=item * Thou shalt not claim ownership of unmodified materials.
+
+=item * Thou shalt not claim whole ownership of modified materials.
+
+=item * Thou shalt grant the indemnity of the provider of materials.
+
+=item * Thou shalt use and dispense freely without other restrictions.
+
+=back
+
+Or if you truly insist, you may use and distribute this under ther terms
+of Perl itself (GPL and/or Artistic License).
+
=head1 SEE ALSO
-L<Data::JavaScript::LiteObject>, L<Data::JavaScript::Anon>, L<CGI::AJAX>
+L<Data::JavaScript::LiteObject>, L<Data::JavaScript::Anon>, L<CGI::AJAX|CGI::Ajax>
=head1 AUTHOR
Modified: trunk/libdata-javascript-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-javascript-perl/MANIFEST?rev=24567&op=diff
==============================================================================
--- trunk/libdata-javascript-perl/MANIFEST (original)
+++ trunk/libdata-javascript-perl/MANIFEST Sun Aug 24 13:34:06 2008
@@ -4,9 +4,10 @@
TODO
JavaScript.pm
Makefile.PL
-t/1.t
-t/2.t
-t/3.t
-t/4.t
-t/5.t
+t/1-load.t
+t/2-import.t
+t/3-js12.t
+t/3-noArgs.t
+t/3-undef.t
+t/4-escape.t
example.pl
Modified: trunk/libdata-javascript-perl/TODO
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-javascript-perl/TODO?rev=24567&op=diff
==============================================================================
--- trunk/libdata-javascript-perl/TODO (original)
+++ trunk/libdata-javascript-perl/TODO Sun Aug 24 13:34:06 2008
@@ -1,16 +1,19 @@
ECMAScript and charset support for hjsdump
- Encoding, escape [^[:print:]]
+
+Encoding, escape [^[:print:]]
+ Doesn't seem to include Unicode in 5.8.4...
Numbers
- Infinity
+ Infinity
- NaN
+ NaN
- const
+ const (check attribute?)
Lightweight (object initializer) output for 1.2+
JavaScript 1.2 and later support a compact object notation known
- as object literals. Instead of the verbose...
+ as object literals. We probably want to walk depth first if using
+ this notation.
HASH = {key:val}
ARRAY= [0, 1, 2]
Modified: trunk/libdata-javascript-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-javascript-perl/debian/changelog?rev=24567&op=diff
==============================================================================
--- trunk/libdata-javascript-perl/debian/changelog (original)
+++ trunk/libdata-javascript-perl/debian/changelog Sun Aug 24 13:34:06 2008
@@ -1,3 +1,18 @@
+libdata-javascript-perl (1.13-1) unstable; urgency=low
+
+ * New upstream release.
+ * Add myself to Uploaders.
+ * Refresh debian/rules for debhelper 7
+ * Convert debian/copyright to proposed machine-readable format
+ * Remove COPYING (licensing information is now included in JavaScript.pm)
+ * debian/control: Remove trailing ", " from Depends, remove leading space
+ from Description, do not capitalize short description
+ * Install example.pl in /usr/share/doc/libdata-javascript-perl instead of
+ /usr/share/perl5/Data
+ * Do not install README (includes only a copy of example.pl and its output)
+
+ -- Ansgar Burchardt <ansgar at 43-1.org> Sun, 24 Aug 2008 13:32:37 +0000
+
libdata-javascript-perl (1.11-1) unstable; urgency=low
* Initial Release. (Closes: #468831)
Modified: trunk/libdata-javascript-perl/debian/compat
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-javascript-perl/debian/compat?rev=24567&op=diff
==============================================================================
--- trunk/libdata-javascript-perl/debian/compat (original)
+++ trunk/libdata-javascript-perl/debian/compat Sun Aug 24 13:34:06 2008
@@ -1,1 +1,1 @@
-5
+7
Modified: trunk/libdata-javascript-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-javascript-perl/debian/control?rev=24567&op=diff
==============================================================================
--- trunk/libdata-javascript-perl/debian/control (original)
+++ trunk/libdata-javascript-perl/debian/control Sun Aug 24 13:34:06 2008
@@ -1,10 +1,11 @@
Source: libdata-javascript-perl
Section: perl
Priority: optional
-Build-Depends: debhelper (>= 5.0.0)
+Build-Depends: debhelper (>= 7)
Build-Depends-Indep: perl (>= 5.8.0-7)
Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
-Uploaders: Jaldhar H. Vyas <jaldhar at debian.org>
+Uploaders: Jaldhar H. Vyas <jaldhar at debian.org>,
+ Ansgar Burchardt <ansgar at 43-1.org>
Standards-Version: 3.8.0
Homepage: http://search.cpan.org/dist/Data-JavaScript/
Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libdata-javascript-perl/
@@ -12,8 +13,8 @@
Package: libdata-javascript-perl
Architecture: all
-Depends: ${perl:Depends}, ${misc:Depends},
-Description: Dump perl data structures into JavaScript code
+Depends: ${perl:Depends}, ${misc:Depends}
+Description: dump perl data structures into JavaScript code
This module is mainly inteded for CGI programming, when a perl script
generates a page with client side JavaScript code that needs access to
structures created on the server.
Modified: trunk/libdata-javascript-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-javascript-perl/debian/copyright?rev=24567&op=diff
==============================================================================
--- trunk/libdata-javascript-perl/debian/copyright (original)
+++ trunk/libdata-javascript-perl/debian/copyright Sun Aug 24 13:34:06 2008
@@ -1,27 +1,26 @@
-This is the debian package for the Data::JavaScript module.
-It was created by Jaldhar H. Vyas <jaldhar at debian.org> using dh-make-perl.
+Format-Specification: http://wiki.debian.org/Proposals/CopyrightFormat?action=recall&rev=226
+Upstream-Name: Data-JavaScript
+Upstream-Maintainer: Jerrad Pierce <jpierce at cpan.org>
+Upstream-Source: http://search.cpan.org/dist/Data-JavaScript/
-It was downloaded from http://search.cpan.org/dist/Data-JavaScript/
+Files: *
+Copyright:
+License: GPL-1+ | Artistic | other
+ * Thou shalt not claim ownership of unmodified materials.
+ * Thou shalt not claim whole ownership of modified materials.
+ * Thou shalt grant the indemnity of the provider of materials.
+ * Thou shalt use and dispense freely without other restrictions.
+ .
+ Or if you truly insist, you may use and distribute this under the terms
+ of Perl itself (GPL and/or Artistic License).
+ .
+ On Debian systems, the complete text of the GNU General Public License can be
+ found in /usr/share/common-licenses/GPL and the Artistic license in
+ /usr/share/common-licenses/Artistic.
-The upstream author is: Jerrad Pierce <jpierce at cpan.org>
+Files: debian/*
+Copyright: © 2008, Jaldhar H. Vyas <jaldhar at debian.org>
+License: GPL-1+ | Artistic | other
+ The Debian packaging is licensed under the same terms as the software itself
+ (see above).
-Copyright (c) 2005 Jerrad Pierce.
-
-Created by Ariel Brosh <schop at cpan.org>.
-Inspired by WDDX.pm JavaScript support.
-
-The module as distributed on CPAN does not contain licensing information.
-However in a personal email to me dated July 24, 2008, the author wrote:
-
-> if you just need to know the licensing terms right
-> now, they are the same as perl itself (Artistic/GPL2)
-
-The Artistic and GPL licences under which Perl is distributed can be found
-in /usr/share/common-licenses/ . See /usr/share/doc/perl/copyright for
-the license of Perl itself.
-
-I have added a file called COPYING to the .orig.tar.gz including the text of
-the Artistic and GPL v2 licenses.
-
-The Debian packaging is (C) 2008, Jaldhar H. Vyas <jaldhar at debian.org> and
-is licensed under the same terms as the software itself (see above).
Added: trunk/libdata-javascript-perl/debian/libdata-javascript-perl.docs
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-javascript-perl/debian/libdata-javascript-perl.docs?rev=24567&op=file
==============================================================================
--- trunk/libdata-javascript-perl/debian/libdata-javascript-perl.docs (added)
+++ trunk/libdata-javascript-perl/debian/libdata-javascript-perl.docs Sun Aug 24 13:34:06 2008
@@ -1,0 +1,1 @@
+TODO
Added: trunk/libdata-javascript-perl/debian/libdata-javascript-perl.examples
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-javascript-perl/debian/libdata-javascript-perl.examples?rev=24567&op=file
==============================================================================
--- trunk/libdata-javascript-perl/debian/libdata-javascript-perl.examples (added)
+++ trunk/libdata-javascript-perl/debian/libdata-javascript-perl.examples Sun Aug 24 13:34:06 2008
@@ -1,0 +1,1 @@
+example.pl
Modified: trunk/libdata-javascript-perl/debian/rules
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libdata-javascript-perl/debian/rules?rev=24567&op=diff
==============================================================================
--- trunk/libdata-javascript-perl/debian/rules (original)
+++ trunk/libdata-javascript-perl/debian/rules Sun Aug 24 13:34:06 2008
@@ -1,76 +1,24 @@
#!/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
-
-PACKAGE=$(shell dh_listpackages)
-
-ifndef PERL
-PERL = /usr/bin/perl
-endif
-
-TMP =$(CURDIR)/debian/$(PACKAGE)
build: build-stamp
build-stamp:
- dh_testdir
-
- # Add commands to compile the package here
- $(PERL) Makefile.PL INSTALLDIRS=vendor
- $(MAKE)
- $(MAKE) test
-
+ dh build
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
+ dh $@
install: install-stamp
install-stamp: build-stamp
- dh_testdir
- dh_testroot
- dh_clean -k
-
- # Add commands to install the package into $(TMP) here
- $(MAKE) install DESTDIR=$(TMP) PREFIX=/usr
-
- [ ! -d $(TMP)/usr/lib/perl5 ] || rmdir --ignore-fail-on-non-empty --parents --verbose $(TMP)/usr/lib/perl5
-
+ dh install
+ rm $(CURDIR)/debian/libdata-javascript-perl/usr/share/perl5/Data/example.pl
touch $@
binary-arch:
-# We have nothing to do here for an architecture-independent package
-binary-indep: build install
- dh_testdir
- dh_testroot
- dh_installexamples
- dh_installdocs README TODO
- dh_installchangelogs CHANGES
- dh_perl
- dh_compress
- dh_fixperms
- dh_installdeb
- dh_gencontrol
- dh_md5sums
- dh_builddeb
+binary-indep: install
+ dh $@
-source diff:
- @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
+binary: binary-arch binary-indep
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary
+.PHONY: binary binary-arch binary-indep install clean build
More information about the Pkg-perl-cvs-commits
mailing list