Move code having to do with adding columns out of ColumnCase.
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / CDBICompat / Iterator.pm
1 package DBIx::Class::CDBICompat::Iterator;
2
3 use strict;
4 use warnings;
5
6 =head1 NAME
7
8 DBIx::Class::CDBICompat::Iterator
9
10 =head1 SYNOPSIS
11
12 See DBIx::Class::CDBICompat for directions for use.
13
14 =head1 DESCRIPTION
15
16 Emulates the extra behaviors of the Class::DBI search iterator.
17
18 =head2 Differences from DBIx::Class result set
19
20 The CDBI iterator returns true if there were any results, false otherwise.  The DBIC result set always returns true.
21
22 =cut
23
24
25 sub _init_result_source_instance {
26   my $class = shift;
27   
28   my $table = $class->next::method(@_);
29   $table->resultset_class("DBIx::Class::CDBICompat::Iterator::ResultSet");
30
31   return $table;
32 }
33
34
35
36 package DBIx::Class::CDBICompat::Iterator::ResultSet;
37
38 use strict;
39 use warnings;
40
41 use base qw(DBIx::Class::ResultSet);
42
43 sub _bool {
44   return $_[0]->count;
45 }
46
47 1;