Revision history for DBIx::Class
+ - Moved get_simple and set_simple into AccessorGroup
+ - Made 'new' die if given invalid columns
+
0.03004
- Added an || '' to the CDBICompat stringify to avoid null warnings
- Updated name section for manual pods
};
}
+sub get_simple {
+ my ($self, $get) = @_;
+ return $self->{$get};
+}
+
+sub set_simple {
+ my ($self, $set, $val) = @_;
+ return $self->{$set} = $val;
+}
+
1;
=back
sub new {
my ($class, $attrs, @rest) = @_;
$attrs ||= {};
- my %deflated;
foreach my $key (keys %$attrs) {
- if (exists $class->_columns->{$key}{_inflate_info}) {
- $deflated{$key} = $class->_deflated_column($key,
- delete $attrs->{$key});
+ if (ref $attrs->{$key} && exists $class->_columns->{$key}{_inflate_info}) {
+ $attrs->{$key} = $class->_deflated_column($key, $attrs->{$key});
}
}
- return $class->NEXT::ACTUAL::new({ %$attrs, %deflated }, @rest);
+ return $class->NEXT::ACTUAL::new($attrs, @rest);
}
-# **** B0RKEN. DOESN'T GET CALLED!
-#sub _cond_value {
-# my ($self, $attrs, $key, $value) = @_;
-# if (exists $self->_columns->{$key}) {
-# $value = $self->_deflated_column($key, $value);
-# }
-# return $self->NEXT::ACTUAL::_cond_value($attrs, $key, $value);
-#}
-
1;
if ($attrs) {
$new->throw("attrs must be a hashref" ) unless ref($attrs) eq 'HASH';
while (my ($k, $v) = each %{$attrs}) {
- $new->store_column($k => $v) if exists $class->_columns->{$k};
+ die "No such column $k on $class" unless exists $class->_columns->{$k};
+ $new->store_column($k => $v);
}
}
return $new;
my ($class, $cols, $row) = @_;
my %vals;
$vals{$cols->[$_]} = $row->[$_] for 0 .. $#$cols;
- my $new = $class->new(\%vals);
+ my $new = bless({ _column_data => \%vals }, ref $class || $class);
$new->in_storage(1);
return $new;
}
return $new;
}
-sub get_simple {
- my ($self, $get) = @_;
- return $self->{$get};
-}
-
-sub set_simple {
- my ($self, $set, $val) = @_;
- return $self->{$set} = $val;
-}
-
=head1 NAME
DBIx::Class::Storage::DBI - DBI storage handler