comparison Lib/IMPL/Object/Disposable.pm @ 328:63709a4e6da0

Security framework refactoring
author cin
date Mon, 03 Jun 2013 03:28:01 +0400
parents ad93c9f4dd93
children
comparison
equal deleted inserted replaced
327:6cb0d4d325d7 328:63709a4e6da0
1 package IMPL::Object::Disposable; 1 package IMPL::Object::Disposable;
2 use strict; 2 use strict;
3 require IMPL::Object::AutoDispose;
3 4
4 our $Strict = 1; 5 our $Strict = 1;
5 6
6 sub Dispose { 7 sub Dispose {
7 my ($this) = @_; 8 my ($this) = @_;
13 my ($this) = @_; 14 my ($this) = @_;
14 15
15 warn sprintf('The object %s were marked as disposable but isn\'t disposed properly', $this->can('ToString') ? $this->ToString() : (ref $this || $this) ); 16 warn sprintf('The object %s were marked as disposable but isn\'t disposed properly', $this->can('ToString') ? $this->ToString() : (ref $this || $this) );
16 } 17 }
17 18
18 sub superDispose { 19 sub AutoPtr {
19 my ($this) = @_; 20 IMPL::Object::AutoDispose->new(shift);
20
21 my $package = caller;
22
23 no strict 'refs';
24
25 ($_.'::Dispose')->($this) foreach @{$package.'::ISA'};
26 } 21 }
27 22
28 package IMPL::Object::Disposed; 23 package IMPL::Object::Disposed;
29 our $AUTOLOAD; 24 our $AUTOLOAD;
30 sub AUTOLOAD { 25 sub AUTOLOAD {