| 1 | package Lingua::En::Victory; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use 5.008; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 1 | require Exporter; | |||||||||
| 8 | |||||||||||
| 9 | 1 | 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 | 1 | our %EXPORT_TAGS = ( 'all' => [ qw( | |||||||||
| 19 | |||||||||||
| 20 | ) ] ); | ||||||||||
| 21 | |||||||||||
| 22 | 1 | our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); | |||||||||
| 23 | |||||||||||
| 24 | 1 | our @EXPORT = qw( | |||||||||
| 25 | |||||||||||
| 26 | ); | ||||||||||
| 27 | |||||||||||
| 28 | 1 | our $VERSION = '0.01'; | |||||||||
| 29 | |||||||||||
| 30 | 1 | our $a = chr(39); | |||||||||
| 31 | 1 | our @template; | |||||||||
| 32 | |||||||||||
| 33 | # Preloaded methods go here. | ||||||||||
| 34 | |||||||||||
| 35 | 1 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 36 | |||||||||||
| 37 | 1 | my $pkg = shift; | |||||||||
| 38 | 1 | ▶ | while (<DATA>) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 39 | 30 | ▶ | last if /__END__/; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 40 | 29 | chomp; | |||||||||
| 41 | 29 | push @template, $_; | |||||||||
| 42 | } | ||||||||||
| 43 | |||||||||||
| 44 | 1 | bless {}, $pkg; | |||||||||
| 45 | |||||||||||
| 46 | } | ||||||||||
| 47 | |||||||||||
| 48 | 1 | ▶ | sub templates { | ||||||||
|
Subroutine
templates: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 49 | 1 | \@template; | |||||||||
| 50 | } | ||||||||||
| 51 | |||||||||||
| 52 | 30 | ▶ | sub expr { | ||||||||
|
Subroutine
expr: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 53 | 30 | my ($self, $template, $W, $L) = @_; | |||||||||
| 54 | |||||||||||
| 55 | # warn "$template, $W, $L"; | ||||||||||
| 56 | 30 | my $eval = "\$_ = \"$template\"" ; | |||||||||
| 57 | # warn $eval; | ||||||||||
| 58 | 30 | eval $eval; | |||||||||
| 59 | } | ||||||||||
| 60 | |||||||||||
| 61 | 1 | ▶ | sub rand_expr { | ||||||||
|
Subroutine
rand_expr: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 62 | 1 | my ($self, $W, $L) = @_; | |||||||||
| 63 | |||||||||||
| 64 | 1 | my $template = $template[rand @template]; | |||||||||
| 65 | 1 | $self->expr($template, $W, $L); | |||||||||
| 66 | } | ||||||||||
| 67 | |||||||||||
| 68 | 1 | 1; | |||||||||
| 69 | __DATA__ | ||||||||||