annotate Lib/IMPL/Object/AutoDispose.pm @ 337:f4e14f32cf54

fixed bugs with string and local $_ added support for localized labels
author cin
date Fri, 14 Jun 2013 15:37:34 +0400
parents 6253872024a4
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
274
8d36073411b1 +Added AutoDispose class
cin
parents:
diff changeset
1 package IMPL::Object::AutoDispose;
8d36073411b1 +Added AutoDispose class
cin
parents:
diff changeset
2 use strict;
8d36073411b1 +Added AutoDispose class
cin
parents:
diff changeset
3
8d36073411b1 +Added AutoDispose class
cin
parents:
diff changeset
4 sub new {
8d36073411b1 +Added AutoDispose class
cin
parents:
diff changeset
5 my $self = shift;
8d36073411b1 +Added AutoDispose class
cin
parents:
diff changeset
6
8d36073411b1 +Added AutoDispose class
cin
parents:
diff changeset
7 if (ref $self) {
8d36073411b1 +Added AutoDispose class
cin
parents:
diff changeset
8 return ${$self}->new(@_);
8d36073411b1 +Added AutoDispose class
cin
parents:
diff changeset
9 } else {
8d36073411b1 +Added AutoDispose class
cin
parents:
diff changeset
10 my $obj = shift;
8d36073411b1 +Added AutoDispose class
cin
parents:
diff changeset
11 return bless \$obj, $self;
8d36073411b1 +Added AutoDispose class
cin
parents:
diff changeset
12 }
8d36073411b1 +Added AutoDispose class
cin
parents:
diff changeset
13 }
8d36073411b1 +Added AutoDispose class
cin
parents:
diff changeset
14
8d36073411b1 +Added AutoDispose class
cin
parents:
diff changeset
15 sub isa {
8d36073411b1 +Added AutoDispose class
cin
parents:
diff changeset
16 ${shift(@_)}->isa(@_);
8d36073411b1 +Added AutoDispose class
cin
parents:
diff changeset
17 }
8d36073411b1 +Added AutoDispose class
cin
parents:
diff changeset
18
8d36073411b1 +Added AutoDispose class
cin
parents:
diff changeset
19 sub can {
8d36073411b1 +Added AutoDispose class
cin
parents:
diff changeset
20 ${shift(@_)}->can(@_);
8d36073411b1 +Added AutoDispose class
cin
parents:
diff changeset
21 }
8d36073411b1 +Added AutoDispose class
cin
parents:
diff changeset
22
275
6253872024a4 *refactoring IMPL::Class
cin
parents: 274
diff changeset
23 sub DESTROY {
274
8d36073411b1 +Added AutoDispose class
cin
parents:
diff changeset
24 ${shift(@_)}->Dispose();
8d36073411b1 +Added AutoDispose class
cin
parents:
diff changeset
25 }
8d36073411b1 +Added AutoDispose class
cin
parents:
diff changeset
26
8d36073411b1 +Added AutoDispose class
cin
parents:
diff changeset
27 sub AUTOLOAD {
8d36073411b1 +Added AutoDispose class
cin
parents:
diff changeset
28 our $AUTOLOAD;
8d36073411b1 +Added AutoDispose class
cin
parents:
diff changeset
29 my ($method) = ($AUTOLOAD =~ m/(\w+)$/);
8d36073411b1 +Added AutoDispose class
cin
parents:
diff changeset
30
8d36073411b1 +Added AutoDispose class
cin
parents:
diff changeset
31 no strict 'refs';
8d36073411b1 +Added AutoDispose class
cin
parents:
diff changeset
32
8d36073411b1 +Added AutoDispose class
cin
parents:
diff changeset
33 goto &{*{$AUTOLOAD} = sub {
8d36073411b1 +Added AutoDispose class
cin
parents:
diff changeset
34 ${shift(@_)}->$method(@_);
8d36073411b1 +Added AutoDispose class
cin
parents:
diff changeset
35 }};
8d36073411b1 +Added AutoDispose class
cin
parents:
diff changeset
36 }
8d36073411b1 +Added AutoDispose class
cin
parents:
diff changeset
37
8d36073411b1 +Added AutoDispose class
cin
parents:
diff changeset
38 1;