Subject: | backwards compatible tests |
After i manually fixed the issue in ticket #19785, I then got a bunch of
'Can't locate object method "insert"' errors because the test use
->insert but i have Class::DBI 0.96 which uess ->create ...
an option might be to have different test files, and they run
conditionally on the CDBI version??
In Class::DBI::AutoIncrement::Simple (see t/csv.t), I just did:
my $method;
$method = 'create' if Class::DBI->can('create');
$method = 'insert' if Class::DBI->can('insert');
ok($method,"got method: $method");
...
$row = Test::DB->$method({my_id=>5, first_name=>'aaa',
last_name=>'bbbb'});
not the best, but quick & dirty .. just a test file, right? ;)
~~~~~~~~~~~~~~~~
I'm using:
Class::DBI::AutoIncrement 0.05
IO::Handle 1.21
Class::DBI 0.96
DBD::CSV 0.22
DBD::File 0.34
SQL::Statement 1.15
This is perl, v5.6.1 built for i386-linux
Linux example.com 2.4.21-32.0.1.EL #1 Wed May 25 16:02:04 CDT 2005 i686
unknown