diff Lib/Deployment/Batch/CustomAction.pm @ 0:03e58a454b20

Создан репозитарий
author Sergey
date Tue, 14 Jul 2009 12:54:37 +0400
parents
children 16ada169ca75
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Lib/Deployment/Batch/CustomAction.pm	Tue Jul 14 12:54:37 2009 +0400
@@ -0,0 +1,32 @@
+use strict;
+package Deployment::Batch::CustomAction;
+use base qw(Deployment::Batch::Generic);
+use Common;
+
+BEGIN {
+    DeclareProperty handlerRun => ACCESS_READ;
+    DeclareProperty handlerRollback => ACCESS_READ;
+    DeclareProperty Name => ACCESS_READ;
+}
+
+sub CTOR {
+    my ($this,%args) = @_;
+
+    $this->{$handlerRun} = $args{Run} || sub {};
+    $this->{$handlerRollback} = $args{Rollback} || sub {};
+    $this->{$Name} = $args{Name} || $this->SUPER::Name();
+}
+
+sub Run {
+    my ($this) = @_;
+
+    $this->{$handlerRun}->($this);
+}
+
+sub Rollback {
+    my ($this) = @_;
+
+    $this->{$handlerRollback}->($this);
+}
+
+1;
\ No newline at end of file