Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the PPI CPAN distribution.

Report information
The Basics
Id: 20647
Status: resolved
Priority: 0/
Queue: PPI

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

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



Download (untitled) / with headers
text/plain 376b
PPI can't handle <<HERE_DOCs. #!/usr/bin/perl use Test::More tests => 1; use PPI; my $src = <<'TEXT'; print <<'BAR'; Here is some text BAR TEXT is( PPI::Document->new( \$src ), $src ) 1..1 not ok 1 # Failed test in tmp/ppi at line 10. # got: 'print <<'BAR'; # ' # expected: 'print <<'BAR'; # Here is some text # BAR # ' # Looks like you failed 1 test of 1.
Subject: Re: [rt.cpan.org #20647]
Date: Tue, 25 Jul 2006 00:13:50 +0800
To: bug-PPI [...] rt.cpan.org
From: Adam Kennedy <adam [...] phase-n.com>
Download (untitled) / with headers
text/plain 929b
The test code is invalid, documents stringify naively. The correct test code is is( PPI::Document->new( \$src )->serialize, $src ); Adam K via RT wrote: Show quoted text
> Mon Jul 24 12:07:35 2006: Request 20647 was acted upon. > Transaction: Ticket created by JJORE > Queue: PPI > Subject: (No subject given) > Broken in: 1.115 > Severity: Important > Owner: Nobody > Requestors: JJORE@cpan.org > Status: new > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=20647 > > > > PPI can't handle <<HERE_DOCs. > > #!/usr/bin/perl > use Test::More tests => 1; > use PPI; > my $src = <<'TEXT'; > print <<'BAR'; > Here is some text > BAR > TEXT > > is( PPI::Document->new( \$src ), $src ) > > > 1..1 > not ok 1 > # Failed test in tmp/ppi at line 10. > # got: 'print <<'BAR'; > # ' > # expected: 'print <<'BAR'; > # Here is some text > # BAR > # ' > # Looks like you failed 1 test of 1.
CC: JJORE [...] cpan.org
Subject: Re: [rt.cpan.org #20647]
Date: Mon, 24 Jul 2006 12:19:36 -0500
To: bug-PPI [...] rt.cpan.org
From: "Joshua ben Jore" <twists [...] gmail.com>
Download (untitled) / with headers
text/plain 644b
On 7/24/06, adam@phase-n.com via RT <bug-PPI@rt.cpan.org> wrote: Show quoted text
> > <URL: http://rt.cpan.org/Ticket/Display.html?id=20647 > > > The test code is invalid, documents stringify naively. > > The correct test code is > > is( PPI::Document->new( \$src )->serialize, $src );
Ah. Perl::Critic was using the overloaded "" stringification which triggered this. I saw the same behavior in PPI and figured it was PPI's problem. I didn't realize the overloaded "" was producing wrong output just because it wasn't named ->serialize. Is there a good reason to overload "" to ->content()? I'd think it'd be more correct to overload to ->serialize(). Josh
On Mon Jul 24 13:20:24 2006, twists@gmail.com wrote: Show quoted text
> On 7/24/06, adam@phase-n.com via RT <bug-PPI@rt.cpan.org> wrote:
> > > > <URL: http://rt.cpan.org/Ticket/Display.html?id=20647 > > > > > The test code is invalid, documents stringify naively. > > > > The correct test code is > > > > is( PPI::Document->new( \$src )->serialize, $src );
> > Ah. Perl::Critic was using the overloaded "" stringification which > triggered this. I saw the same behavior in PPI and figured it was > PPI's problem. I didn't realize the overloaded "" was producing wrong > output just because it wasn't named ->serialize. > > Is there a good reason to overload "" to ->content()? I'd think it'd > be more correct to overload to ->serialize(). > > Josh
When treated as a simple string, you can't fully serialize validly. You can ONLY do it when you fully output to a file (due to the nature of the way here-doc content works). So for the moment, no I'm keeping it as content, mostly because if I change it to serialize, it means that a document stringifies differently to an element. And I'm dubious about that.
WONTFIX


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.