columns() as if it was add_columns().
=cut
-sub columns { return keys %{shift->_columns}; }
+sub columns {
+ die "columns() is a read-only accessor, did you mean add_columns()?" if (@_ > 1);
+ return keys %{shift->_columns};
+}
1;
--- /dev/null
+#!/usr/bin/perl
+
+use Test::More tests => 1;
+
+eval {
+ package BuggyTable;
+ use base 'DBIx::Class';
+
+ __PACKAGE__->load_components qw/Core/;
+ __PACKAGE__->columns qw/this doesnt work as expected/;
+};
+
+like($@,qr/^columns\(\) is a read-only/,
+ "columns() error when apparently misused");