Mercurial > pub > Impl
diff lib/IMPL/lang.pm @ 412:30e8c6a74937 ref20150831
working on di container (role based registrations)
author | cin |
---|---|
date | Mon, 21 Sep 2015 19:54:10 +0300 |
parents | f7eeafbd33da |
children | bbc4739c4d48 |
line wrap: on
line diff
--- a/lib/IMPL/lang.pm Mon Sep 21 00:53:10 2015 +0300 +++ b/lib/IMPL/lang.pm Mon Sep 21 19:54:10 2015 +0300 @@ -17,6 +17,8 @@ &clone &isclass &typeof + &ishash + &isarray ) ], @@ -65,7 +67,7 @@ use IMPL::Const qw(:all); -sub is($$) { +sub is { carp "A typename can't be undefined" unless $_[1]; blessed($_[0]) and $_[0]->isa( $_[1] ); } @@ -77,8 +79,15 @@ } sub typeof(*) { - local $@; - eval { $_[0]->_typeof } || blessed($_[0]) || ref($_[0]); + blessed($_[0]); +} + +sub isarray { + not blessed($_[0]) and ref $_[0] eq 'ARRAY'; +} + +sub ishash { + not blessed($_[0]) and ref $_[0] eq 'HASH'; } sub public($) {