annotate Lib/IMPL/base.pm @ 145:bd10093bb122

Minor changes
author wizard
date Wed, 21 Jul 2010 06:27:12 +0400
parents 44977efed303
children e6447ad85cb4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
134
44977efed303 Significant performance optimizations
wizard
parents:
diff changeset
1 package IMPL::base;
44977efed303 Significant performance optimizations
wizard
parents:
diff changeset
2 use strict;
44977efed303 Significant performance optimizations
wizard
parents:
diff changeset
3
44977efed303 Significant performance optimizations
wizard
parents:
diff changeset
4 my %loaded;
44977efed303 Significant performance optimizations
wizard
parents:
diff changeset
5
44977efed303 Significant performance optimizations
wizard
parents:
diff changeset
6 sub import {
44977efed303 Significant performance optimizations
wizard
parents:
diff changeset
7 shift;
44977efed303 Significant performance optimizations
wizard
parents:
diff changeset
8
44977efed303 Significant performance optimizations
wizard
parents:
diff changeset
9 no strict 'refs';
44977efed303 Significant performance optimizations
wizard
parents:
diff changeset
10 my $class = caller;
44977efed303 Significant performance optimizations
wizard
parents:
diff changeset
11
44977efed303 Significant performance optimizations
wizard
parents:
diff changeset
12 foreach my $baseClass (@_) {
44977efed303 Significant performance optimizations
wizard
parents:
diff changeset
13 unless ($loaded{$baseClass}) {
44977efed303 Significant performance optimizations
wizard
parents:
diff changeset
14 undef $!;
44977efed303 Significant performance optimizations
wizard
parents:
diff changeset
15 undef $@;
44977efed303 Significant performance optimizations
wizard
parents:
diff changeset
16 $loaded{$baseClass} = 1;
44977efed303 Significant performance optimizations
wizard
parents:
diff changeset
17 eval "require $baseClass;";
44977efed303 Significant performance optimizations
wizard
parents:
diff changeset
18
44977efed303 Significant performance optimizations
wizard
parents:
diff changeset
19 die $@ if $@ and not $!;
44977efed303 Significant performance optimizations
wizard
parents:
diff changeset
20 }
44977efed303 Significant performance optimizations
wizard
parents:
diff changeset
21
44977efed303 Significant performance optimizations
wizard
parents:
diff changeset
22 #TODO debug warn if base class is empty;
44977efed303 Significant performance optimizations
wizard
parents:
diff changeset
23
44977efed303 Significant performance optimizations
wizard
parents:
diff changeset
24 push @{"${class}::ISA"}, $baseClass;
44977efed303 Significant performance optimizations
wizard
parents:
diff changeset
25 }
44977efed303 Significant performance optimizations
wizard
parents:
diff changeset
26 }
44977efed303 Significant performance optimizations
wizard
parents:
diff changeset
27
44977efed303 Significant performance optimizations
wizard
parents:
diff changeset
28 1;
44977efed303 Significant performance optimizations
wizard
parents:
diff changeset
29
44977efed303 Significant performance optimizations
wizard
parents:
diff changeset
30 __END__
44977efed303 Significant performance optimizations
wizard
parents:
diff changeset
31
44977efed303 Significant performance optimizations
wizard
parents:
diff changeset
32 =pod
44977efed303 Significant performance optimizations
wizard
parents:
diff changeset
33
44977efed303 Significant performance optimizations
wizard
parents:
diff changeset
34 =head1 NAME
44977efed303 Significant performance optimizations
wizard
parents:
diff changeset
35
44977efed303 Significant performance optimizations
wizard
parents:
diff changeset
36 C<IMPL::base> быстрая версия директивы C<base>.
44977efed303 Significant performance optimizations
wizard
parents:
diff changeset
37
44977efed303 Significant performance optimizations
wizard
parents:
diff changeset
38 =cut