diff Lib/IMPL/Code/Loader.pm @ 230:6d8092d8ce1b

*reworked IMPL::Security *reworked IMPL::Web::Security *refactoring
author sergey
date Mon, 08 Oct 2012 03:37:37 +0400
parents 47f77e6409f7
children 8d36073411b1
line wrap: on
line diff
--- a/Lib/IMPL/Code/Loader.pm	Sat Sep 29 02:34:47 2012 +0400
+++ b/Lib/IMPL/Code/Loader.pm	Mon Oct 08 03:37:37 2012 +0400
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 
-use IMPL::lang qw(:declare :constants);
+use IMPL::Const qw(:prop);
 
 use IMPL::declare {
 	require => {
@@ -12,7 +12,12 @@
 	base => {
 		'IMPL::Object' => undef,
 		'IMPL::Object::Autofill' => '@_'
-	}
+	},
+	props => [
+	   verifyNames => PROP_RO,
+	   prefix => PROP_RO,
+	   _pending => PROP_RW
+	]
 };
 
 my $default;
@@ -25,12 +30,12 @@
 	$safe ||= new IMPL::Code::Loader(verifyNames => 1);
 }
 
-BEGIN {
-	public property verifyNames => PROP_GET | PROP_OWNERSET;
-	public property prefix => PROP_GET | PROP_OWNERSET;
+sub CTOR {
+    my ($this) = @_;
+    
+    $this->_pending({});
 }
 
-
 sub Require {
     my ($this,$package) = @_;
     
@@ -44,6 +49,19 @@
     my $file = join('/', split(/::/,$package)) . ".pm";
     
     require $file;
+        
+    return $package;
+}
+
+sub GetFullName {
+    my ($this,$package) = @_;
+    
+    if ($this->verifyNames) {
+        $package =~ m/^([a-zA-Z_0-9]+(?:::[a-zA-Z_0-9]+)*)$/
+           or die ArgumentException->new(package => 'Invalid package name') ;
+    }
+    
+    return $this->prefix . '::' . $package if $this->prefix;
 }
 
 1;