10 use DBIx::Class::_Util 'is_plain_value';
17 # *DELIBERATELY* unspecified
19 '0+' => sub { ${$_[0]} },
24 DBICTest::SillyInt::Subclass;
26 our @ISA = 'DBICTest::SillyInt';
39 # check DBI behavior when fed a stringifiable/nummifiable value
41 my $crazynum = bless {}, 'DBICTest::CrazyInt';
42 cmp_ok( $crazynum, '==', 666 );
43 cmp_ok( $crazynum, 'eq', 999 );
45 my $schema = DBICTest->init_schema( no_populate => 1 );
46 $schema->storage->dbh_do(sub {
47 $_[1]->do('INSERT INTO artist (name) VALUES (?)', {}, $crazynum );
50 is( $schema->resultset('Artist')->next->name, 999, 'DBI preferred stringified version' );
53 # make sure we recognize overloaded stuff properly
55 my $num = bless( \do { my $foo = 69 }, 'DBICTest::SillyInt::Subclass' );
56 ok( is_plain_value $num, 'parent-fallback-provided stringification detected' );
57 is("$num", 69, 'test overloaded object stringifies, without specified fallback');