Skip Menu |
 

This queue is for tickets about the Devel-Graph CPAN distribution.

Report information
The Basics
Id: 29346
Status: open
Worked: 15 min
Priority: 0/
Queue: Devel-Graph

People
Owner: TELS [...] cpan.org
Requestors: moghroth [...] gmail.com
Cc:
AdminCc:

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



Subject: decompose fails on a closure, for loop and until loop
MIME-Version: 1.0
X-Mailer: MIME-tools 5.418 (Entity 5.418)
X-RT-Original-Encoding: utf-8
Content-Type: multipart/mixed; boundary="----------=_1189705327-1089-1"
Content-Length: 0
Content-Type: text/plain; charset="utf8"
Content-Disposition: inline
Content-Transfer-Encoding: binary
Content-Length: 723
Download (untitled) / with headers
text/plain 723b
Devel::Graph version 0.10 The attached file is a test for failure on parsing a closure. Subsequent investigations have also shown that for and unless loops fail similarly. The error seems to be in the private method _parse_compound, and is thrown by the test for 'PPI::Structure::Condition'. Neither a closure nor a loop will satisfy this test. **** # work around closure bug return $self->_parse($element->children) if $type eq 'continue'; return $self->_parse_loop($element) if $type eq 'for' || $type eq 'foreach'; $self->error("Cannot find condition: possible syntax error in $element") unless defined $self->_find_first( $element, 'PPI::Structure::Condition' ); ****
Subject: closure.t
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----------=_1189705326-1089-0"
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Length: 0
Content-Type: text/plain; charset="utf8"
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 0
Content-Type: application/x-troff; name="closure.t"
Content-Disposition: inline; filename="closure.t"
Content-Transfer-Encoding: base64
Content-Length: 805
Download closure.t
text/x-perl 805b
#!/usr/bin/perl -w use Test::More; use strict; BEGIN { plan tests => 4; chdir 't' if -d 't'; use lib '../lib'; use_ok ("Devel::Graph") or die($@); }; ############################################################################# # croak on errors my $grapher = Devel::Graph->new(); is (ref($grapher), 'Devel::Graph'); my $if_code = <<'IF_CODE'; my $a = 1; if($a){ my $var = 1; my $other_var = 2; my $var_now = $var + $other_var; print "$var_now\n"; } IF_CODE eval "\$grapher->decompose( \\\$if_code )"; is ($@, '', 'if error'); my $closure_code = <<'CLOSURE_CODE'; { my $var = 1; my $other_var = 2; my $var_now = $var + $other_var; print "$var_now\n"; } CLOSURE_CODE eval "\$grapher->decompose( \\\$closure_code )"; is ($@, '', 'closure error');
MIME-Version: 1.0
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Disposition: inline
Message-Id: <rt-3.6.HEAD-9906-1189889635-1962.29346-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf8"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Original-Encoding: utf-8
Content-Length: 721
Download (untitled) / with headers
text/plain 721b
On Thu Sep 13 13:42:10 2007, moghroth@gmail.com wrote: Show quoted text
> Devel::Graph version 0.10
Thanx for your report! I have just pushed v0.11 to CPAN that contains this fix and two testfiles for closures and for/until loops. If you find anything else, please report it in a separate bugreport. Please note that Graph::Devel uses PPI to parse the Perl code, but PPI only parses the syntax and doesn't do any semantic analysis. This means that even invalid Perl code will be parsed by PPI just fine, and the caller needs to figure out what the generated tree actually means. And this is quite hard, especially solving it in a general and recursive manner. So please go find bugs in my code and report them :) all the best, tels
MIME-Version: 1.0 (Apple Message framework v606)
X-Spam-Status: No, hits=-2.6 required=8.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VERIFIED,DK_SIGNED,SPF_PASS
In-Reply-To: <rt-3.6.HEAD-9906-1189889635-1962.29346-6-0 [...] rt.cpan.org>
X-Mailer: Apple Mail (2.606)
X-PGP-Agent: GPGMail 1.1.2 (Panther)
References: <RT-Ticket-29346 [...] rt.cpan.org> <rt-3.6.HEAD-9906-1189889635-1962.29346-6-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"; format="flowed"
X-RT-Original-Encoding: ISO-8859-1
Received: from la.mx.develooper.com (x1.develooper.com [63.251.223.170]) by diesel.bestpractical.com (Postfix) with SMTP id 0C3BD4D806E for <bug-Devel-Graph [...] rt.cpan.org>; Tue, 18 Sep 2007 21:22:01 -0400 (EDT)
Received: (qmail 31849 invoked by alias); 19 Sep 2007 01:22:01 -0000
Received: from nf-out-0910.google.com (HELO nf-out-0910.google.com) (64.233.182.184) by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Tue, 18 Sep 2007 18:21:50 -0700
Received: by nf-out-0910.google.com with SMTP id b2so35871nfb for <bug-Devel-Graph [...] rt.cpan.org>; Tue, 18 Sep 2007 18:21:42 -0700 (PDT)
Received: by 10.86.58.3 with SMTP id g3mr109190fga.1190164902123; Tue, 18 Sep 2007 18:21:42 -0700 (PDT)
Received: from ?194.125.47.155? ( [194.125.47.155]) by mx.google.com with ESMTPS id 2sm700781nfv.2007.09.18.18.21.39 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 18 Sep 2007 18:21:41 -0700 (PDT)
Delivered-To: cpan-bug+devel-graph [...] diesel.bestpractical.com
Subject: Re: [rt.cpan.org #29346] decompose fails on a closure, for loop and until loop
Domainkey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:mime-version:in-reply-to:references:content-type:message-id:content-transfer-encoding:from:subject:date:to:x-pgp-agent:x-mailer; b=g/2uLB+/A+ArAZ2PDhaM6RN8t86WitY9nDK+P3B6ABau0XW64o/xx0zAtxM3yDISt1FfwVDcQyV9NNgGrT3UmEB4qI8XquRcMf9hmbWwnGX1xOn4JUQWr2zWxYDnNsHkDxadwMFxirtHkCuru48XgCBFToDgj8H/mqZyQ0KUyU4=
Return-Path: <moghroth [...] gmail.com>
Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:mime-version:in-reply-to:references:content-type:message-id:content-transfer-encoding:from:subject:date:to:x-pgp-agent:x-mailer; bh=wVzWtk8rCwy6YJ8e/t8smssvbi8EevZZBcpGzdgej8Y=; b=doumZe6FRp+WWNxUMaYpNMjwT4CiLlzFrPeN/xtBs8WcDK1briZDNyr57cHZ1cz4HiJwFWwf1QB3iI1WxqBqEzTMncSg/7FCddIvUPgEYwmjtPTFEIBv+R/qqpO0Qo7UMi5sr1qJaSoCqgtqGZlj+p+yL8Rsk/m2VMl1O284+Jw=
X-Spam-Check-BY: la.mx.develooper.com
X-Original-To: bug-Devel-Graph [...] rt.cpan.org
Date: Wed, 19 Sep 2007 02:20:24 +0100
Message-Id: <7FAECE31-664E-11DC-933F-000A95EB57B4 [...] gmail.com>
To: bug-Devel-Graph [...] rt.cpan.org
Content-Transfer-Encoding: quoted-printable
From: Brían Mach Aon Innéirghthe <moghroth [...] gmail.com>
X-RT-Original-Encoding: utf-8
RT-Message-ID: <rt-3.6.HEAD-27791-1190164934-955.29346-0-0 [...] rt.cpan.org>
Content-Length: 789
Download (untitled) / with headers
text/plain 789b
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 15 MFómh 2007, at 21:53, via RT wrote: Show quoted text
> Please note that Graph::Devel uses PPI to parse the Perl code, but PPI > only parses the syntax and doesn't do any semantic analysis. This means > that even invalid Perl code will be parsed by PPI just fine, and the > caller needs to figure out what the generated tree actually means. > > And this is quite hard, especially solving it in a general and > recursive > manner.
Syntax and semantics !!! 27 by 11 is, first, last, Show quoted text
>together<
B Brían Mach Aon Innéirghthe Corcaigh Éire -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (Darwin) iD8DBQFG8HlZCS8qwOrvIcsRArG9AJ9E/eS/jSLJr7ubSzqfpunvFAq4VgCcDdYn ekBtpea6k9EyhCP185RkJEg= =Hi3c -----END PGP SIGNATURE-----
MIME-Version: 1.0
In-Reply-To: <rt-3.6.HEAD-27791-1190164934-955.29346-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Disposition: inline
Charset: utf8
References: <RT-Ticket-29346 [...] rt.cpan.org> <rt-3.6.HEAD-9906-1189889635-1962.29346-6-0 [...] rt.cpan.org> <7FAECE31-664E-11DC-933F-000A95EB57B4 [...] gmail.com> <rt-3.6.HEAD-27791-1190164934-955.29346-0-0 [...] rt.cpan.org>
Message-Id: <rt-3.6.HEAD-8750-1197724598-1125.29346-0-0 [...] rt.cpan.org>
Content-Type: text/plain
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Original-Encoding: utf-8
Content-Length: 815
Download (untitled) / with headers
text/plain 815b
hello, sorry for the late response, somehow RT did not forward your message to me. In any event, I do not understand your reply :( Can you please rephrase it? On Tue Sep 18 21:22:14 2007, moghroth@gmail.com wrote: Show quoted text
> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > On 15 MFómh 2007, at 21:53, via RT wrote: >
> > Please note that Graph::Devel uses PPI to parse the Perl code, but PPI > > only parses the syntax and doesn't do any semantic analysis. This means > > that even invalid Perl code will be parsed by PPI just fine, and the > > caller needs to figure out what the generated tree actually means. > > > > And this is quite hard, especially solving it in a general and > > recursive > > manner.
> > Syntax and semantics !!! > > 27 by 11 is, > > first, last, >
> >together<
> > B


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.