Skip Menu |

This queue is for tickets about the Mail-Bulkmail CPAN distribution.

Report information
The Basics
Id: 1294
Status: resolved
Priority: 0/
Queue: Mail-Bulkmail

People
Owner: Nobody in particular
Requestors: ben_tilly [...] operamail.com
Cc:
AdminCc:

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



Subject: Random backreferences can cause wrong behaviour
The author appears to have wrongly expected $2 to be empty after an unsuccessful match. This can cause buggy behaviour. The following code shows that your last regular expression match can cause the constructor to fail for no apparent reason: use Mail::Bulkmail; print "Before the match the email is "; test_can_construct(); "Nice gotcha" =~ /(\w+) (\w+)/; print "After the match the email is "; test_can_construct(); sub test_can_construct { if (Mail::Bulkmail->new()) { print "I can construct a blank mailer\n"; } else { print "I can't construct a blank mailer\n"; } } The following isolates the function that I think the bug is in: use Mail::Bulkmail; my $mailer = Mail::Bulkmail->new(); print "Before the match the email is "; test_valid(); "Nice gotcha" =~ /(\w+) (\w+)/; print "After the match the email is "; test_valid(); sub test_valid { if ($mailer->valid_email('ben_tilly@operamail.com')) { print "valid.\n"; } else { print "invalid.\n"; } } And the following code demonstrates the Perl behaviour which is probably behind the bug. "This gotcha is subtle." =~ /(\w+)\s+(\w+)/; # time passes "Some other string" =~ /(another) (pattern)/; print "$2!\n";
Fixed as of v3.00