in reply to Update Primary Key with DBIx::Class

Hi, your problem can be solved by using either of:

if($acct) { $acct->acctid( 'pv002' ); $acct->update; $acct->discard_changes; # add this }
... see the doc for discard_changes(), which has a somewhat counter-intuitive name but acts as a "commit" if you've made changes to your result object in your code.

Or else:

if($acct) { $acct->update({acctid => 'pv002'}); }
... which updates the record in the database immediately as well as in your program.

To find out what queries DBIx::Class is sending to your database, run your program with DBIC_TRACE=1 set in your environment.

Hope this helps!

Update: fixed missing clsoing brace, thanks pryrt


The way forward always starts with a minimal test.