r31986 - in /branches/upstream/libparse-cpan-meta-perl/current: Changes MANIFEST META.yml Makefile.PL lib/Parse/CPAN/Meta.pm t/11_meta_yml.t t/15_multibyte.t t/data/utf_16_le_bom.yml
gregoa at users.alioth.debian.org
gregoa at users.alioth.debian.org
Thu Mar 12 22:29:45 UTC 2009
Author: gregoa
Date: Thu Mar 12 22:29:42 2009
New Revision: 31986
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=31986
Log:
[svn-upgrade] Integrating new upstream version, libparse-cpan-meta-perl (0.05)
Added:
branches/upstream/libparse-cpan-meta-perl/current/t/data/utf_16_le_bom.yml (with props)
Modified:
branches/upstream/libparse-cpan-meta-perl/current/Changes
branches/upstream/libparse-cpan-meta-perl/current/MANIFEST
branches/upstream/libparse-cpan-meta-perl/current/META.yml
branches/upstream/libparse-cpan-meta-perl/current/Makefile.PL
branches/upstream/libparse-cpan-meta-perl/current/lib/Parse/CPAN/Meta.pm
branches/upstream/libparse-cpan-meta-perl/current/t/11_meta_yml.t
branches/upstream/libparse-cpan-meta-perl/current/t/15_multibyte.t
Modified: branches/upstream/libparse-cpan-meta-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libparse-cpan-meta-perl/current/Changes?rev=31986&op=diff
==============================================================================
--- branches/upstream/libparse-cpan-meta-perl/current/Changes (original)
+++ branches/upstream/libparse-cpan-meta-perl/current/Changes Thu Mar 12 22:29:42 2009
@@ -1,4 +1,10 @@
Revision history for Perl extension Parse-CPAN-Meta
+
+0.05 Wed 11 Mar 2009
+ - Upgrade previous release to a stable release.
+
+0.04_01 Tue 3 Mar 2009
+ - Merge Unicode / BOM fixes from YAML::Tiny
0.04 Wed 7 Jan 2009
- Matching changes in YAML::Tiny 1.36
Modified: branches/upstream/libparse-cpan-meta-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libparse-cpan-meta-perl/current/MANIFEST?rev=31986&op=diff
==============================================================================
--- branches/upstream/libparse-cpan-meta-perl/current/MANIFEST (original)
+++ branches/upstream/libparse-cpan-meta-perl/current/MANIFEST Thu Mar 12 22:29:42 2009
@@ -18,6 +18,7 @@
t/data/sample.yml
t/data/Template-Provider-Unicode-Japanese.yml
t/data/toolbar.yml
+t/data/utf_16_le_bom.yml
t/data/vanilla.yml
t/lib/Parse/CPAN/Meta/Test.pm
META.yml Module meta-data (added by MakeMaker)
Modified: branches/upstream/libparse-cpan-meta-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libparse-cpan-meta-perl/current/META.yml?rev=31986&op=diff
==============================================================================
--- branches/upstream/libparse-cpan-meta-perl/current/META.yml (original)
+++ branches/upstream/libparse-cpan-meta-perl/current/META.yml Thu Mar 12 22:29:42 2009
@@ -1,11 +1,11 @@
--- #YAML:1.0
name: Parse-CPAN-Meta
-version: 0.04
+version: 0.05
abstract: Parse META.yml and other similar CPAN metadata files
license: perl
author:
- Adam Kennedy <adamk at cpan.org>
-generated_by: ExtUtils::MakeMaker version 6.44
+generated_by: ExtUtils::MakeMaker version 6.42
distribution_type: module
requires:
File::Spec: 0.80
Modified: branches/upstream/libparse-cpan-meta-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libparse-cpan-meta-perl/current/Makefile.PL?rev=31986&op=diff
==============================================================================
--- branches/upstream/libparse-cpan-meta-perl/current/Makefile.PL (original)
+++ branches/upstream/libparse-cpan-meta-perl/current/Makefile.PL Thu Mar 12 22:29:42 2009
@@ -1,7 +1,7 @@
use strict;
BEGIN {
require 5.003_96;
- $main::VERSION = '0.04';
+ $main::VERSION = '0.05';
}
use ExtUtils::MakeMaker;
Modified: branches/upstream/libparse-cpan-meta-perl/current/lib/Parse/CPAN/Meta.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libparse-cpan-meta-perl/current/lib/Parse/CPAN/Meta.pm?rev=31986&op=diff
==============================================================================
--- branches/upstream/libparse-cpan-meta-perl/current/lib/Parse/CPAN/Meta.pm (original)
+++ branches/upstream/libparse-cpan-meta-perl/current/lib/Parse/CPAN/Meta.pm Thu Mar 12 22:29:42 2009
@@ -5,7 +5,7 @@
BEGIN {
require 5.004;
require Exporter;
- $Parse::CPAN::Meta::VERSION = '0.04';
+ $Parse::CPAN::Meta::VERSION = '0.05';
@Parse::CPAN::Meta::ISA = qw{ Exporter };
@Parse::CPAN::Meta::EXPORT_OK = qw{ Load LoadFile };
}
@@ -25,7 +25,19 @@
);
-
+my %BOM = (
+ "\357\273\277" => 'UTF-8',
+ "\376\377" => 'UTF-16BE',
+ "\377\376" => 'UTF-16LE',
+ "\0\0\376\377" => 'UTF-32BE',
+ "\377\376\0\0" => 'UTF-32LE'
+);
+
+sub BOM_MIN_LENGTH () { 2 }
+sub BOM_MAX_LENGTH () { 4 }
+sub HAVE_UTF8 () { $] >= 5.007003 }
+
+BEGIN { require utf8 if HAVE_UTF8 }
#####################################################################
@@ -53,17 +65,32 @@
# Parse a document from a string.
# Doing checks on $_[0] prevents us having to do a string copy.
sub Load ($) {
- unless ( defined $_[0] ) {
+
+ my $str = $_[0];
+
+ # Handle special cases
+ foreach my $length ( BOM_MIN_LENGTH .. BOM_MAX_LENGTH ) {
+ if ( my $enc = $BOM{substr($str, 0, $length)} ) {
+ croak("Stream has a non UTF-8 BOM") unless $enc eq 'UTF-8';
+ substr($str, 0, $length) = ''; # strip UTF-8 bom if found, we'll just ignore it
+ }
+ }
+
+ if ( HAVE_UTF8 ) {
+ utf8::decode($str); # try to decode as utf8
+ }
+
+ unless ( defined $str ) {
croak("Did not provide a string to Load");
}
- return () unless length $_[0];
- unless ( $_[0] =~ /[\012\015]+$/ ) {
+ return() unless length $str;
+ unless ( $str =~ /[\012\015]+$/ ) {
croak("Stream does not end with newline character");
}
# Split the file into lines
my @lines = grep { ! /^\s*(?:\#.*)?$/ }
- split /(?:\015{1,2}\012|\015|\012)/, shift;
+ split /(?:\015{1,2}\012|\015|\012)/, $str;
# A nibbling parser
my @documents = ();
Modified: branches/upstream/libparse-cpan-meta-perl/current/t/11_meta_yml.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libparse-cpan-meta-perl/current/t/11_meta_yml.t?rev=31986&op=diff
==============================================================================
--- branches/upstream/libparse-cpan-meta-perl/current/t/11_meta_yml.t (original)
+++ branches/upstream/libparse-cpan-meta-perl/current/t/11_meta_yml.t Thu Mar 12 22:29:42 2009
@@ -95,7 +95,7 @@
END_YAML
[ {
name => 'ITS-SIN-FIDS-Content-XML',
- version => 0.01,
+ version => "0.01",
version_from => 'lib/ITS/SIN/FIDS/Content/XML.pm',
installdirs => 'site',
requires => {
Modified: branches/upstream/libparse-cpan-meta-perl/current/t/15_multibyte.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libparse-cpan-meta-perl/current/t/15_multibyte.t?rev=31986&op=diff
==============================================================================
--- branches/upstream/libparse-cpan-meta-perl/current/t/15_multibyte.t (original)
+++ branches/upstream/libparse-cpan-meta-perl/current/t/15_multibyte.t Thu Mar 12 22:29:42 2009
@@ -20,7 +20,7 @@
use File::Spec::Functions ':ALL';
use Parse::CPAN::Meta::Test;
-use Test::More tests(0, 1, 3);
+use Test::More tests(0, 1, 4);
@@ -46,3 +46,11 @@
'XSLoader' => 0,
}, 'build_requires ok' );
}
+
+SKIP: {
+ skip "no utf8 support", 1 unless Parse::CPAN::Meta::HAVE_UTF8();
+ ok( utf8::is_utf8($yaml[0]->{author}), "utf8 decoded" );
+}
+
+exit(0);
+
Added: branches/upstream/libparse-cpan-meta-perl/current/t/data/utf_16_le_bom.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libparse-cpan-meta-perl/current/t/data/utf_16_le_bom.yml?rev=31986&op=file
==============================================================================
Binary file - no diff available.
Propchange: branches/upstream/libparse-cpan-meta-perl/current/t/data/utf_16_le_bom.yml
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
More information about the Pkg-perl-cvs-commits
mailing list