SQL::Translator::Schema::Trigger - SQL::Translator trigger object use SQL::Translator::Schema::Trigger; my $trigger = SQL::Translator::Schema::Trigger->new( name => 'foo', perform_action_when => 'before', # or after database_event => 'insert', # or update, update_on, delete fields => [], # fields if event is "update" on_table => 'foo', # table name action => '...', # text of trigger schema => $schema, # Schema object ); "SQL::Translator::Schema::Trigger" is the trigger object.

new
Object constructor. my $schema = SQL::Translator::Schema::Trigger->new;

perform_action_when
Gets or sets whether the event happens "before" or "after" the "database_event". $trigger->perform_action_when('after');

database_event
Gets or sets the event that triggers the trigger. my $ok = $trigger->database_event('insert');

fields
Gets and set which fields to monitor for "database_event". $view->fields('id'); $view->fields('id', 'name'); $view->fields( 'id, name' ); $view->fields( [ 'id', 'name' ] ); $view->fields( qw[ id name ] ); my @fields = $view->fields;

table
Gets or set the table on which the trigger works, as a SQL::Translator::Schema::Table object. $trigger->table($triggered_table);

on_table
Gets or set the table name on which the trigger works, as a string. $trigger->on_table('foo');

action
Gets or set the actions of the trigger. $trigger->actions( q[ BEGIN select ...; update ...; END ] );

is_valid
Determine whether the trigger is valid or not. my $ok = $trigger->is_valid;

name
Get or set the trigger's name. my $name = $trigger->name('foo');

order
Get or set the trigger's order. my $order = $trigger->order(3);

schema
Get or set the trigger's schema object. $trigger->schema( $schema ); my $schema = $trigger->schema;

equals
Determines if this trigger is the same as another my $isIdentical = $trigger1->equals( $trigger2 ); Ken Y. Clark <kclark@cpan.org>.