Mercurial > pub > Impl
comparison Lib/IMPL/Object/Disposable.pm @ 273:ad93c9f4dd93
+Added support for destructors, (special method named DTOR)
| author | sergey |
|---|---|
| date | Tue, 29 Jan 2013 17:19:10 +0400 |
| parents | 16ada169ca75 |
| children | 63709a4e6da0 |
comparison
equal
deleted
inserted
replaced
| 272:47db27ed5b43 | 273:ad93c9f4dd93 |
|---|---|
| 7 my ($this) = @_; | 7 my ($this) = @_; |
| 8 | 8 |
| 9 bless $this, 'IMPL::Object::Disposed'; | 9 bless $this, 'IMPL::Object::Disposed'; |
| 10 } | 10 } |
| 11 | 11 |
| 12 sub DESTROY { | 12 sub DTOR { |
| 13 my ($this) = @_; | 13 my ($this) = @_; |
| 14 | 14 |
| 15 warn sprintf('The object %s were marked as disposable but isn\'t disposed properly', $this->can('ToString') ? $this->ToString() : (ref $this || $this) ); | 15 warn sprintf('The object %s were marked as disposable but isn\'t disposed properly', $this->can('ToString') ? $this->ToString() : (ref $this || $this) ); |
| 16 } | 16 } |
| 17 | 17 |
