On Tue, Jul 07, 2009 at 08:44:13AM +1000, [email protected] wrote: > hi, everyone, > > I finally looked at the updated doc for txn_do and transactions have > been implemented correctly in my application. > > Nevertheless, I do have a few questions (at the bottom). > > > > > > sub save_complete_records > { > ... > > eval > { > $c->model('myAppDB')->schema->txn_do( sub > { > ... > $c->forward( > '/subscriptions/_save_address', > [ > { 'policy_id' => $policy_id, } > ] > ); > > ... > } > if ($@) > { > $c->log->debug(' Exception manually trapped here : ' . $@ ); > $c->model('myAppDB')->schema->txn_rollback or die "Cannot ROLL > BACK - Address module"; > $c->log->debug(' manually rolled back' ); > $c->error( > q{ An error has occured with the listing. If this problem } . > q{persists please contact our helpdesk at > helpd...@insuranceline.}. > q{com.nz.} > ); > } > } > > > To test, I purposedly entered a very long string for one of the database > attributes to make the transaction fail. > > I have the following questions: > 1) I looked at the terminal with all the debug messages. I noticed that > the exception was caught and eventhough the roll back was done, I do not > see the print outs from the liens within the "if ($@)" (exception > handling) section above. Why is that?
Because you did not end your eval with a ';', and you are not running with strict/warnings? :) _______________________________________________ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archive: http://www.grokbase.com/group/[email protected]
