| 274 | 1 package IMPL::Object::AutoDispose; | 
|  | 2 use strict; | 
|  | 3 | 
|  | 4 sub new { | 
|  | 5     my $self = shift; | 
|  | 6 | 
|  | 7     if (ref $self) { | 
|  | 8         return ${$self}->new(@_); | 
|  | 9     } else { | 
|  | 10         my $obj = shift; | 
|  | 11         return bless \$obj, $self; | 
|  | 12     } | 
|  | 13 } | 
|  | 14 | 
|  | 15 sub isa { | 
|  | 16     ${shift(@_)}->isa(@_); | 
|  | 17 } | 
|  | 18 | 
|  | 19 sub can { | 
|  | 20     ${shift(@_)}->can(@_); | 
|  | 21 } | 
|  | 22 | 
| 275 | 23 sub DESTROY { | 
| 274 | 24     ${shift(@_)}->Dispose(); | 
|  | 25 } | 
|  | 26 | 
|  | 27 sub AUTOLOAD { | 
|  | 28     our $AUTOLOAD; | 
|  | 29     my ($method) = ($AUTOLOAD =~ m/(\w+)$/); | 
|  | 30 | 
|  | 31     no strict 'refs'; | 
|  | 32 | 
|  | 33     goto &{*{$AUTOLOAD} = sub { | 
|  | 34         ${shift(@_)}->$method(@_); | 
|  | 35     }}; | 
|  | 36 } | 
|  | 37 | 
|  | 38 1; |