Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Dist-Zilla CPAN distribution.

Report information
The Basics
Id: 76648
Status: rejected
Priority: 0/
Queue: Dist-Zilla

People
Owner: Nobody in particular
Requestors: dolmen [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 4.300014
Fixed in: (no value)



Subject: AutoPrereqs fails to load utf8 source
The attached file is a valid Perl source encoded in UTF-8. AutoPrereqs crashes Dist::Zilla when analyzing this file. -- Olivier Mengué - http://perlresume.org/DOLMEN
Subject: reader-encoding.t
#!perl use utf8; use strict; use warnings 'FATAL'; use IO::File; use IO::String; use Test::More tests => 8; use Config::INI::Reader; # Check the structure of the config my $expected = { '_' => { écrivain => 'Olivier Mengué', }, 'Section n°1' => { 1 => 'déchaînées', 2 => 'déchaînèrent', 3 => 'à-côté', 4 => 'cœur', }, }; { # Try to read in a config my $hashref = Config::INI::Reader->read_file( 'corpus/utf8.ini', 'utf-8' ); isa_ok($hashref, 'HASH', "return of Config::INI::Reader->read_file"); is_deeply($hashref, $expected, 'utf8'); } { my $hashref = Config::INI::Reader->read_file( 'corpus/utf16-bom.ini', 'utf-16' ); isa_ok($hashref, 'HASH', "return of Config::INI::Reader->read_file"); is_deeply($hashref, $expected, 'utf16 with bom'); } # Add some stuff to the trivial config and check write_string() for it my $expected2 = { _ => { écrivain => 'Olivier Mengué', }, Cœur => { Clé => 'κλειδί', }, }; my $string = <<END; écrivain=Olivier Mengué [ Cœur ] Clé = κλειδί END { # Test read_string my $hashref = Config::INI::Reader->read_string( $string ); isa_ok($hashref, 'HASH', "return of Config::INI::Reader->read_string"); is_deeply( $hashref, $expected2, '->read_string returns expected value' ); } { # Test read_handle my $fh = IO::File->new('corpus/utf8.ini', 'r'); $fh->binmode(':utf8'); my $data = do { local $/ = undef; <$fh> }; is_deeply( Config::INI::Reader->new->read_handle( IO::String->new($data) ), $expected, '->read_handle returns expected value' ); } { # Test read_handle my $fh = IO::File->new('corpus/utf16-bom.ini', 'r'); $fh->binmode(':encoding(utf-16)'); my $data = do { local $/ = undef; <$fh> }; is_deeply( Config::INI::Reader->new->read_handle( IO::String->new($data) ), $expected, '->read_handle returns expected value' ); }
Le 2012-04-18 08:56:55, DOLMEN a écrit : Show quoted text
> The attached file is a valid Perl source encoded in UTF-8. > AutoPrereqs crashes Dist::Zilla when analyzing this file.
Test case: Repository: https://github.com/dolmen/p5-Config-INI.git Tag: RT76648-AutoPrereqs-failure-test-case -- Olivier Mengué - http://perlresume.org/DOLMEN
The issue is not with AutoPrereqs, but with PPI, as demonstrated by this command: perl -MPPI -e 'PPI::Document->new(shift) or die PPI::Document->errstr' reader-encoding.t A quick test shows that PPI doesn't like you using "=>" to quote non-ASCII identifiers. To work around it, use "'key' => 'value'" instead of "key => 'value'". You can report this bug in PPI if you like.
I'm relieved that for once *I* didn't hose the encoding issue. -- rjbs