The implementation of sth_to_objects in DBIx/Class/CDBICompat/ImaDBI.pm
doesn't seem to be fully compatible with that in Class/DBI.pm

Specifically, the method in Class::DBI is context aware and returns an
iterator in scalar context. The CDBICompat version isn't context aware
and so returns a row count!

I see there is DBIx::Class::CDBICompat::Iterator which says "See
DBIx::Class::CDBICompat for directions for use" but I can see no mention
 of the word "iterator" in the DBIx::Class::CDBICompat POD. So I don't
know whether CLass::DBI's array vs iterator feature is supposed to work
in CDBICompat or not. If it isn't, it should die rather than return
faulty data, IMHO.


Cheers, Dave


PS OT but I'm also confused by this code in Class::DBI

  sub _ids_to_objects {
        my ($class, $data) = @_;
        return $#$data + 1 unless defined wantarray;
        return map $class->construct($_), @$data if wantarray;
        return $class->_my_iterator->new($class => $data);
  }

I think 'defined wantarray' only returns undefined in void context, so I
don't understand why it's returning the record count?

_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]

Reply via email to