Re: before_create trigger problems

[prev] [thread] [next] [Date index for 2004/12/21]

From: Emile Aben
Subject: Re: before_create trigger problems
Date: 19:28 on 21 Dec 2004

> > Further on in the triggered sub I sometimes have
> to
> > create a new object in the database, and I'm
> currently
> > unable to get this working. My best try is:
> >
> >                if ($new_end && $new_start >=
> > $old_start && (!$old_end || $new_end <= $old_end )
> ) {
> > 			# case:     nnnn
> >                         #        ooooooooo(...)
> > 			# solution: cut old in 2
> > 			print STDERR "     nnnn\n";
> > 			print STDERR "   ooooooooo(...)\n";
> > 			my $old2 = $old->copy();
> > 			$old2->_attribute_set("start_date", $new_end +
> 1 );
> > 			$old2->update();
> > 			$old->_attribute_set("end_date", $new_start - 1
> );
> > 			$old->update();
> > 		}
> >
> > This get's stuck on line 51 in Trigger.pm again:
> > Can't retrieve a reference at
> >
>
/usr/local/perl-5.6.0/lib/site_perl/5.6.0/Class/Trigger.pm
> > line 51
> 
> Hmm.  Do you happen to know whether the copy() or
> the update() triggers 
> this error?

It's the copy() that causes this. Is there another way
to copy/clone without side-effects, and that
preferably will still work in future versions of CDBI.
I've been looking into that, but I guess I'll have to
write my own 'create' function that doesn't trigger
triggers.

Emile 

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

(message missing)

before_create trigger problems
Emile Aben 01:39 on 21 Dec 2004

Re: before_create trigger problems
Tony Bowden 09:09 on 21 Dec 2004

Re: before_create trigger problems
Drew Taylor 16:21 on 21 Dec 2004

Re: before_create trigger problems
Emile Aben 17:13 on 21 Dec 2004

Re: before_create trigger problems
Emile Aben 18:35 on 21 Dec 2004

Re: before_create trigger problems
Charles Bailey 19:01 on 21 Dec 2004

Re: before_create trigger problems
Emile Aben 19:28 on 21 Dec 2004

Re: before_create trigger problems
Charles Bailey 15:56 on 22 Dec 2004

Re: before_create trigger problems
Emile Aben 17:24 on 22 Dec 2004

Generated at 12:15 on 16 Jan 2005 by mariachi v0.52