Closed zbentley closed 8 years ago
Hi @zbentley !
Thanks for the issue report and this pull-request. That put aside - I have some comments:
if ($tb) {
CODE
}
to:
CODE
http://www.shlomifish.org/open-source/resources/how-to-contribute-to-my-projects/HACKING.html
Please rework all those.
if ( $tb )
other than the test I added, which exists to verify the boolean overloading truthiness behavior. If such code exists, please let me know where it is and I will fix it. If the desired behavior is for truthiness to change based on presence of data, I can make that change as well. However, I think that truthiness based on table contents is a bit less obvious to users: should a table be "false" if column headings have been configured, but no rows added? That might be useful, but would be a behavior change and would need to be documented; I think the simpler change runs less risk of breaking existing code.delete
on (non-tied or overloaded) hashes will always return a scalar or undef
, it is not necessary here. If the value being tested on were a more complex expression, using scalar
would be in order. See: perl -Mstrict -MData::Dumper -e 'my %a; my $b = delete $a{foo}; my @b = delete $a{foo}; print Dumper($b); print Dumper(\@b); print scalar(@b);'
@zbentley : hi! Thanks for returning to me. Regarding No. 1 - the boolean check - apparently I misread your original bug report, and didn't notice you performed that check for truthness in the code yourself. Thanks for the other fixes - I'll review your pull-request and hopefully commit it and release a new version.
Thanks for taking the time to review it!
Be aware that this is technically a small behavior change: tables that previously stringified to the empty string and returned falsy in boolean context will now return true. I doubt that there are many use cases that not only perform boolean checks on tables, but also do important things in the negative case, but there are probably some.
Existing tests/build all pass. New tests fail for me without module changes.