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