From: Peter Rabbitson Date: Fri, 19 Sep 2014 14:35:14 +0000 (+0200) Subject: Boolification-derived-stringification is a thing... just shoot me now X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=20e178a84a647f5ae98a16a7358496c6dc86caf0;p=scpubgit%2FQ-Branch.git Boolification-derived-stringification is a thing... just shoot me now --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index 56bd631..c88d0c2 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -98,8 +98,6 @@ sub is_plain_value ($) { # intersted in are much more limited than the fullblown thing, and # this is a very hot piece of code ( - # FIXME - DBI needs fixing to stringify regardless of DBD - # # simply using ->can('(""') can leave behind stub methods that # break actually using the overload later (see L ( ($] < 5.008) ? 0 : 1 ); { package # hideee + SQLATest::SillyBool; + + use overload + # *DELIBERATELY* unspecified + #fallback => 1, + bool => sub { ${$_[0]} }, + ; + + package # hideee + SQLATest::SillyBool::Subclass; + + our @ISA = 'SQLATest::SillyBool'; +} + +{ + package # hideee SQLATest::SillyInt; use overload @@ -103,6 +119,8 @@ use constant STRINGIFIER_CAN_RETURN_IVS => ( ($] < 5.008) ? 0 : 1 ); } for my $case ( + { class => 'SQLATest::SillyBool', can_math => 0, should_str => 1 }, + { class => 'SQLATest::SillyBool::Subclass', can_math => 0, should_str => 1 }, { class => 'SQLATest::SillyInt', can_math => 0, should_str => 1 }, { class => 'SQLATest::SillyInt::Subclass', can_math => 0, should_str => 1 }, { class => 'SQLATest::SillierInt', can_math => 0, should_str => 0 },