comparison Lib/IMPL/Code/Loader.pm @ 194:4d0e1962161c

Replaced tabs with spaces IMPL::Web::View - fixed document model, new features (control classes, document constructor parameters)
author cin
date Tue, 10 Apr 2012 20:08:29 +0400
parents 76515373dac0
children a8db61d0ed33
comparison
equal deleted inserted replaced
193:8e8401c0aea4 194:4d0e1962161c
3 use warnings; 3 use warnings;
4 4
5 my %packages; 5 my %packages;
6 6
7 sub Provide { 7 sub Provide {
8 my ($self,$package) = @_; 8 my ($self,$package) = @_;
9 9
10 my ($declaringPackage,$file) = caller(); 10 my ($declaringPackage,$file) = caller();
11 $packages{$package} = { declaringPackage => $declaringPackage, file => $file, evidence => 'provide' }; 11 $packages{$package} = { declaringPackage => $declaringPackage, file => $file, evidence => 'provide' };
12 } 12 }
13 13
14 sub Require { 14 sub Require {
15 my ($self,$package) = @_; 15 my ($self,$package) = @_;
16 16
17 return 1 if $packages{$package}; 17 return 1 if $packages{$package};
18 18
19 if (my $file = $INC{$package}) { 19 if (my $file = $INC{$package}) {
20 $packages{$package} = { file => $file, evidence => 'inc' }; 20 $packages{$package} = { file => $file, evidence => 'inc' };
21 return 1; 21 return 1;
22 } 22 }
23 23
24 undef $@; 24 undef $@;
25 25
26 if ( eval "require $package; 1;" and not $packages{$package}) { 26 if ( eval "require $package; 1;" and not $packages{$package}) {
27 $packages{$package} = { file => $INC{$package}, evidence => 'inc' }; 27 $packages{$package} = { file => $INC{$package}, evidence => 'inc' };
28 }; 28 };
29 29
30 die $@ if $@ and not $!; 30 die $@ if $@ and not $!;
31 } 31 }
32 32
33 1; 33 1;
34 34