sub url_create : Local { # In addition to self & context, get the title, rating, & # author_id args from the URL. Note that Catalyst automatically # puts extra information after the "//model('DB::Books')->create({ title => $title, rating => $rating }); # Add a record to the join table for this book, mapping to # appropriate author $book->add_to_book_authors({author_id => $author_id}); # Note: Above is a shortcut for this: # $book->create_related('book_authors', {author_id => $author_id}); # Assign the Book object to the stash for display in the view $c->stash->{book} = $book; # This is a hack to disable XSUB processing in Data::Dumper # (it's used in the view). This is a work-around for a bug in # the interaction of some versions or Perl, Data::Dumper & DBIC. # You won't need this if you aren't using Data::Dumper (or if # you are running DBIC 0.06001 or greater), but adding it doesn't # hurt anything either. $Data::Dumper::Useperl = 1; # Set the TT template to use $c->stash->{template} = 'books/create_done.tt2'; } #### INSERT INTO books (rating, title) VALUES (?, ?): '5', 'TCPIP_Illustrated_Vol-2' SELECT COUNT( * ) FROM books me: SELECT COUNT( * ) FROM books me: [info] *** Request 1 (0.038/s) [5225] [Thu Aug 14 15:29:27 2008] *** [debug] "GET" request for "books/url_create/TCPIP_Illustrated_Vol-2/5/4" from "202.38.40.128" [debug] Path is "books/url_create" [debug] Arguments are "TCPIP_Illustrated_Vol-2/5/4" [error] DBI Exception: DBD::Oracle::st execute failed: ORA-01400: cannot insert NULL into ("SDB2"."BOOKS"."ID") (DBD ERROR: OCIStmtExecute) [for Statement "INSERT INTO books (rating, title) VALUES (?, ?)" with ParamValues: :p1='5', :p2='TCPIP_Illustrated_Vol-2'] at /usr/local/lib/perl5/site_perl/5.10.0/DBIx/Class/Schema.pm line 954