Suggestions other than grep -b3 :-)

Jonathan Stowe jns at gellyfish.com
Thu Apr 13 17:09:17 BST 2006


On Thu, 2006-04-13 at 15:28, Jacqui Caren wrote:
> 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.

Ah yes, didn't even notice that extra 'my'.

This is what you get for asking technical questions in a non-technical
mailing list.

/J\
-- 

This e-mail is sponsored by http://www.integration-house.com/



More information about the london.pm mailing list