develooper Front page | perl.perl5.porters | Postings from February 2019

Re: [perl #131683] Encode::ONLY_PRAGMA_WARNINGS in$PerlIO::encoding::fallback

Thread Previous | Thread Next
From:
pali
Date:
February 14, 2019 09:08
Subject:
Re: [perl #131683] Encode::ONLY_PRAGMA_WARNINGS in$PerlIO::encoding::fallback
Message ID:
20190214090814.xvyavibv24wn535i@pali
On Wednesday 13 February 2019 09:36:31 pali@cpan.org wrote:
> On Tuesday 12 February 2019 20:54:11 Tony Cook via RT wrote:
> > On Tue, 12 Feb 2019 07:46:22 -0800, pali@cpan.org wrote:
> > > On Thursday 07 February 2019 16:05:40 pali@cpan.org wrote:
> > > > On Tuesday 22 January 2019 09:38:38 pali@cpan.org wrote:
> > > > > On Monday 21 January 2019 15:03:02 Leon Timmermans via RT wrote:
> > > > > > On Mon, Jan 21, 2019 at 6:51 PM <pali@cpan.org> wrote:
> > > > > > > > > ...and apply remaining
> > > > > > > > > PerlIO::encoding patch?
> > > > > > > >
> > > > > > > > Can you specify which of the patches attached to this RT is
> > > > > > > > the one still under consideration?
> > > > > > >
> > > > > > > 0002-PerlIO-encoding-Use-Encode-ONLY_PRAGMA_WARNINGS-in-f.patch
> > > > > > >
> > > > > > > All other patches are part of Encode, and therefore applied.
> > > > > >
> > > > > > Can you add a perldelta entry?
> > > > >
> > > > > I do not know where is correct place to put entries, nor what is
> > > > > correct
> > > > > formatting... But entry could contain something like this:
> > > > >
> > > > > ===
> > > > > Modules PerlIO::encoding and Encode were fixed to respect state of
> > > > > utf8
> > > > > pragma warnings when processing filehandle with :encoding layer.
> > > > > ===
> > > >
> > > > Leon, it is enough?
> > > 
> > > PING
> > 
> > Do you mean the patch:
> > 
> > -    Encode::PERLQQ()|Encode::WARN_ON_ERR()|Encode::STOP_AT_PARTIAL();
> > +    Encode::PERLQQ()|Encode::WARN_ON_ERR()|Encode::ONLY_PRAGMA_WARNINGS()|Encode::STOP_AT_PARTIAL();
> > 
> 
> Yes.
> 
> > which fails a test:
> > 
> > ../ext/PerlIO-encoding/t/fallback.t                              (Wstat: 256 Tests: 10 Failed: 1)
> >   Failed test:  2
> >   Non-zero exit status: 1
> 
> It started failing? Ah :-( IIRC it worked when I created it year ago.
> 
> I will look at it...

Hi! Following patch should fix this problem. There is missing
"use warnings" and also "my $line" is declared more times.

diff --git a/ext/PerlIO-encoding/t/fallback.t b/ext/PerlIO-encoding/t/fallback.t
index 3abdfd3f37..84ba097e71 100644
--- a/ext/PerlIO-encoding/t/fallback.t
+++ b/ext/PerlIO-encoding/t/fallback.t
@@ -16,11 +16,13 @@ BEGIN {
     import Encode qw(:fallback_all);
 }
 
+use warnings;
 use Test::More tests => 10;
 
 # $PerlIO::encoding = 0; # WARN_ON_ERR|PERLQQ;
 
 my $file = "fallback$$.txt";
+my $line;
 
 {
     my $message = '';
@@ -34,7 +36,7 @@ my $file = "fallback$$.txt";
 }
 
 open($fh,'<',$file) || die "File cannot be re-opened";
-my $line = <$fh>;
+$line = <$fh>;
 is($line,"\\x{20ac}0.02\n","perlqq escapes");
 close($fh);
 
@@ -46,7 +48,7 @@ print $fh $str,"0.02\n";
 close($fh);
 
 open($fh,'<',$file) || die "File cannot be re-opened";
-my $line = <$fh>;
+$line = <$fh>;
 is($line,"&#8364;0.02\n","HTML escapes");
 close($fh);
 
@@ -59,7 +61,7 @@ close($fh);
 }
 
 ok(open($fh,"<encoding(US-ASCII)",$file),"Opened as ASCII");
-my $line = <$fh>;
+$line = <$fh>;
 printf "# %x\n",ord($line);
 is($line,"\\xA30.02\n","Escaped non-mapped char");
 close($fh);

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About