Added a TODO for deploy().
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Row.pm
index fd3ad13..d71a13b 100644 (file)
@@ -10,7 +10,7 @@ __PACKAGE__->load_components(qw/AccessorGroup/);
 
 __PACKAGE__->mk_group_accessors('simple' => 'result_source');
 
-=head1 NAME 
+=head1 NAME
 
 DBIx::Class::Row - Basic row methods
 
@@ -36,9 +36,11 @@ sub new {
   $class = ref $class if ref $class;
   my $new = bless { _column_data => {} }, $class;
   if ($attrs) {
-    $new->throw_exception("attrs must be a hashref") unless ref($attrs) eq 'HASH';
+    $new->throw_exception("attrs must be a hashref")
+      unless ref($attrs) eq 'HASH';
     while (my ($k, $v) = each %$attrs) {
-      $new->throw_exception("No such column $k on $class") unless $class->has_column($k);
+      $new->throw_exception("No such column $k on $class")
+        unless $class->has_column($k);
       $new->store_column($k => $v);
     }
   }
@@ -120,9 +122,9 @@ sub update {
 
   $obj->delete
 
-Deletes the object from the database. The object is still perfectly usable
-accessor-wise etc. but ->in_storage will now return 0 and the object must
-be re ->insert'ed before it can be ->update'ed
+Deletes the object from the database. The object is still perfectly usable,
+but ->in_storage() will now return 0 and the object must re inserted using
+->insert() before ->update() can be used on it.
 
 =cut
 
@@ -134,8 +136,8 @@ sub delete {
     $self->throw_exception("Cannot safely delete a row in a PK-less table")
       if ! keys %$ident_cond;
     foreach my $column (keys %$ident_cond) {
-           $self->throw_exception("Can't delete the object unless it has loaded the primary keys")
-             unless exists $self->{_column_data}{$column};
+            $self->throw_exception("Can't delete the object unless it has loaded the primary keys")
+              unless exists $self->{_column_data}{$column};
     }
     $self->result_source->storage->delete(
       $self->result_source->from, $ident_cond);
@@ -278,9 +280,9 @@ Sets a column value without marking it as dirty.
 
 sub store_column {
   my ($self, $column, $value) = @_;
-  $self->throw_exception( "No such column '${column}'" ) 
+  $self->throw_exception( "No such column '${column}'" )
     unless exists $self->{_column_data}{$column} || $self->has_column($column);
-  $self->throw_exception( "set_column called for ${column} without value" ) 
+  $self->throw_exception( "set_column called for ${column} without value" )
     if @_ < 3;
   return $self->{_column_data}{$column} = $value;
 }
@@ -310,7 +312,7 @@ sub inflate_result {
     if (ref($pre_val->[0]) eq 'ARRAY') { # multi
       my @pre_objects;
       foreach my $pre_rec (@$pre_val) {
-        unless ($pre_source->primary_columns == grep { exists $pre_rec->[0]{$_} 
+        unless ($pre_source->primary_columns == grep { exists $pre_rec->[0]{$_}
            and defined $pre_rec->[0]{$_} } $pre_source->primary_columns) {
           next;
         }
@@ -318,13 +320,13 @@ sub inflate_result {
                              $pre_source, @{$pre_rec}));
       }
       $new->related_resultset($pre)->set_cache(\@pre_objects);
-    } else {
+    } elsif (defined $pre_val->[0]) {
       my $fetched;
-      unless ($pre_source->primary_columns == grep { exists $pre_val->[0]{$_} 
+      unless ($pre_source->primary_columns == grep { exists $pre_val->[0]{$_}
          and !defined $pre_val->[0]{$_} } $pre_source->primary_columns)
       {
         $fetched = $pre_source->result_class->inflate_result(
-                      $pre_source, @{$pre_val});      
+                      $pre_source, @{$pre_val});
       }
       my $accessor = $source->relationship_info($pre)->{attrs}{accessor};
       $class->throw_exception("No accessor for prefetched $pre")
@@ -371,7 +373,11 @@ sub is_changed {
 
 =head2 register_column
 
-=head3 Arguments: ($column, $column_info)
+=over 4
+
+=item Arguments: ($column, $column_info)
+
+=back
 
   Registers a column on the class. If the column_info has an 'accessor' key,
   creates an accessor named after the value if defined; if there is no such