Commit | Line | Data |
75d07914 |
1 | package # hide from PAUSE |
c0e7b4e5 |
2 | DBIx::Class::CDBICompat::GetSet; |
fe5d862b |
3 | |
bf5ecff9 |
4 | use strict; |
5 | use warnings; |
6 | |
fe5d862b |
7 | #use base qw/Class::Accessor/; |
8 | |
9 | sub 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 | |
18 | sub 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 | |
32 | 1; |