File Coverage

blib/lib/Lingua/Stem/AutoLoader.pm
Criterion Covered Total %
statement 116 150 77.3
branch 24 60 40.0
condition n/a
subroutine 28 30 93.3
pod n/a
total 168 240 70.0


line stmt bran cond sub pod time 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              
7             Lingua::Stem::AutoLoader - A manager for autoloading Lingua::Stem modules
8              
9             =head1 SYNOPSIS
10              
11             use Lingua::Stem::AutoLoader;
12              
13             =head1 DESCRIPTION
14              
15             Sets up the autoloader to load the modules in the Lingua::Stem system on demand.
16              
17             Lingua::Stem::Da - Danish
18             Lingua::Stem::De - German
19             Lingua::Stem::En - English
20             Lingua::Stem::Fr - French
21             Lingua::Stem::Gl - Galician
22             Lingua::Stem::It - Italian
23             Lingua::Stem::No - Norwegian
24             Lingua::Stem::Ru - Rusian
25             Lingua::Stem::Pt - Portuguese
26             Lingua::Stem::Sv - Swedish
27              
28             =head1 CHANGES
29              
30             1.03 2004.07.25 - Added 'Lingua::Stem::Ru'
31              
32             1.02 2004.04.26 - Added 'Lingua::Stem::Fr'
33              
34             1.01 2003.04.05 - Added 'Lingua::Stem::De', 'Lingua::Stem::Da',
35             'Lingua::Stem::Gl', 'Lingua::Stem::It',
36             'Lingua::Stem::No', 'Lingua::Stem::Pt',
37             'Lingua::Stem::Sv',
38              
39             to the list of autoloaded modules.
40              
41             =cut
42              
43 2     2   9 use strict;
  2         3  
  2         68  
44 2     2   13 use vars qw($VERSION $AUTOLOAD);
  2         3  
  2         1617  
45              
46             $VERSION = "1.02";
47              
48             my $_autoloaded_functions = {};
49              
50             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             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             my $fullload = '';
83             foreach my $packagename (@packageslist) {
84             my ($loader) = $autoloader;
85             $loader =~ s/(----packagename----)/$packagename/;
86             $fullload .= $loader;
87             }
88 2 50   2   11 eval $fullload;
  2 50   2   4  
  2 50   2   651  
  2 50   2   13  
  2 50   2   4  
  2 50   2   1642  
  2 50   2   13  
  2 50   2   11  
  2 50   2   599  
  2 50   2   19  
  2 50   2   2  
  2 50   1   485  
  2 50   1   11  
  2 50   1   2  
  2 50   1   437  
  2 50   1   8  
  2 50   1   5  
  2 50   1   1617  
  2 50   2   16  
  2 50   1   17  
  2 50   1   595  
  2 0   1   11  
  2 0   1   4  
  2 0   1   500  
  2 0   1   9  
  2 0   0   3  
  2 0   0   1654  
  2 50   1   15  
  2 50       4  
  2 50       723  
  2         2506  
  2         7  
  2         154  
  1         683  
  1         4  
  1         50  
  1         1303  
  1         5  
  1         83  
  1         1964  
  1         5560  
  1         142  
  1         8337  
  1         5  
  1         67  
  1         9368  
  1         5  
  1         56  
  1         547  
  1         6  
  1         58  
  1         709  
  1         3  
  1         47  
  2         18  
  2         8  
  0         0  
  2         5  
  2         15  
  2         190  
  2         549  
  0         0  
  2         16  
  1         9  
  1         3  
  0         0  
  1         3  
  1         6  
  1         53  
  1         8  
  0         0  
  1         52  
  1         10  
  1         4  
  0         0  
  1         4  
  1         8  
  1         112  
  1         7  
  0         0  
  1         7  
  1         8  
  1         7  
  0         0  
  1         3  
  1         7  
  1         174  
  1         8  
  0         0  
  1         10  
  1         10  
  1         4  
  0         0  
  1         4  
  1         6  
  1         65  
  1         7  
  0         0  
  1         7  
  1         55  
  1         5  
  0         0  
  1         3  
  1         8  
  1         196  
  1         9  
  0         0  
  1         8  
  1         42  
  1         7  
  0         0  
  1         3  
  1         9  
  1         4230  
  1         12  
  0         0  
  1         10  
  0         0  
  0         0  
  0         0  
  0         0  
  0         0  
  0         0  
  0         0  
  0         0  
  0         0  
  0         0  
  0         0  
  0         0  
  0         0  
  0         0  
  0         0  
  0         0  
  0         0  
  0         0  
  1         10  
  1         5  
  0         0  
  1         5  
  1         7  
  1         87  
  1         7  
  0         0  
  1         6  
89             if ($@ ne '') {
90             die ("Failed to initialize AUTOLOAD: $@\n");
91             }
92              
93             =head1 COPYRIGHT
94              
95             Copyright 1999, Benjamin Franz () and
96             FreeRun Technologies, Inc. (). All Rights Reserved.
97             This software may be copied or redistributed under the same terms as Perl itelf.
98              
99             =head1 AUTHOR
100              
101             Benjamin Franz
102              
103             =head1 TODO
104              
105             Nothing.
106              
107             =cut
108              
109             1;