Mercurial > pub > Impl
diff Lib/IMPL/Object/Disposable.pm @ 49:16ada169ca75
migrating to the Eclipse IDE
author | wizard@linux-odin.local |
---|---|
date | Fri, 26 Feb 2010 10:49:21 +0300 |
parents | 0004faa276dc |
children | ad93c9f4dd93 |
line wrap: on
line diff
--- a/Lib/IMPL/Object/Disposable.pm Fri Feb 26 01:43:42 2010 +0300 +++ b/Lib/IMPL/Object/Disposable.pm Fri Feb 26 10:49:21 2010 +0300 @@ -1,39 +1,39 @@ -package IMPL::Object::Disposable; -use strict; - -our $Strict = 1; - -sub Dispose { - my ($this) = @_; - - bless $this, 'IMPL::Object::Disposed'; -} - -sub DESTROY { - my ($this) = @_; - - warn sprintf('The object %s were marked as disposable but isn\'t disposed properly', $this->can('ToString') ? $this->ToString() : (ref $this || $this) ); -} - -sub superDispose { - my ($this) = @_; - - my $package = caller; - - no strict 'refs'; - - ($_.'::Dispose')->($this) foreach @{$package.'::ISA'}; -} - -package IMPL::Object::Disposed; -our $AUTOLOAD; -sub AUTOLOAD { - return if $AUTOLOAD eq __PACKAGE__.'::DESTROY'; - die new IMPL::Exception('Object have been disposed',$AUTOLOAD); -} - -sub isDisposed { - 1; -} - -1; +package IMPL::Object::Disposable; +use strict; + +our $Strict = 1; + +sub Dispose { + my ($this) = @_; + + bless $this, 'IMPL::Object::Disposed'; +} + +sub DESTROY { + my ($this) = @_; + + warn sprintf('The object %s were marked as disposable but isn\'t disposed properly', $this->can('ToString') ? $this->ToString() : (ref $this || $this) ); +} + +sub superDispose { + my ($this) = @_; + + my $package = caller; + + no strict 'refs'; + + ($_.'::Dispose')->($this) foreach @{$package.'::ISA'}; +} + +package IMPL::Object::Disposed; +our $AUTOLOAD; +sub AUTOLOAD { + return if $AUTOLOAD eq __PACKAGE__.'::DESTROY'; + die new IMPL::Exception('Object have been disposed',$AUTOLOAD); +} + +sub isDisposed { + 1; +} + +1;