Mercurial > pub > Impl
view Lib/IMPL/Object/Disposable.pm @ 197:6b1dda998839
Added IMPL::declare, IMPL::require, to simplify module definitions
IMPL::Transform now admires object inheritance while searching for the transformation
Added HTTP some exceptions
IMPL::Web::Application::RestResource almost implemented
author | sergey |
---|---|
date | Thu, 19 Apr 2012 02:10:02 +0400 |
parents | 16ada169ca75 |
children | ad93c9f4dd93 |
line wrap: on
line source
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;