Mercurial > pub > Impl
diff 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 |
line wrap: on
line diff
--- a/Lib/IMPL/lang.pm Tue Jan 29 17:19:10 2013 +0400 +++ b/Lib/IMPL/lang.pm Wed Jan 30 03:30:28 2013 +0400 @@ -5,16 +5,18 @@ use parent qw(Exporter); use IMPL::_core::version; use IMPL::clone qw(clone); +use Scalar::Util qw(blessed); require IMPL::Class::PropertyInfo; -our @EXPORT = qw(&is &isclass); +our @EXPORT = qw(&is &isclass &typeof); our %EXPORT_TAGS = ( base => [ qw( &is &clone &isclass + &typeof ) ], @@ -70,6 +72,10 @@ eval {not ref $_[0] and $_[0]->isa( $_[1] ) }; } +sub typeof(*) { + eval { $_[0]->typeof } || blessed($_[0]); +} + sub virtual($) { $_[0]->Virtual(1); $_[0];