Mercurial > pub > Impl
comparison Lib/Deployment/Batch/CustomAction.pm @ 0:03e58a454b20
Создан репозитарий
| author | Sergey |
|---|---|
| date | Tue, 14 Jul 2009 12:54:37 +0400 |
| parents | |
| children | 16ada169ca75 |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:03e58a454b20 |
|---|---|
| 1 use strict; | |
| 2 package Deployment::Batch::CustomAction; | |
| 3 use base qw(Deployment::Batch::Generic); | |
| 4 use Common; | |
| 5 | |
| 6 BEGIN { | |
| 7 DeclareProperty handlerRun => ACCESS_READ; | |
| 8 DeclareProperty handlerRollback => ACCESS_READ; | |
| 9 DeclareProperty Name => ACCESS_READ; | |
| 10 } | |
| 11 | |
| 12 sub CTOR { | |
| 13 my ($this,%args) = @_; | |
| 14 | |
| 15 $this->{$handlerRun} = $args{Run} || sub {}; | |
| 16 $this->{$handlerRollback} = $args{Rollback} || sub {}; | |
| 17 $this->{$Name} = $args{Name} || $this->SUPER::Name(); | |
| 18 } | |
| 19 | |
| 20 sub Run { | |
| 21 my ($this) = @_; | |
| 22 | |
| 23 $this->{$handlerRun}->($this); | |
| 24 } | |
| 25 | |
| 26 sub Rollback { | |
| 27 my ($this) = @_; | |
| 28 | |
| 29 $this->{$handlerRollback}->($this); | |
| 30 } | |
| 31 | |
| 32 1; |
