[Dbix-class] stupid ?: how to create new objects & save them?

Mark Hedges hedges at ucsd.edu
Sat Apr 1 02:39:21 CEST 2006


It isn't obvious to me why I can't do this:

  my $newsletter = $customer->newsletter;
  my $customer_email = $customer->customer_email;

  if (!$newsletter) {
      $newsletter = C::Newsletter->new({ 
          email  => $customer_email 
      });
      warn "newsletter is a '$newsletter'\n";
      # says it's a C::Newsletter
  }
  $newsletter->weekly(1);
  $customer->newsletter( $newsletter );
  $newsletter->update;
  $customer->update;

I get this error:

  DBIx::Class::InflateColumn::update(): Not in database at <myscript> line 51

What?

How am I supposed to create objects and save them?  I poured
through the manual again, but there's nothing about what seems
like a basic function.

Mark



More information about the Dbix-class mailing list