]> git.decadent.org.uk Git - maypole.git/blobdiff - lib/Maypole/Model/CDBI/AsForm.pm
fixed undef warnings
[maypole.git] / lib / Maypole / Model / CDBI / AsForm.pm
index c072dc8d7112e1433e1fd5ef3c062b598947842e..8a7f06c95e3f8237aad4d82009b0eba928353060 100644 (file)
@@ -1,6 +1,4 @@
 package Maypole::Model::CDBI::AsForm;
-
-use Class::C3;
 use strict;
 
 use warnings;
@@ -882,9 +880,9 @@ sub _to_bool_select {
     unless (defined $selected);
 
   my $a = HTML::Element->new("select", name => $col);
-  if ($args->{column_nullable} || $args->{value} eq '') {
+  if ($args->{column_nullable} || !defined $args->{value} ) {
     my $null =  HTML::Element->new("option");
-    $null->attr('selected', 'selected') if  $args->{value} eq '';
+    $null->attr('selected', 'selected') if  (!defined $args->{value});
     $a->push_content( $null ); 
   }
 
@@ -983,7 +981,8 @@ sub _to_foreign_inputs {
   my $rel_meta = $args->{related_meta} || $self->related_meta('r',$accssr); 
   my $fields           = $args->{columns};
   if (!$rel_meta) {
-    $self->_croak( "No relationship for accessor $accssr");
+    $self->_carp( "[_to_foreign_inputs] No relationship for accessor $accssr");
+    return;
   }
 
   my $rel_type = $rel_meta->{name};
@@ -1178,7 +1177,7 @@ sub _options_from_objects {
   for my $object (@$items) {
     my $stringify = $args->{stringify};
     if ($object->can('stringify_column') ) {
-      $stringify ||= $object->stringify_column if ($object->can($object->stringify_column));
+      $stringify ||= $object->stringify_column if ($object->stringify_column && $object->can($object->stringify_column));
     }
     my $id = $object->id;
     my $opt = HTML::Element->new("option", value => $id);