[tapx-dev] Poosible issue with TAP::Parser::Source::_get_command()
Ovid
publiustemp-tapx at yahoo.com
Tue Aug 14 13:55:42 BST 2007
--- Leif Eriksen <leif.eriksen at bigpond.com> wrote:
> The call to source returns undef, and that cant be used in an array
> context for the @{} - if that's the right terminology.
That would be list context, actually. It's a minor but important
point.
> I've replaced _get_command with the following (slower but safer) code
Don't worry about 'slower'. Correctness is far more important. With
your help with test coverage, we can worry about performance later and
feel more confident in it!
> An alternative is to leave the code as it is but wrapped to suppress
> the warning.
>
> sub _get_command {
> {
> no warn qw(uninitialised); # I think this is right one
> return @{ shift->source };
> }
> }
With trying to target older Perl's, that's better written as:
sub _get_command {
local $^W;
return @{ shift->source };
}
I have no problem with suppressing warnings if it's clear that the
warning is not really a problem. If we can think of any reason why
shift->source should never return undef, that would be different.
However, this reveals a problem in the code.
More information about the tapx-dev
mailing list