[Catalyst] Handling Exceptions

Kiefer, Sascha sk at intertivity.com
Sun Apr 16 21:17:31 CEST 2006


Well, it doesn't.
Do i have to set some special options or anything similar?

> -----Original Message-----
> From: Matt S Trout [mailto:dbix-class at trout.me.uk] 
> Sent: Sonntag, 16. April 2006 20:59
> To: sk at intertivity.com
> Cc: 'The elegant MVC web framework'
> Subject: Re: [Catalyst] Handling Exceptions
> 
> 
> Kiefer, Sascha wrote:
> > Okay.
> > But then, i have to do the rollback myself, right?
> > 
> > my $model       = $c->model('DBIC::PbUser');
> > my $create_user = sub {
> >     my $user =
> >       $model->create(
> >         { username => $username, password => $csh->generate } );
> >     $user->create_related( 'profile', { email => $emailaddr } );
> >     die "Just for testing";
> >     $user->create_related( 'settings',
> >       { registerDate => DateTime->now } );
> > };
> > 
> > my $rs;
> > eval { $rs = $model->schema_instance->	txn_do($create_user); };
> > if ($@) {
> > # ...
> > }
> > 
> > And now, i have a new in entry in my user and in my user_profile 
> > table.
> 
> It should roll back automatically - c.f.
> 
> http://search.cpan.org/src/JROBINSON/DBIx-Class-0.06001/t/run/
21transactions.tl

-- 
      Matt S Trout       Offering custom development, consultancy and
support
   Technical Director    contracts for Catalyst, DBIx::Class and BAST.
Contact
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

+ Help us build a better perl ORM: 
+ http://dbix-class.shadowcatsystems.co.uk/ +




More information about the Catalyst mailing list