Strange Perl pattern matching
Julien ÉLIE
julien at trigofacile.com
Sat Jul 4 09:33:26 UTC 2009
Hi,
There is something weird in what I obtain from Perl (5.8.8 and 5.10.0):
$ngname = 'trigofacile.test';
$newsgrouppats = '^trigofacile\..*$';
$exclusionpats = '^a\..*$';
$droppats = '';
If I try in control/modules/checkgroups.pl:
#next if ($ngname !~ /$newsgrouppats/);
print "A\n";
next if ($ngname =~ /$exclusionpats/);
print "B\n";
next if ($ngname =~ /$droppats/);
print "C\n";
Sat Jul 4 11:02:11 2009: control_checkgroups, ^trigofacile\..*$ test test b-checkgroups, ^a\..*$, , utf-8, , mail, 1
A
B
C
"C" should not have been written ($droppats is an empty string, so the condition
is true).
But if I uncomment the first line:
next if ($ngname !~ /$newsgrouppats/);
print "A\n";
next if ($ngname =~ /$exclusionpats/);
print "B\n";
next if ($ngname =~ /$droppats/);
print "C\n";
Sat Jul 4 11:02:35 2009: control_checkgroups, ^trigofacile\..*$ test test b-checkgroups, ^a\..*$, , utf-8, , mail, 1
A
B
It now works...
And the following is fine:
next if ($ngname !~ /$newsgrouppats/);
print "A\n";
next if ($exclusionpats and $ngname =~ /$exclusionpats/);
print "B\n";
next if ($droppats and $ngname =~ /$droppats/);
print "C\n";
Sat Jul 4 11:03:27 2009: control_checkgroups, ^trigofacile\..*$ test test b-checkgroups, ^a\..*$, , utf-8, , mail, 1
A
B
C
Does someone understand what is going on for the first case?
I cannot reproduce it in a standalone Perl script. Only in controlchan :-/
P.-S.: The same goes on Hope too:
2:25 iulius at hope ~/test-install/bin% echo "control/b-checkgroups" | ./controlchan
Sat Jul 4 02:25:51 2009: starting
Sat Jul 4 02:25:51 2009: control_checkgroups, ^trigofacile\..*$ test test control/b-checkgroups, ^a\..*$, , utf-8, , log, 1
A
B
C
--
Julien ÉLIE
« Les amis de la vérité sont ceux qui la cherchent,
et non ceux qui se vantent de l'avoir trouvée. » (Condorcet)
More information about the inn-workers
mailing list