diff Lib/IMPL/require.pm @ 230:6d8092d8ce1b

*reworked IMPL::Security *reworked IMPL::Web::Security *refactoring
author sergey
date Mon, 08 Oct 2012 03:37:37 +0400
parents 891c04080658
children b8c724f6de36
line wrap: on
line diff
--- a/Lib/IMPL/require.pm	Sat Sep 29 02:34:47 2012 +0400
+++ b/Lib/IMPL/require.pm	Mon Oct 08 03:37:37 2012 +0400
@@ -1,6 +1,7 @@
 package IMPL::require;
 use Scalar::Util qw(set_prototype);
 use strict;
+require IMPL::Code::Loader;
 
 sub import {
 	my ($self, $aliases) = @_;
@@ -14,8 +15,7 @@
 	no strict 'refs';
 	
 	while( my ($alias, $class) = each %$aliases ) {
-		(my $file = $class) =~ s/::|'/\//g;
-		require "$file.pm";
+	    _require($class);
 		
 		*{"${caller}::$alias"} = set_prototype(sub {
             $class
@@ -23,6 +23,16 @@
 	}
 }
 
+sub _require {
+    my ($class) = @_;
+
+    if ( not $class =~ s/^-// ) {
+        ( my $file = $class ) =~ s/::|'/\//g;
+        require "$file.pm";
+    }
+    $class;
+}
+
 1;
 
 __END__