Mercurial > pub > Impl
comparison Lib/IMPL/lang.pm @ 274:8d36073411b1
+Added AutoDispose class
*code cleanups
author | cin |
---|---|
date | Wed, 30 Jan 2013 03:30:28 +0400 |
parents | 56364d0c4b4f |
children | 6253872024a4 |
comparison
equal
deleted
inserted
replaced
273:ad93c9f4dd93 | 274:8d36073411b1 |
---|---|
3 use warnings; | 3 use warnings; |
4 | 4 |
5 use parent qw(Exporter); | 5 use parent qw(Exporter); |
6 use IMPL::_core::version; | 6 use IMPL::_core::version; |
7 use IMPL::clone qw(clone); | 7 use IMPL::clone qw(clone); |
8 use Scalar::Util qw(blessed); | |
8 | 9 |
9 require IMPL::Class::PropertyInfo; | 10 require IMPL::Class::PropertyInfo; |
10 | 11 |
11 our @EXPORT = qw(&is &isclass); | 12 our @EXPORT = qw(&is &isclass &typeof); |
12 our %EXPORT_TAGS = ( | 13 our %EXPORT_TAGS = ( |
13 base => [ | 14 base => [ |
14 qw( | 15 qw( |
15 &is | 16 &is |
16 &clone | 17 &clone |
17 &isclass | 18 &isclass |
19 &typeof | |
18 ) | 20 ) |
19 ], | 21 ], |
20 | 22 |
21 declare => [ | 23 declare => [ |
22 qw( | 24 qw( |
68 | 70 |
69 sub isclass { | 71 sub isclass { |
70 eval {not ref $_[0] and $_[0]->isa( $_[1] ) }; | 72 eval {not ref $_[0] and $_[0]->isa( $_[1] ) }; |
71 } | 73 } |
72 | 74 |
75 sub typeof(*) { | |
76 eval { $_[0]->typeof } || blessed($_[0]); | |
77 } | |
78 | |
73 sub virtual($) { | 79 sub virtual($) { |
74 $_[0]->Virtual(1); | 80 $_[0]->Virtual(1); |
75 $_[0]; | 81 $_[0]; |
76 } | 82 } |
77 | 83 |