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: 47417
Status: resolved
Priority: 0/
Queue: PPI

People
Owner: Nobody in particular
Requestors: PackyAnderson [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.203
Fixed in: (no value)



Subject: PPI::Statement::Package->namespace doesn't allow all-numeric portions
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Charset: utf8
X-RT-Original-Encoding: utf-8
Content-Type: multipart/mixed; boundary="----------=_1246213507-25318-81"
Content-Length: 0
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
Content-Length: 583
Download (untitled) / with headers
text/plain 583b
If a package name includes an all-numeric portion, say "package Foo::Bar::1_0;", PPI only recognizes up to the numeric portion as being part of the namespace, namely "Foo::Bar::". The attached test fails like this: 1..1 not ok 1 - namespace matches package declaration # Failed test 'namespace matches package declaration' # in PPI_bug.t at line 10. # got: 'Foo::Bar::' # expected: 'Foo::Bar::1_0' # Looks like you failed 1 test of 1. The attached patch fixes this. I'd write the patch to the repository myself if I was given write access (I promise to be good).
Subject: 0001-Fix-namespace-so-it-allows-inclusion-of-number-tok.patch
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----------=_1246213507-25318-80"
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Charset: utf8
Content-Length: 0
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: iso-8859-1
Content-Length: 0
Content-Type: application/octet-stream; name="0001-Fix-namespace-so-it-allows-inclusion-of-number-tok.patch"
Content-Disposition: inline; filename="0001-Fix-namespace-so-it-allows-inclusion-of-number-tok.patch"
Content-Transfer-Encoding: base64
Content-Length: 2729
From 9456ebcea54c95af51739b141c4de3f8235dc464 Mon Sep 17 00:00:00 2001 From: panderson <panderson@gridapp.com> Date: Sun, 28 Jun 2009 13:54:34 -0400 Subject: [PATCH] Fix namespace() so it allows inclusion of number tokens as well as word tokens. --- blib/lib/PPI/Statement/Package.pm | 13 +++++++++---- blib/man3/PPI::Statement::Package.3pm | 2 +- lib/PPI/Statement/Package.pm | 13 +++++++++---- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/blib/lib/PPI/Statement/Package.pm b/blib/lib/PPI/Statement/Package.pm index 329c4e6..791e165 100644 --- a/blib/lib/PPI/Statement/Package.pm +++ b/blib/lib/PPI/Statement/Package.pm @@ -64,10 +64,15 @@ If the package statement is done any different way, it returns false. sub namespace { my $self = shift; - my $namespace = $self->schild(1) or return ''; - $namespace->isa('PPI::Token::Word') - ? $namespace->content - : ''; + my @children = $self->schildren or return ''; + shift @children; # discard 'package' + my $namespace = q{}; + foreach my $child ( @children ) { + $namespace .= $child->isa('PPI::Token::Word') ? $child->content + : $child->isa('PPI::Token::Number') ? $child->content + : q{}; + } + return $namespace; } =pod diff --git a/blib/man3/PPI::Statement::Package.3pm b/blib/man3/PPI::Statement::Package.3pm index fabcd99..d523b08 100644 --- a/blib/man3/PPI::Statement::Package.3pm +++ b/blib/man3/PPI::Statement::Package.3pm @@ -129,7 +129,7 @@ .\" ======================================================================== .\" .IX Title "PPI::Statement::Package 3" -.TH PPI::Statement::Package 3 "2008-05-14" "perl v5.8.6" "User Contributed Perl Documentation" +.TH PPI::Statement::Package 3 "2009-06-28" "perl v5.8.6" "User Contributed Perl Documentation" .SH "NAME" PPI::Statement::Package \- A package statement .SH "INHERITANCE" diff --git a/lib/PPI/Statement/Package.pm b/lib/PPI/Statement/Package.pm index 329c4e6..791e165 100644 --- a/lib/PPI/Statement/Package.pm +++ b/lib/PPI/Statement/Package.pm @@ -64,10 +64,15 @@ If the package statement is done any different way, it returns false. sub namespace { my $self = shift; - my $namespace = $self->schild(1) or return ''; - $namespace->isa('PPI::Token::Word') - ? $namespace->content - : ''; + my @children = $self->schildren or return ''; + shift @children; # discard 'package' + my $namespace = q{}; + foreach my $child ( @children ) { + $namespace .= $child->isa('PPI::Token::Word') ? $child->content + : $child->isa('PPI::Token::Number') ? $child->content + : q{}; + } + return $namespace; } =pod -- 1.6.2.1
Subject: PPI_bug.t
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----------=_1246213307-25318-79"
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Charset: utf8
Content-Length: 0
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: iso-8859-1
Content-Length: 0
Content-Type: application/octet-stream; name="PPI_bug.t"
Content-Disposition: inline; filename="PPI_bug.t"
Content-Transfer-Encoding: base64
Content-Length: 290
Download PPI_bug.t
text/x-perl 290b
use strict; use PPI; use Test::More tests => 1; my $package_name = "Foo::Bar::1_0"; my $doc = PPI::Document->new(\"package $package_name;"); my $pkg = $doc->find_first('PPI::Statement::Package'); my $ns = $pkg->namespace; is( $ns, $package_name, 'namespace matches package declaration');
MIME-Version: 1.0
X-Spam-Status: No, hits=0.0 required=8.0 tests=DK_SIGNED,SPF_PASS
In-Reply-To: <rt-3.6.HEAD-25318-1246213511-945.47417-4-0 [...] rt.cpan.org>
References: <RT-Ticket-47417 [...] rt.cpan.org> <rt-3.6.HEAD-25318-1246213511-945.47417-4-0 [...] rt.cpan.org>
Reply-To: adam [...] ali.as
Message-ID: <b8cb49a40906282044p39a109c5kc019bc80d1b8a72 [...] mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
X-RT-Original-Encoding: utf-8
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by diesel.bestpractical.com (Postfix) with SMTP id 0BB894D80BF for <bug-PPI [...] rt.cpan.org>; Sun, 28 Jun 2009 23:44:34 -0400 (EDT)
Received: (qmail 24223 invoked by uid 103); 29 Jun 2009 03:44:34 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 29 Jun 2009 03:44:34 -0000
Received: from qw-out-2122.google.com (HELO qw-out-2122.google.com) (74.125.92.26) by 16.mx.develooper.com (qpsmtpd/0.80) with ESMTP; Sun, 28 Jun 2009 20:44:28 -0700
Received: by qw-out-2122.google.com with SMTP id 5so556835qwi.27 for <bug-PPI [...] rt.cpan.org>; Sun, 28 Jun 2009 20:44:24 -0700 (PDT)
Received: by 10.220.99.149 with SMTP id u21mr1554754vcn.9.1246247064734; Sun, 28 Jun 2009 20:44:24 -0700 (PDT)
Delivered-To: cpan-bug+PPI [...] diesel.bestpractical.com
Subject: Re: [rt.cpan.org #47417] PPI::Statement::Package->namespace doesn't allow all-numeric portions
Domainkey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:content-type:content-transfer-encoding; b=Zcdx6Tl6RMZ3Juyg0CgiCkHeGPxpHqvLtJYbcMbM474FdUkIb5NxVky8qAWGEUZrzQ J/E9O3dV1sTc2sRTSgvLaUwUB5bGw24TG9vLlsb5CDcZxChyngrXM3sRhStpObTyTbE5 VieXKsnsTLp1W3y3JfviamJLSAjBguTixnWP4=
Return-Path: <adamkennedybackup [...] gmail.com>
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:reply-to:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=GnT/ssoL/cLqyfBko3WYSmD3nrRdaNZ1QsiR+ZjVuHw=; b=bgUA1M50VkyHZj7BtUENvCfJSNkyCs+zOAZaUK9r4SzeZwg/noh90B/u2MpcZt83Az uZ3ntoplNirc1AVqdkJaVlp+DUVcTNTr2ls7wX3D5pSs8cxpAjoeNBDLDrgiU5vcaCCY wIkMUCGBgS6pxQ33HyuWR7mOLdSABu89ir20s=
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: bug-PPI [...] rt.cpan.org
Date: Mon, 29 Jun 2009 13:44:24 +1000
X-Spam-Level: *
To: bug-PPI [...] rt.cpan.org
Content-Transfer-Encoding: quoted-printable
From: Adam Kennedy <adamkennedybackup [...] gmail.com>
RT-Message-ID: <rt-3.6.HEAD-25318-1246247084-1347.47417-0-0 [...] rt.cpan.org>
Content-Length: 1168
Download (untitled) / with headers
text/plain 1.1k
Do you have CPAN login/email? I'll add you to the commit list. Adam K 2009/6/29 Packy Anderson via RT <bug-PPI@rt.cpan.org>: Show quoted text
> Sun Jun 28 14:25:11 2009: Request 47417 was acted upon. > Transaction: Ticket created by packy >       Queue: PPI >     Subject: PPI::Statement::Package->namespace doesn't allow all-numeric portions >   Broken in: 1.203 >    Severity: (no value) >       Owner: Nobody >  Requestors: PackyAnderson@gmail.com >      Status: new >  Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=47417 > > > > If a package name includes an all-numeric portion, say "package > Foo::Bar::1_0;", PPI only recognizes up to the numeric portion as being > part of the namespace, namely "Foo::Bar::". > > The attached test fails like this: > > 1..1 > not ok 1 - namespace matches package declaration > #   Failed test 'namespace matches package declaration' > #   in PPI_bug.t at line 10. > #          got: 'Foo::Bar::' > #     expected: 'Foo::Bar::1_0' > # Looks like you failed 1 test of 1. > > The attached patch fixes this.  I'd write the patch to the repository > myself if I was given write access (I promise to be good). >
MIME-Version: 1.0
X-Spam-Status: No, hits=0.0 required=8.0 tests=DK_SIGNED,SPF_PASS
In-Reply-To: <rt-3.6.HEAD-25318-1246247084-1347.47417-6-0 [...] rt.cpan.org>
References: <RT-Ticket-47417 [...] rt.cpan.org> <rt-3.6.HEAD-25318-1246213511-945.47417-4-0 [...] rt.cpan.org> <b8cb49a40906282044p39a109c5kc019bc80d1b8a72 [...] mail.gmail.com> <rt-3.6.HEAD-25318-1246247084-1347.47417-6-0 [...] rt.cpan.org>
Message-ID: <cba4103f0906290356i36a5873fobdf816221c91a9c [...] mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
X-RT-Original-Encoding: utf-8
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by diesel.bestpractical.com (Postfix) with SMTP id 026ED19B81DA for <bug-PPI [...] rt.cpan.org>; Mon, 29 Jun 2009 06:57:16 -0400 (EDT)
Received: (qmail 22630 invoked by uid 103); 29 Jun 2009 10:57:16 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 29 Jun 2009 10:57:16 -0000
Received: from mail-bw0-f209.google.com (HELO mail-bw0-f209.google.com) (209.85.218.209) by 16.mx.develooper.com (qpsmtpd/0.80) with ESMTP; Mon, 29 Jun 2009 03:57:10 -0700
Received: by bwz5 with SMTP id 5so684316bwz.45 for <bug-PPI [...] rt.cpan.org>; Mon, 29 Jun 2009 03:57:07 -0700 (PDT)
Received: by 10.204.117.84 with SMTP id p20mr6924441bkq.192.1246273027101; Mon, 29 Jun 2009 03:57:07 -0700 (PDT)
Delivered-To: cpan-bug+PPI [...] diesel.bestpractical.com
Subject: Re: [rt.cpan.org #47417] PPI::Statement::Package->namespace doesn't allow all-numeric portions
Domainkey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=V6MV/61uLWji/VG8lihqNgU1BGJ0vElmJPQ3qfksJJ5P4LA3dSkocOuVn8E7ECDZf0 N+NmJyomnTxv8TV/wqKgykcwdrtkHEIyWX/jxLphWWvabsDTlUkdel1WcNB0/i5qbZXz +j9tcFoTmv8Tl3G4JJFKdGqGRMuzvNZbMrknU=
Return-Path: <packyanderson [...] gmail.com>
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:content-type :content-transfer-encoding; bh=LSp+SEt+8ytlmBJeeM762ea4eijVBp9RWiRXfIPxJVo=; b=XkZHVdR5Ral06w7VxFX0i1myZeqSAXPTJDlzShcv5AXwSVGC5QkQWlconbhFHG59ZL iSxjZ5Ia2tv2M4wx4O+7gZGiDCfZZZXAM8of5xTQQzbToZahvSuBD16QhtdER2rRGjrb h+b7XN1lFtpko5yFDF1YFfEdBLMrU/vjwncuw=
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: bug-PPI [...] rt.cpan.org
Date: Mon, 29 Jun 2009 06:56:47 -0400
X-Spam-Level: *
To: bug-PPI [...] rt.cpan.org
Content-Transfer-Encoding: 7bit
From: Packy Anderson <packyanderson [...] gmail.com>
RT-Message-ID: <rt-3.6.HEAD-25318-1246273087-1860.47417-0-0 [...] rt.cpan.org>
Content-Length: 418
Download (untitled) / with headers
text/plain 418b
On Sun, Jun 28, 2009 at 11:44 PM, Reserved Local Account via RT<bug-PPI@rt.cpan.org> wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=47417 > > > Do you have CPAN login/email? > > I'll add you to the commit list.
Not yet. I've just submitted a request, because I also want to contribute some Perl::Critic rules. I'll reply again when it's been created. -packy -- Packy Anderson PackyAnderson@gmail.com
MIME-Version: 1.0
X-Spam-Status: No, hits=0.0 required=8.0 tests=DK_SIGNED,SPF_PASS
In-Reply-To: <cba4103f0906290356i36a5873fobdf816221c91a9c [...] mail.gmail.com>
References: <RT-Ticket-47417 [...] rt.cpan.org> <rt-3.6.HEAD-25318-1246213511-945.47417-4-0 [...] rt.cpan.org> <b8cb49a40906282044p39a109c5kc019bc80d1b8a72 [...] mail.gmail.com> <rt-3.6.HEAD-25318-1246247084-1347.47417-6-0 [...] rt.cpan.org> <cba4103f0906290356i36a5873fobdf816221c91a9c [...] mail.gmail.com>
Message-ID: <cba4103f0907210458s49802f42q58b835b4faf913ec [...] mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
X-RT-Original-Encoding: utf-8
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by diesel.bestpractical.com (Postfix) with SMTP id C8DD019B8240 for <bug-PPI [...] rt.cpan.org>; Tue, 21 Jul 2009 07:59:40 -0400 (EDT)
Received: (qmail 6648 invoked by uid 103); 21 Jul 2009 11:59:40 -0000
Received: from x16.dev (10.0.100.26) by x1.dev with QMQP; 21 Jul 2009 11:59:40 -0000
Received: from mail-fx0-f206.google.com (HELO mail-fx0-f206.google.com) (209.85.220.206) by 16.mx.develooper.com (qpsmtpd/0.80) with ESMTP; Tue, 21 Jul 2009 04:59:34 -0700
Received: by fxm2 with SMTP id 2so2798031fxm.13 for <bug-PPI [...] rt.cpan.org>; Tue, 21 Jul 2009 04:59:01 -0700 (PDT)
Received: by 10.239.155.5 with SMTP id g5mr522877hbc.107.1248177541151; Tue, 21 Jul 2009 04:59:01 -0700 (PDT)
Delivered-To: cpan-bug+PPI [...] diesel.bestpractical.com
Subject: Re: [rt.cpan.org #47417] PPI::Statement::Package->namespace doesn't allow all-numeric portions
Domainkey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=eaxKmGZwOlnmfSzlkFr7BKnRupZlXD+JynRwZhDEHjPO+2xDnYUTy6t+2X7WhrFRjj Cb8iKttX1XAo7n9JXAc/R43XaEKj2J2KfH6YEvj5iubGL2VMuQgsEB3n5o7vWT9EVn1F vVREd8aEDyqyYxgRAssTHXaw1g4iT3wGHna7s=
Return-Path: <packyanderson [...] gmail.com>
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:content-type :content-transfer-encoding; bh=HFCnjctIrdldryZqbCQS+0dy6khBbEqtWJTeogeGRP8=; b=M30+jOLYo1ErE0HWjqa5BpGZ9m7s8f+oZjOVkyXr8nZkJqlBfcmuTMZrQ6XlC+elXe I4+5vvjMKTFY3+jnL0Qshq62EzuGd2xCQlQmLOvBfZ0CzO1F1Z68+CzWe+skZMSrIvZM 4qZ++Ekre7qbL1+DrjPDzTjTHmFmIP9y0SclU=
X-Spam-Check-BY: 16.mx.develooper.com
X-Original-To: bug-PPI [...] rt.cpan.org
Date: Tue, 21 Jul 2009 07:58:41 -0400
X-Spam-Level: *
To: bug-PPI [...] rt.cpan.org
Content-Transfer-Encoding: quoted-printable
From: Packy Anderson <packyanderson [...] gmail.com>
RT-Message-ID: <rt-3.6.HEAD-6413-1248177590-1560.47417-0-0 [...] rt.cpan.org>
Content-Length: 488
Download (untitled) / with headers
text/plain 488b
On Mon, Jun 29, 2009 at 6:56 AM, Packy Anderson<packyanderson@gmail.com> wrote: Show quoted text
> On Sun, Jun 28, 2009 at 11:44 PM, Reserved Local Account via > RT<bug-PPI@rt.cpan.org> wrote:
>> <URL: https://rt.cpan.org/Ticket/Display.html?id=47417 > >> >> Do you have CPAN login/email? >> >> I'll add you to the commit list.
> > Not yet.  I've just submitted a request, because I also want to > contribute some Perl::Critic rules.  I'll reply again when it's been > created.
My CPAN login is PACKY.
MIME-Version: 1.0
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Content-Type: text/plain; charset="UTF-8"
Message-ID: <rt-3.8.HEAD-14826-1266737975-528.47417-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 20
Resolved in 1.211_01


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.