comparison Lib/IMPL/Code/Loader.pm @ 274:8d36073411b1

+Added AutoDispose class *code cleanups
author cin
date Wed, 30 Jan 2013 03:30:28 +0400
parents 6d8092d8ce1b
children 4ddb27ff4a0b
comparison
equal deleted inserted replaced
273:ad93c9f4dd93 274:8d36073411b1
1 package IMPL::Code::Loader; 1 package IMPL::Code::Loader;
2 use strict; 2 use strict;
3 use warnings; 3 use warnings;
4 4
5 use IMPL::Const qw(:prop); 5 use IMPL::Const qw(:prop);
6 6 use File::Spec;
7 use IMPL::declare { 7 use IMPL::declare {
8 require => { 8 require => {
9 Exception => 'IMPL::Exception', 9 Exception => 'IMPL::Exception',
10 ArgumentException => '-IMPL::InvalidArgumentException' 10 ArgumentException => '-IMPL::InvalidArgumentException'
11 }, 11 },
51 require $file; 51 require $file;
52 52
53 return $package; 53 return $package;
54 } 54 }
55 55
56 sub ModuleExists {
57 my ($this,$package) = @_;
58
59 my $file = join('/', split(/::/,$this->GetFullName($package))) . ".pm";
60
61 -f File::Spec->catfile($_,$file) and return 1 foreach @INC;
62
63 return 0;
64 }
65
56 sub GetFullName { 66 sub GetFullName {
57 my ($this,$package) = @_; 67 my ($this,$package) = @_;
58 68
59 if ($this->verifyNames) { 69 if ($this->verifyNames) {
60 $package =~ m/^([a-zA-Z_0-9]+(?:::[a-zA-Z_0-9]+)*)$/ 70 $package =~ m/^([a-zA-Z_0-9]+(?:::[a-zA-Z_0-9]+)*)$/