Merge 'trunk' into 'sybase_mssql'
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / CDBICompat / GetSet.pm
CommitLineData
75d07914 1package # hide from PAUSE
c0e7b4e5 2 DBIx::Class::CDBICompat::GetSet;
fe5d862b 3
bf5ecff9 4use strict;
5use warnings;
6
fe5d862b 7#use base qw/Class::Accessor/;
8
9sub get {
10 my ($self, @cols) = @_;
11 if (@cols > 1) {
12 return map { $self->get_column($_) } @cols;
13 } else {
14 return $self->get_column($_[1]);
15 }
16}
17
18sub set {
e60dc79f 19 my($self, %data) = @_;
3672b17f 20
21 # set_columns() is going to do a string comparison before setting.
22 # This breaks on DateTime objects (whose comparison is arguably broken)
23 # so we stringify anything first.
24 for my $key (keys %data) {
25 next unless ref $data{$key};
26 $data{$key} = "$data{$key}";
27 }
28
e60dc79f 29 return shift->set_columns(\%data);
fe5d862b 30}
31
321;