File Coverage

blib/lib/Date/ManipX/Almanac/Lang/english.pm
Criterion Covered Total %
statement 23 23 100.0
branch n/a
condition n/a
subroutine 9 9 100.0
pod n/a
total 32 32 100.0


line stmt bran cond sub pod time code
1             package Date::ManipX::Almanac::Lang::english;
2              
3 3     3   2811 use 5.010;
  3         11  
4              
5 3     3   18 use strict;
  3         5  
  3         63  
6 3     3   14 use warnings;
  3         6  
  3         127  
7              
8 3     3   534 use parent qw{ Date::ManipX::Almanac::Lang };
  3         288  
  3         18  
9              
10 3     3   158 use Carp;
  3         23  
  3         2790  
11              
12             our $VERSION = '0.001_02';
13              
14             our $LangName = 'English';
15              
16             # See the Date::ManipX::Almanac::Lang POD for __body_data
17             sub __body_data {
18 1     1   4 my ( $self ) = @_;
19 1         9 my @season = $self->__season_to_detail();
20             return [
21 1         50 [ 'Astro::Coord::ECI::Sun' =>
22             qr/ (?: (?: when | at ) \s* )? (?: the \s* )? sun /smxi,
23             qr/ (?: at \s* )? (?: the \s* )? (?:
24             (? beginn? | end ) (?: ing )? (?: \s* of )? \s*
25             (? astronomical | civil | nautical )? \s*
26             (? twilight ) |
27             (? astronomical | civil | nautical )? \s*
28             (? twilight ) \s* (? begin | end ) s? |
29             (? morning | evening ) \s*
30             (? astronomical | civil | nautical )? \s*
31             (? twilight ) |
32             (? local ) \s* (? noon | midnight ) |
33             (? spring | vernal | march | september ) \s*
34             (? equinox ) |
35             (? autumn ) (?: al )? \s* (? equinox ) |
36             (? summer | winter | june | december ) \s*
37             (? solstice )
38             ) /smxi,
39             { # Iterpret (? ... )
40             #
41             # The required data are described in the
42             # Date::ManipX::Almanac::Lang POD, under __body_re().
43             #
44             equinox => [ quarter => {
45             autumn => $season[ 2 ],
46             march => 0,
47             september => 2,
48             spring => $season[ 0 ],
49             vernal => $season[ 0 ],
50             },
51             ],
52             solstice => [ quarter => {
53             december => 3,
54             june => 1,
55             summer => $season[ 1 ],
56             winter => $season[ 3 ],
57             },
58             ],
59             local => [ meridian => {
60             noon => 1,
61             midnight => 0,
62             },
63             ],
64             twilight => [ twilight => {
65             begin => 1,
66             beginn => 1,
67             end => 0,
68             evening => 0,
69             morning => 1,
70             },
71             {
72             astronomical => 'astronomical',
73             civil => 'civil',
74             nautical => 'nautical',
75             },
76             ],
77             },
78             ],
79             [ 'Astro::Coord::ECI::Moon' =>
80             qr/ (?: (?: when | at ) \s* )? (?: the \s* )? moon /smxi,
81             qr/ (?: at \s* )? (?: the \s* )? (?:
82             (? first | last ) \s* \s* quarter (?: \s* moon )? |
83             (? full | new ) (?: \s* moon )?
84             ) /smxi,
85             { # Iterpret (? ... )
86             #
87             # The required data are described in the
88             # Date::ManipX::Almanac::Lang POD, under __body_re().
89             #
90             new => [ quarter => 0 ],
91             first => [ quarter => 1 ],
92             full => [ quarter => 2 ],
93             last => [ quarter => 3 ],
94             }
95             ],
96             # A map {} makes sense in English, but not in any other
97             # language.
98             # NOTE we don't need the Sun here, because ::VSOP87D::Sun is a
99             # subclass of ::Sun.
100             [ 'Astro::Coord::ECI::VSOP87D::Mercury' =>
101             qr/ (?: when \s* )? mercury /smxi ],
102             [ 'Astro::Coord::ECI::VSOP87D::Venus' =>
103             qr/ (?: when \s* )? venus /smxi ],
104             [ 'Astro::Coord::ECI::VSOP87D::Mars' =>
105             qr/ (?: when \s* )? mars /smxi ],
106             [ 'Astro::Coord::ECI::VSOP87D::Jupiter' =>
107             qr/ (?: when \s* )? jupiter /smxi ],
108             [ 'Astro::Coord::ECI::VSOP87D::Saturn' =>
109             qr/ (?: when \s* )? saturn /smxi ],
110             [ 'Astro::Coord::ECI::VSOP87D::Uranus' =>
111             qr/ (?: when \s* )? uranus /smxi ],
112             [ 'Astro::Coord::ECI::VSOP87D::Neptune' =>
113             qr/ (?: when \s* )? neptune /smxi ],
114             ];
115             }
116              
117             # See the Date::ManipX::Almanac::Lang POD for __general_event_re
118             #
119             # Return a regular expression that matches any event that must be paired
120             # with the name of a body. The internal name of the event must be
121             # captured by named capture (? ... )
122             sub __general_event_re {
123 1     1   6 return qr/
124             (?: the \s* )? (? culminat ) (?: es? | ion ) (?: \s* of )? |
125             (?: is \s* )? (?: the \s* )? (? highest ) |
126             (? rise | set ) s? |
127             (?: the \s* )? (? rising ) (?: \s* of )? |
128             (?: the \s* )? (? setting ) (?: \s* of )? |
129             (?: is \s* )? (? up | down )
130             /smxi;
131             }
132              
133             # See the Date::ManipX::Almanac::Lang POD for __general_event_interp
134             #
135             # The interpretation of the events captured in (? ... ) above.
136             sub __general_event_interp {
137 1     1   4 state $rise = [ horizon => 1 ];
138 1         3 state $set = [ horizon => 0 ];
139 1         3 state $highest = [ meridian => 1 ];
140             return [
141             {
142 1         14 culminat => $highest,
143             down => $set,
144             highest => $highest,
145             rise => $rise,
146             rising => $rise,
147             set => $set,
148             setting => $set,
149             up => $rise,
150             },
151             ];
152             }
153              
154             sub __ignore_after_re {
155 1     1   3 return qr< \s* (?: (?: on | at ) \s+ or \s+ )? after >smxi;
156             }
157              
158             1;
159              
160             __END__