changeset 252:34a3f8668b58

fixed IMPL::require IMPL::declare
author sergey
date Mon, 19 Nov 2012 01:28:58 +0400
parents 9f394b27dccf
children 0a228a35645c
files Lib/IMPL/declare.pm Lib/IMPL/require.pm
diffstat 2 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Lib/IMPL/declare.pm	Fri Nov 16 16:44:16 2012 +0400
+++ b/Lib/IMPL/declare.pm	Mon Nov 19 01:28:58 2012 +0400
@@ -25,6 +25,7 @@
 
 	my $aliases = $args->{require} || {};
 	
+	$IMPL::require::PENDING{$caller} = 1;
 	_trace("declare $caller");
 	$IMPL::require::level++;
 
@@ -106,6 +107,7 @@
 	}
 	
 	$IMPL::require::level--;
+	delete $IMPL::require::PENDING{$caller};
 }
 
 1;
--- a/Lib/IMPL/require.pm	Fri Nov 16 16:44:16 2012 +0400
+++ b/Lib/IMPL/require.pm	Mon Nov 19 01:28:58 2012 +0400
@@ -17,6 +17,8 @@
 	
 	my $caller = caller;
 	
+	$PENDING{$caller} = 1;
+	
 	no strict 'refs';
 	
 	while( my ($alias, $class) = each %$aliases ) {
@@ -31,6 +33,8 @@
         
         $level--;
 	}
+	
+	delete $PENDING{$caller};
 }
 
 sub _require {
@@ -38,7 +42,7 @@
 
     if ( not $class =~ s/^-// ) {
         ( my $file = $class ) =~ s/::|'/\//g;
-        _trace("already pending") and return
+        _trace("already pending") and return $class
             if $PENDING{$class};
         $PENDING{$class} = 1;
         _trace("loading $file.pm");