Filename | /usr/share/perl5/Lingua/Stem/AutoLoader.pm |
Statements | Executed 45 statements in 687µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
10 | 1 | 1 | 34µs | 34µs | CORE:subst (opcode) | Lingua::Stem::AutoLoader::
1 | 1 | 1 | 29µs | 36µs | BEGIN@43 | Lingua::Stem::AutoLoader::
1 | 1 | 1 | 19µs | 103µs | BEGIN@44 | Lingua::Stem::AutoLoader::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Lingua::Stem::AutoLoader; | ||||
2 | |||||
3 | # $RCSfile: AutoLoader.pm,v $ $Revision: 1.2 $ $Date: 1999/06/17 21:59:24 $ $Author: snowhare $ | ||||
4 | |||||
5 | =head1 NAME | ||||
6 | |||||
- - | |||||
43 | 3 | 69µs | 2 | 43µs | # spent 36µs (29+7) within Lingua::Stem::AutoLoader::BEGIN@43 which was called:
# once (29µs+7µs) by Lingua::Stem::BEGIN@7 at line 43 # spent 36µs making 1 call to Lingua::Stem::AutoLoader::BEGIN@43
# spent 7µs making 1 call to strict::import |
44 | 3 | 275µs | 2 | 187µs | # spent 103µs (19+84) within Lingua::Stem::AutoLoader::BEGIN@44 which was called:
# once (19µs+84µs) by Lingua::Stem::BEGIN@7 at line 44 # spent 103µs making 1 call to Lingua::Stem::AutoLoader::BEGIN@44
# spent 84µs making 1 call to vars::import |
45 | |||||
46 | 1 | 2µs | $VERSION = "1.02"; | ||
47 | |||||
48 | 1 | 1µs | my $_autoloaded_functions = {}; | ||
49 | |||||
50 | 1 | 4µs | my @packageslist = ( | ||
51 | 'Lingua::Stem::De', | ||||
52 | 'Lingua::Stem::En', | ||||
53 | 'Lingua::Stem::Fr', | ||||
54 | 'Lingua::Stem::Da', | ||||
55 | 'Lingua::Stem::Gl', | ||||
56 | 'Lingua::Stem::It', | ||||
57 | 'Lingua::Stem::No', | ||||
58 | 'Lingua::Stem::Pt', | ||||
59 | 'Lingua::Stem::Sv', | ||||
60 | 'Lingua::Stem::EnBroken', | ||||
61 | ); | ||||
62 | |||||
63 | 1 | 600ns | my $autoloader =<<'EOF'; | ||
64 | package ----packagename----; | ||||
65 | use vars qw($AUTOLOAD); | ||||
66 | sub AUTOLOAD { | ||||
67 | return if ($AUTOLOAD =~ m/::(END|DESTROY)$/o); | ||||
68 | if (exists $_autoloaded_functions->{$AUTOLOAD}) { | ||||
69 | die("Attempted to autoload function '$AUTOLOAD' more than once - does it exist?\n"); | ||||
70 | } | ||||
71 | $_autoloaded_functions->{$AUTOLOAD} = 1; | ||||
72 | my ($packagename) = $AUTOLOAD =~ m/^(.*)::[A-Z_][A-Z0-9_]*$/ois; | ||||
73 | eval ("use $packagename;"); | ||||
74 | if ($@ ne '') { | ||||
75 | die ("Unable to use packagename: $@\n"); | ||||
76 | } | ||||
77 | goto &$AUTOLOAD; | ||||
78 | } | ||||
79 | |||||
80 | EOF | ||||
81 | |||||
82 | 1 | 400ns | my $fullload = ''; | ||
83 | 1 | 2µs | foreach my $packagename (@packageslist) { | ||
84 | 10 | 8µs | my ($loader) = $autoloader; | ||
85 | 10 | 115µs | 10 | 34µs | $loader =~ s/(----packagename----)/$packagename/; # spent 34µs making 10 calls to Lingua::Stem::AutoLoader::CORE:subst, avg 3µs/call |
86 | 10 | 30µs | $fullload .= $loader; | ||
87 | } | ||||
88 | 1 | 160µs | eval $fullload; # spent 2.61ms executing statements in string eval # includes 177µs spent executing 10 calls to 20 subs defined therein. | ||
89 | 1 | 1µs | if ($@ ne '') { | ||
90 | die ("Failed to initialize AUTOLOAD: $@\n"); | ||||
91 | } | ||||
92 | |||||
93 | =head1 COPYRIGHT | ||||
94 | |||||
- - | |||||
109 | 1 | 17µs | 1; | ||
# spent 34µs within Lingua::Stem::AutoLoader::CORE:subst which was called 10 times, avg 3µs/call:
# 10 times (34µs+0s) by Lingua::Stem::BEGIN@7 at line 85, avg 3µs/call |