Re: [CDBI] How can you temporarily turn off all triggers for a class?
[prev]
[thread]
[next]
[Date index for 2006/01/31]
On Tue, Jan 31, 2006 at 12:42:50PM -0600, Peter Speltz wrote:
> I want to render all the triggers in a class ineffective for the
> duration of a sub routine. Anyone have a good idiom for this? In the
> data migration script, the triggers are getting in the way (creating
> things that already exist and need to be migrated and such).
In your base class
use vars qw/$NO_TRIGGERS/;
sub call_trigger {
return if $NO_TRIGGERS;
return shift->SUPER::call_trigger(@_);
}
local $My::Base::Class::NO_TRIGGERS = 1;
...
--
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/ +
_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi
|
|
Re: [CDBI] How can you temporarily turn off all triggers for a class?
Matt S Trout 19:06 on 31 Jan 2006
|