Filename | /usr/share/perl5/Lingua/Stem/AutoLoader.pm |
Statements | Executed 45 statements in 550µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 24µs | 31µs | BEGIN@43 | Lingua::Stem::AutoLoader::
1 | 1 | 1 | 18µs | 74µs | BEGIN@44 | Lingua::Stem::AutoLoader::
10 | 1 | 1 | 18µs | 18µs | CORE:subst (opcode) | 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 | 92µs | 2 | 38µs | # spent 31µs (24+7) within Lingua::Stem::AutoLoader::BEGIN@43 which was called:
# once (24µs+7µs) by Lingua::Stem::BEGIN@7 at line 43 # spent 31µs making 1 call to Lingua::Stem::AutoLoader::BEGIN@43
# spent 7µs making 1 call to strict::import |
44 | 3 | 248µs | 2 | 130µs | # spent 74µs (18+56) within Lingua::Stem::AutoLoader::BEGIN@44 which was called:
# once (18µs+56µs) by Lingua::Stem::BEGIN@7 at line 44 # spent 74µs making 1 call to Lingua::Stem::AutoLoader::BEGIN@44
# spent 56µs making 1 call to vars::import |
45 | |||||
46 | 1 | 1µs | $VERSION = "1.02"; | ||
47 | |||||
48 | 1 | 1µs | my $_autoloaded_functions = {}; | ||
49 | |||||
50 | 1 | 3µ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 | 800ns | 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 | 4µs | my ($loader) = $autoloader; | ||
85 | 10 | 44µs | 10 | 18µs | $loader =~ s/(----packagename----)/$packagename/; # spent 18µs making 10 calls to Lingua::Stem::AutoLoader::CORE:subst, avg 2µs/call |
86 | 10 | 15µs | $fullload .= $loader; | ||
87 | } | ||||
88 | 1 | 113µs | eval $fullload; # spent 1.83ms executing statements in string eval # includes 131µ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 | 25µs | 1; | ||
# spent 18µs within Lingua::Stem::AutoLoader::CORE:subst which was called 10 times, avg 2µs/call:
# 10 times (18µs+0s) by Lingua::Stem::BEGIN@7 at line 85, avg 2µs/call |