New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug in Switch module #7812
Comments
From internationils@gmx.netAttached is the bugreport and code to reproduce it. If there are Thanks, |
From internationils@gmx.netCreated by internationils@gmx.netusing Perl, running under Cygwin on Win XP SP2 including "use Switch;" in the program breaks the program, even if it is not used. Adding or removing comments or random lines of code (whether actually called or not) can cause or remove the program. To reproduce: Switch should be fixed or removed from Core. It is a serious liability. Thanks, Perl Info
|
From @ysthOn Wed, Feb 23, 2005 at 01:14:01PM -0000, Nils wrote:
Umm, since removing it would also break programs that say "use Switch;", |
The RT System itself - Status changed from 'new' to 'open' |
From @nwc10On Wed, Feb 23, 2005 at 11:52:12PM -0800, Yitzchak Scott-Thoennes wrote:
It would be good if someone who understands it were able to do this. [Prerequisites on this task being either understanding and time, or just Nicholas Clark |
From @ysthOn Thu, Feb 24, 2005 at 09:40:15AM +0000, Nicholas Clark wrote:
I actually meant something more like "I'd vote for leaving it in until
I would fall into the requiring "a lot of time" category. |
From @rgsNicholas Clark wrote:
As the official Switch maintainer, I have to say that I'm not very confident |
From @TuxOn Thu, 24 Feb 2005 01:49:22 -0800, Yitzchak Scott-Thoennes <sthoenna@efn.org>
:) FWIW I have far encountered too many problems with Switch, esp in combination
And I think that next to "time" and "understanding", one certainly needs -- |
From @ysthOn Thu, Feb 24, 2005 at 11:51:23AM +0100, H.Merijn Brand wrote:
If it's the source filter aspect that deters you, note that perltodo says: =head2 switch ops The old perltodo notes "Although we have C<Switch.pm> in core, Larry points to |
From @tamiasHere is a simple script that demonstrates the bug: #!/usr/bin/perl -w use strict; use Switch; # case (make sure Switch.pm applies the filter) my $x = 4; print "Look for extra whitespace here --> $filename\n"; __END__ The problem is that the first / is being matched as the start of a regular Here's the filtered code, with !V{}V! and !Q{}Q! showing the matching of # line 6 # case (make sure Switch.pm applies the filter) my!V{ $x}V! = 4; print "}Q!Look for extra whitespace here -->!V{ $filename}V!\n"; The extra whitespace appears as the result of a second bug, which adds an The matching of / as the start of a quote-like string happens in This seems to be the fatal flaw of any simplistic attempt at parsing Perl; Ronald |
From david@landgren.netYitzchak Scott-Thoennes wrote:
Odd. I tend to find the reverse. Adding "use Switch;" to a program tends No, I'm not trying to troll. Seriously, do people use Switch.pm in a David |
From artyomt@Insightec.comThis is a bug report for perl from artyomt@insightec.com, Wrong syntax error. The script example (reduced version): my $line; } #sub for opening files in 'read', 'write' or 'append' mode } # sub simple_stats { ###END######## The error message:
String found where operator expected at test.pl line 14, near "case Eny of the following eliminates the error: Site configuration information for perl v5.8.6: Configured by ActiveState at Mon Dec 13 09:51:32 2004. Summary of my perl5 (revision 5 version 8 subversion 6) configuration: Locally applied patches: @INC for perl v5.8.6: Environment for perl v5.8.6: PATH=U:\bin\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\ Complete configuration data for perl v5.8.6: Author='' |
From a.r.ferreira@gmail.comOn 7/11/06, via RT Artyom Tseitlin <perlbug-followup@perl.org> wrote:
[snip]
This kind of error is due to the same point mentioned in the Due to the heuristic nature of Switch.pm's source parsing, In this case, the unbalanced '/' causes the mysterious error. You can
with
This '/' in comment balances the occurrences of the bracket. Of |
The RT System itself - Status changed from 'new' to 'open' |
From a.r.ferreira@gmail.comOn 7/11/06, Adriano Ferreira <a.r.ferreira@gmail.com> wrote:
A tiny script follows which exhibit the same error: it must have use Switch; $x = $a/$b; switch ($c) { # / A balanced construction opens at "$x = $a/$b;" because of / occurrence $ perl -c bad-slash.pl |
From @tamiasOn Tue, Jul 11, 2006 at 01:56:38PM -0300, Adriano Ferreira wrote:
You are correct. The problem involves Text::Balanced::_match_quotelike(), See also: http://rt.perl.org/rt3//Public/Bug/Display.html?id=34233 Ronald |
From @TuxOn Tue, 11 Jul 2006 13:54:13 -0400, Ronald J Kimball
Near to impossible now that we have (and use) defined-or. // rules For me, Switch.pm is therefor dead/unusable, as 95% of my scripts use -- |
From a.r.ferreira@gmail.comOn 7/11/06, Ronald J Kimball <rjk-perl-p5p@tamias.net> wrote:
So I think this ticket may be merged into #34233 and wait until |
From @smpetersOn Tue Jul 11 11:12:27 2006, ferreira2 wrote:
Merging.... By the way, in bleadperl, wouldn't it make sense to turn switch into a |
From @nwc10On Thu, Jul 20, 2006 at 09:52:24AM -0700, Steve Peters via RT wrote:
I thought this, but I belive it's not trivial to get close to 100% as 1: bleadperl's given/when has different semantics (not sure how different) So I've no idea "how not trivial" it is. I might be wrong, it might be easy. Nicholas Clark |
From @cpansproutThis is the same as the CPAN bug here: |
@cpansprout - Status changed from 'open' to 'rejected' |
Migrated from rt.perl.org#34233 (status was 'rejected')
Searchable as RT34233$
The text was updated successfully, but these errors were encountered: