Monni wrote on Aug 27
th, 2014 at 10:11am:
because plain undefined check can cause Perl to crash
This is one of the things I'm testing
sub isempty {
my ($x, $y) = @_;
if ( defined $x && $x ne q{} ) {
$y = $x;
}
return $y;
}
Not using it on things like vars or boards that are loaded in Load (Those are both fed into hashes so those things need to be checked in Load and I haven't gotten there yet. )
Where I'm using the new sub is in the spots where the result should be 'something', including a '0', but not a 'nothing'. In Settings we have some spots where 'nothing' is allowed but should be a 0 and some spots where it could be a 0 but 'nothing' should be something else. (Like the image sizes.)
I went though all the '||='s, checked on what the possible good results were and decided if it should be a '||=' or a ' = isempty'.
I need to do more testing but should have it in the SVN later today.
(Also converted the '||' related to the fopen function to 'or' - it's lower precidence and it what's usually used for system call errors anyway. Also makes for fewer '||' to check. :
)