Mercurial > pub > Impl
comparison Lib/IMPL/lang.pm @ 371:d5c8b955bf8d
refactoring
author | cin |
---|---|
date | Fri, 13 Dec 2013 16:49:47 +0400 |
parents | 77df11605d3a |
children |
comparison
equal
deleted
inserted
replaced
370:cbf4febf0930 | 371:d5c8b955bf8d |
---|---|
64 | 64 |
65 use IMPL::Const qw(:all); | 65 use IMPL::Const qw(:all); |
66 | 66 |
67 sub is($$) { | 67 sub is($$) { |
68 carp "A typename can't be undefined" unless $_[1]; | 68 carp "A typename can't be undefined" unless $_[1]; |
69 eval {ref $_[0] and $_[0]->isa( $_[1] ) }; | 69 blessed($_[0]) and $_[0]->isa( $_[1] ); |
70 } | 70 } |
71 | 71 |
72 sub isclass { | 72 sub isclass { |
73 carp "A typename can't be undefined" unless $_[1]; | 73 carp "A typename can't be undefined" unless $_[1]; |
74 local $@; | |
74 eval {not ref $_[0] and $_[0]->isa( $_[1] ) }; | 75 eval {not ref $_[0] and $_[0]->isa( $_[1] ) }; |
75 } | 76 } |
76 | 77 |
77 sub typeof(*) { | 78 sub typeof(*) { |
79 local $@; | |
78 eval { $_[0]->_typeof } || blessed($_[0]) || ref($_[0]); | 80 eval { $_[0]->_typeof } || blessed($_[0]) || ref($_[0]); |
79 } | 81 } |
80 | 82 |
81 sub public($) { | 83 sub public($) { |
82 my $info = shift; | 84 my $info = shift; |