Suggestions other than grep -b3 :-)
Jacqui Caren
jacqui.caren at ntlworld.com
Thu Apr 13 15:28:27 BST 2006
Jonathan Stowe wrote:
> On Thu, 2006-04-13 at 14:36, Jacqui Caren wrote:
>
>>I have been given the task of testing a large code base.
>>One of the gotcha's I have found is similar to
>>
>>
>>sub ... {
>> my $retval = undef;
>> ...
>> if (..) {
>> my $retval = {};
>>
>> $retal->{a} = 1;
>> ...
>> }
>> return $retval;
>>}
>>
>>Any suggestions on how to catch this sort of construct?
>
>
> Apart from the typo I can't actually see what is wrong with this code,
> maybe you explain what "this sort of construct" is precisely.
The 'my' within the if conditoinal means that
no value is ever returned/seen after the if code block.
Remove the 'my' and all works as designed.
More information about the london.pm
mailing list