diff lib/IMPL/declare.pm @ 417:3ed0c58e9da3 ref20150831

working on di container, tests
author cin
date Mon, 02 Nov 2015 01:56:53 +0300
parents ee36115f6a34
children b0481c071bea
line wrap: on
line diff
--- a/lib/IMPL/declare.pm	Thu Oct 29 03:50:25 2015 +0300
+++ b/lib/IMPL/declare.pm	Mon Nov 02 01:56:53 2015 +0300
@@ -2,6 +2,7 @@
 use strict;
 
 use Carp qw(carp);
+use IMPL::lang qw( :base );
 use IMPL::Class::PropertyInfo();
 use IMPL::Const qw(:access);
 use IMPL::require();
@@ -16,7 +17,7 @@
 
 	return unless $args;
 
-	die "A hash reference is required" unless ref $args eq 'HASH';
+	die "A hash reference is required" unless ishash($args);
 
 	no strict 'refs';
 	no warnings 'once';
@@ -49,7 +50,7 @@
 	my %ctor;
 	my @isa;
 
-	if ( ref $base eq 'ARRAY' ) {
+	if ( isarray($base) ) {
 		carp "Odd elements number in require"
 		  unless scalar(@$base) % 2 == 0;
 		while ( my ( $class, $mapper ) = splice @$base, 0, 2 ) {
@@ -62,7 +63,7 @@
 			$ctor{$class} = $mapper;
 		}
 	}
-	elsif ( ref $base eq 'HASH' ) {
+	elsif ( ishash($base) ) {
 		while ( my ( $class, $mapper ) = each %$base ) {
 			_trace("parent $class");
 			$IMPL::require::level++;
@@ -77,18 +78,18 @@
 	%{"${caller}::CTOR"} = %ctor;
 	push @{"${caller}::ISA"}, @isa;
 
-	if ( ref( $args->{meta} ) eq 'ARRAY' ) {
+	if ( isarray( $args->{meta} ) ) {
 		$caller->SetMeta($_) foreach @{ $args->{meta} };
 	}
 
 	my $props = $args->{props} || [];
 
-	if ( $props eq 'HASH' ) {
+	if ( ishash($props) ) {
 		$props = [%$props];
 	}
 
 	die "A hash or an array reference is required in the properties list"
-	  unless ref $props eq 'ARRAY';
+	  unless isarray($props);
 
 	carp "Odd elements number in properties declaration of $caller"
 	  unless scalar(@$props) % 2 == 0;