carp "Column '$col' of '$class/$id' was fetched as a hash"
if $ENV{DBIC_CDBICOMPAT_HASH_WARN};
- return $obj->$col();
+ return $obj->get_column($col);
}
sub STORE {
carp "Column '$col' of '$class/$id' was stored as a hash"
if $ENV{DBIC_CDBICOMPAT_HASH_WARN};
- $obj->$col(shift);
+ $obj->set_column($col => shift);
}
1;
BEGIN {
eval "use DBIx::Class::CDBICompat;";
plan $@ ? (skip_all => "Class::Trigger and DBIx::ContextualFetch required: $@")
- : (tests=> 9);
+ : (tests=> 10);
}
use lib 't/testlib';
warning_is {
local $ENV{DBIC_CDBICOMPAT_HASH_WARN} = 0;
$waves->{rating}
-} '', 'DBIC_CDBICOMPAT_HASH_WARN controls warnings';
\ No newline at end of file
+} '', 'DBIC_CDBICOMPAT_HASH_WARN controls warnings';
+
+
+{
+ local $ENV{DBIC_CDBICOMPAT_HASH_WARN} = 0;
+
+ $waves->rating("R");
+ $waves->update;
+
+ no warnings 'redefine';
+ local *Film::rating = sub {
+ return "wibble";
+ };
+
+ is $waves->{rating}, "R";
+}