Skip Menu |

This queue is for tickets about the Expect CPAN distribution.

Report information
The Basics
Id: 47834
Status: resolved
Priority: 0/
Queue: Expect

Owner: RGiersig [...]
Requestors: shunter [...]

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

Subject: Expect Bug
Date: Mon, 13 Jul 2009 09:15:12 -0500
To: bug-Expect [...]
From: "Scott L. Hunter III" <shunter [...]>
Download (untitled) / with headers
text/plain 1.1k
Hi, I believe I've found a bug with According to the documentation, the following methods should return undef if no strings were matched during each call to expect(): exp_after (after), exp_match_number (match_number), and exp_match (match). This is not the case though. For example, if you have a script with two calls to expect(), and the first call finds a string match, then the following methods will return their appropriate values: exp_after (after), exp_match_number (match_number), and exp_match (match). However, if the second call to expect() doesn't return a match, then those three aforementioned methods still return the match information from the first call to expect. I believe that this is not the intended behavior, because those three methods should return undef when called below the second call to expect (which failed to match). The solution to this bug is to reset (to undef) the following three variables if no matches are found: ${*$exp}{exp_After} ${*$exp}{exp_Match_Number} ${*$exp}{exp_Match} I've supplied a diff for the fix. Please let me know what you think. Thanks, Scott Hunter
Download fix.diff
text/x-diff 406b

Message body is not shown because sender requested not to inline it.

Will be in 1.30 please test it. Thanks for the report and the patch.

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to