annotate Lib/IMPL/Code/MethodCache.pm @ 149:b04e978d6d5a

minor changes
author wizard
date Wed, 18 Aug 2010 03:14:57 +0400
parents c2aa10fbb396
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
147
c2aa10fbb396 Post to dom improved
wizard
parents:
diff changeset
1 package IMPL::Code::MethodCache;
c2aa10fbb396 Post to dom improved
wizard
parents:
diff changeset
2 use strict;
c2aa10fbb396 Post to dom improved
wizard
parents:
diff changeset
3 use IMPL qw(Debug);
c2aa10fbb396 Post to dom improved
wizard
parents:
diff changeset
4
c2aa10fbb396 Post to dom improved
wizard
parents:
diff changeset
5 my %cachedMethods;
c2aa10fbb396 Post to dom improved
wizard
parents:
diff changeset
6
c2aa10fbb396 Post to dom improved
wizard
parents:
diff changeset
7 sub dbgBuildCachedMethod {
c2aa10fbb396 Post to dom improved
wizard
parents:
diff changeset
8 my ($class,$method,$prefix,$mappers)= @_;
c2aa10fbb396 Post to dom improved
wizard
parents:
diff changeset
9
c2aa10fbb396 Post to dom improved
wizard
parents:
diff changeset
10 no strict 'refs';
c2aa10fbb396 Post to dom improved
wizard
parents:
diff changeset
11
c2aa10fbb396 Post to dom improved
wizard
parents:
diff changeset
12 $prefix ||= 'call';
c2aa10fbb396 Post to dom improved
wizard
parents:
diff changeset
13
c2aa10fbb396 Post to dom improved
wizard
parents:
diff changeset
14 my $proxyMethod = "$prefix$method";
c2aa10fbb396 Post to dom improved
wizard
parents:
diff changeset
15
c2aa10fbb396 Post to dom improved
wizard
parents:
diff changeset
16 die new IMPL::Exception("A proxy method already exists") if *{"${class}::$proxyMethod"}{CODE};
c2aa10fbb396 Post to dom improved
wizard
parents:
diff changeset
17
c2aa10fbb396 Post to dom improved
wizard
parents:
diff changeset
18 my @methodCache = cacheMethod($class,$method,$mappers);
c2aa10fbb396 Post to dom improved
wizard
parents:
diff changeset
19
c2aa10fbb396 Post to dom improved
wizard
parents:
diff changeset
20 *{"${class}::$proxyMethod"} = sub {
c2aa10fbb396 Post to dom improved
wizard
parents:
diff changeset
21 $_->(@_) foreach @methodCache;
c2aa10fbb396 Post to dom improved
wizard
parents:
diff changeset
22 }
c2aa10fbb396 Post to dom improved
wizard
parents:
diff changeset
23 }
c2aa10fbb396 Post to dom improved
wizard
parents:
diff changeset
24
c2aa10fbb396 Post to dom improved
wizard
parents:
diff changeset
25 sub cacheMethod {
c2aa10fbb396 Post to dom improved
wizard
parents:
diff changeset
26 my ($class,$method,$mappers) = @_;
c2aa10fbb396 Post to dom improved
wizard
parents:
diff changeset
27 }
c2aa10fbb396 Post to dom improved
wizard
parents:
diff changeset
28
c2aa10fbb396 Post to dom improved
wizard
parents:
diff changeset
29 1;