File Coverage

blib/lib/Lingua/Stem/AutoLoader.pm
Criterion Covered Total %
statement 126 153 82.3
branch 27 60 45.0
condition n/a
subroutine 30 31 96.7
pod n/a
total 183 244 75.0


line stmt bran cond sub pod time code
1             package Lingua::Stem::AutoLoader;
2              
3             =head1 NAME
4              
5             Lingua::Stem::AutoLoader - A manager for autoloading Lingua::Stem modules
6              
7             =head1 SYNOPSIS
8              
9             use Lingua::Stem::AutoLoader;
10              
11             =head1 DESCRIPTION
12              
13             Sets up the autoloader to load the modules in the Lingua::Stem system on demand.
14              
15             Lingua::Stem::Da - Danish
16             Lingua::Stem::De - German
17             Lingua::Stem::En - English
18             Lingua::Stem::Fr - French
19             Lingua::Stem::Gl - Galician
20             Lingua::Stem::It - Italian
21             Lingua::Stem::No - Norwegian
22             Lingua::Stem::Ru - Rusian
23             Lingua::Stem::Pt - Portuguese
24             Lingua::Stem::Sv - Swedish
25              
26             =head1 CHANGES
27              
28             2.30 2020.06.20 - Version renumber for module consistency
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   13 use strict;
  2         5  
  2         57  
44 2     2   9 use warnings;
  2         4  
  2         84  
45              
46 2     2   12 use vars qw($VERSION $AUTOLOAD);
  2         4  
  2         461  
47              
48             $VERSION = "2.30";
49              
50             my $_autoloaded_functions = {};
51              
52             my @packageslist = (
53             'Lingua::Stem::De',
54             'Lingua::Stem::En',
55             'Lingua::Stem::Fr',
56             'Lingua::Stem::Da',
57             'Lingua::Stem::Gl',
58             'Lingua::Stem::It',
59             'Lingua::Stem::No',
60             'Lingua::Stem::Pt',
61             'Lingua::Stem::Sv',
62             'Lingua::Stem::EnBroken',
63             );
64              
65             my $autoloader =<<'EOF';
66             package ----packagename----;
67             use vars qw($AUTOLOAD);
68             sub AUTOLOAD {
69             return if ($AUTOLOAD =~ m/::(END|DESTROY)$/o);
70             if (exists $_autoloaded_functions->{$AUTOLOAD}) {
71             die("Attempted to autoload function '$AUTOLOAD' more than once - does it exist?\n");
72             }
73             $_autoloaded_functions->{$AUTOLOAD} = 1;
74             my ($packagename) = $AUTOLOAD =~ m/^(.*)::[A-Z_][A-Z0-9_]*$/ois;
75             eval ("use $packagename;");
76             if ($@ ne '') {
77             die ("Unable to use packagename: $@\n");
78             }
79             goto &$AUTOLOAD;
80             }
81              
82             EOF
83              
84             my $fullload = '';
85             foreach my $packagename (@packageslist) {
86             my ($loader) = $autoloader;
87             $loader =~ s/(----packagename----)/$packagename/;
88             $fullload .= $loader;
89             }
90 2 50   2   14 eval $fullload;
  2 50   2   10  
  2 50   2   528  
  2 50   2   14  
  2 50   2   4  
  2 50   2   469  
  2 50   2   15  
  2 50   2   5  
  2 50   2   497  
  2 50   2   15  
  2 50   2   5  
  2 50   1   481  
  2 50   1   16  
  2 50   1   6  
  2 50   1   473  
  2 50   1   15  
  2 50   1   4  
  2 50   1   513  
  2 50   1   15  
  2 50   1   4  
  2 50   1   503  
  2 50   1   16  
  2 50   1   3  
  2 50   1   441  
  2 50   1   24  
  2 50   1   4  
  2 50   1   475  
  2 0   0   17  
  2 0       4  
  2 0       418  
  2         970  
  2         7  
  2         106  
  1         447  
  1         3  
  1         47  
  1         494  
  1         3  
  1         47  
  1         584  
  1         2970  
  1         52  
  1         441  
  1         3  
  1         60  
  1         495  
  1         3  
  1         47  
  1         457  
  1         3  
  1         49  
  1         449  
  1         3  
  1         50  
  1         8  
  1         4  
  0         0  
  1         3  
  1         6  
  1         101  
  1         6  
  0         0  
  1         8  
  1         8  
  1         4  
  0         0  
  1         5  
  1         6  
  1         75  
  1         7  
  0         0  
  1         5  
  1         10  
  1         4  
  0         0  
  1         3  
  1         6  
  1         78  
  1         6  
  0         0  
  1         6  
  1         10  
  1         5  
  0         0  
  1         3  
  1         6  
  1         86  
  1         7  
  0         0  
  1         6  
  1         10  
  1         5  
  0         0  
  1         3  
  1         6  
  1         72  
  1         7  
  0         0  
  1         12  
  1         10  
  1         5  
  0         0  
  1         3  
  1         7  
  1         89  
  1         7  
  0         0  
  1         7  
  1         9  
  1         5  
  0         0  
  1         3  
  1         6  
  1         73  
  1         6  
  0         0  
  1         5  
  1         8  
  1         4  
  0         0  
  1         3  
  1         6  
  1         55  
  1         6  
  0         0  
  1         6  
  1         12  
  1         4  
  0         0  
  1         2  
  1         6  
  1         75  
  1         6  
  0         0  
  1         7  
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
91             if ($@ ne '') {
92             die ("Failed to initialize AUTOLOAD: $@\n");
93             }
94              
95             =head1 COPYRIGHT
96              
97             Copyright 1999, Jerilyn Franz and
98             FreeRun Technologies, Inc. (). All Rights Reserved.
99             This software may be copied or redistributed under the same terms as Perl itelf.
100              
101             =head1 AUTHOR
102              
103             Jerilyn Franz
104              
105             =head1 TODO
106              
107             Nothing.
108              
109             =cut
110              
111             1;