File Coverage

blib/lib/Lingua/En/Victory.pm
Criterion Covered Total %
statement 22 22 100.0
branch 2 2 100.0
condition n/a
subroutine 7 7 100.0
pod 3 4 75.0
total 34 35 97.1


line stmt bran cond sub pod time code
1             package Lingua::En::Victory;
2              
3 1     1   27591 use 5.008;
  1         3  
  1         40  
4 1     1   6 use strict;
  1         39  
  1         37  
5 1     1   5 use warnings;
  1         6  
  1         541  
6              
7             require Exporter;
8              
9             our @ISA = qw(Exporter);
10              
11             # Items to export into callers namespace by default. Note: do not export
12             # names by default without a very good reason. Use EXPORT_OK instead.
13             # Do not simply export all your public functions/methods/constants.
14              
15             # This allows declaration use Lingua::En::Victory ':all';
16             # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
17             # will save memory.
18             our %EXPORT_TAGS = ( 'all' => [ qw(
19            
20             ) ] );
21              
22             our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
23              
24             our @EXPORT = qw(
25            
26             );
27              
28             our $VERSION = '0.01';
29              
30             our $a = chr(39);
31             our @template;
32              
33             # Preloaded methods go here.
34              
35             sub new {
36              
37 1     1 1 12 my $pkg = shift;
38 1         7 while () {
39 30 100       63 last if /__END__/;
40 29         27 chomp;
41 29         95 push @template, $_;
42             }
43              
44 1         6 bless {}, $pkg;
45              
46             }
47              
48             sub templates {
49 1     1 1 8 \@template;
50             }
51              
52             sub expr {
53 30     30 1 195 my ($self, $template, $W, $L) = @_;
54              
55             # warn "$template, $W, $L";
56 30         61 my $eval = "\$_ = \"$template\"" ;
57             # warn $eval;
58 30         1916 eval $eval;
59             }
60              
61             sub rand_expr {
62 1     1 0 9 my ($self, $W, $L) = @_;
63              
64 1         48 my $template = $template[rand @template];
65 1         5 $self->expr($template, $W, $L);
66             }
67              
68             1;
69             __DATA__