Skip Menu |

This queue is for tickets about the Smart-Comments CPAN distribution.

Report information
The Basics
Id: 55641
Status: open
Priority: 0/
Queue: Smart-Comments

People
Owner: Nobody in particular
Requestors: user42 [...] zip.com.au
Cc:
AdminCc:

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



Subject: labelled expression with colon in it
Date: Wed, 17 Mar 2010 08:21:58 +1100
To: bug-Smart-Comments [...] rt.cpan.org
From: Kevin Ryde <user42 [...] zip.com.au>
With Smart::Comments 1.0.4 and recent debian i386 perl 5.10.1 the program foo.pl below prints ### foo: $x ? $y : 'zzz' where I hoped it would be ### foo: 'yyy' It looks like the pattern for "labelled scalar" takes the label part as everything up to the last colon (or last which has a $ somewhere following it, or something). It'd be good if the label only went up to the first colon, so the expression part can have the ?: operator, or a fully-qualified name (like qualif.pl below), etc.
use strict; use warnings; use Smart::Comments; my $x = 'xxx'; my $y = 'yyy'; my $z = 'zzz'; ### foo: $x ? $y : $z
use strict; use warnings; use Smart::Comments; our $foo = 1; our $bar = 1; ### foo: $main::foo + $main::bar
One more time.

Hi Kevin,

Thanks for reminding me: I *have* promised drop-in replacement behavior 
for v1.x.x; but I've also promised to fix bugs raised against Vanilla; 
there is perhaps some inconsistency here. 

I've told feature requestors to wait for v2.0.0. But *this* clearly is a 
bug. 

I smell it in the post-dump crunch spanning lines 1453-1456: 

1454:    $dumped =~ s/\$VAR1 = \[\n//;

To me, that looks very like the line written specifically to fix this 
very bug. Which it does not do. The culprit, I suspect, is: 

1436:    # Handle a prefix with no actual variable...
1437:    if ($prefix && !$defined_varref) {
...
1442:        return 1;               # ...abort if not defined $varref
1443:    }

Having come so far, I might as well fix it, right? Let me see if I can 
saddle up the old hoss for one last ride. 

As far as a less-greedy colon-eater, well, I think I'd have to call that 
a requested feature. Feel free to open a ticket on it but this opens the 
big can of worms: the immense FILTER call which does a single pass on 
the entire user code with multiple regexes. I did not like the way it 
was written in Vanilla and, having spent quite a bit of time fiddling 
with it, I still don't like it. 

Thanks, 

Xiong Changnian