i5513 has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
I'm frustrate because I cannot imagine which makes in my code fails next sentence (which works fine until some points which I don't know):
if ($r =~ //) { xxx }
I was debugging my issue and find this, maybe there is relation:
Consider next simple program:
And then execute perl -d file or perl -e perl -d -e 'use CGI qw(:standard); $q=CGI->new' Then in the debugger:#!/usr/bin/perl -w use CGI qw(:standard); my $q=CGI->new ;
DB<1> w print "hola" if ("r" =~ //); DB<2> holac Watchpoint 0: print "hola" if ("r" =~ //); changed: old value: '1' new value: '' CGI::_compile(/usr/share/perl/5.12/CGI.pm:867): 867: ($pack,$func_name) = ($1,$2); DB<2> holaholaholaholaholaholaholaholaholaholaholaholaholaholaholaho +laholaholaholaholaholaholaholaholaholaholaholaholaholaholaholaholahol +aholaholaholaholaholaholaholaholahola DB<2> p print "hola" if ("r" =~ //); DB<3>
So, why "r" =~ // changes her semantics? (note DB<2> response and remember that it happens too in some moment inside my code (which is larger and I cannot post fully here))
Please see that "r" =~ // come from "$r" =~ /$r2/ in my real program. And too if I change $r2 to "." if it is empty my program works fine.
So, do you think I should report it as an CGI.pm bug or do you have any tip for me?
Thank you very much monks!
PD: I don't know if this go better to "Meditations" or it is ok in Seekers section.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Is this a bug ?
by chromatic (Archbishop) on Jul 12, 2011 at 19:08 UTC | |
by ikegami (Patriarch) on Jul 12, 2011 at 20:46 UTC | |
by chromatic (Archbishop) on Jul 13, 2011 at 18:38 UTC | |
by i5513 (Pilgrim) on Jul 13, 2011 at 08:01 UTC | |
by i5513 (Pilgrim) on Jul 13, 2011 at 11:10 UTC | |
by Anonymous Monk on Jul 13, 2011 at 11:17 UTC | |
|
Re: Is this a bug ?
by Anonymous Monk on Jul 12, 2011 at 18:31 UTC | |
by i5513 (Pilgrim) on Jul 12, 2011 at 20:07 UTC |