bin/avemaria

filter: Statementstmt 26.4% 73 / 276 Branchbran 19.5% 29 / 148 Conditioncond 13.5% 10 / 74 MC/DCmcdc 0.0% 0 / 45 Subroutinesub 48.6% 18 / 37 Podpod n/a totaltotal 22.4% 130 / 580 CC 105 SCAR 73.1
CC
105
Cov
22%
PrayTheRosary
3540.0
__ANON__
72.0
_color_enabled
42.0
CRAP 1490.2
↑ Summary blib/lib/Webservice/Rosary/Stream.pm »
1 #!/usr/bin/env perl
2  
3 package local::bin::avemaria;
4  
5 1 ▶use v5.10;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Webservice::Rosary::API qw//;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Webservice::Rosary::Stream qw//;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Webservice::Rosary::Tradition qw/opening_intention/;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use Util::H2O::More qw/ddd Getopt2h2o h2o o2d tr4h2o/;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use Dispatch::Fu;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use Text::Fold qw/fold_text/;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 1 binmode(STDOUT, ":utf8");
16  
17 1 $|++; # autoflush
18  
19 1 our $VERSION = $Webservice::Rosary::API::VERSION;
20  
21 1 ▶use constant {
Subroutine BEGIN: called CC=1 SCAR=0.0
22 1 EXIT_SUCCESS => 0,
23 EXIT_ERROR => 1,
24 1 };
25  
26 1 ▶sub _mystery_heading {
Subroutine _mystery_heading: called CC=1 SCAR=0.0
27 1 my ($day, $group) = @_;
28 1 return uc sprintf q{%s - The %s Mysteries}, ucfirst($day), $group;
29 }
30  
31 0 ▶sub _today_day {
Subroutine _today_day: not called CC=1 SCAR=6.9
32 0 my @days_of_week = qw(Sunday Monday Tuesday Wednesday Thursday Friday Saturday);
33 0 return lc $days_of_week[(localtime())[6]];
34 }
35  
36 3 ▶sub _next_cycle_day {
Subroutine _next_cycle_day: called CC=3 SCAR=11.1
37 3 my ($follow_calendar, $current_day, $today) = @_;
38 3 ▶ $today = _today_day() if not defined $today;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $today 0 3 3
39 3 ▶ return $follow_calendar ? $today : $current_day;
Branch: 1 branch
BranchTrueFalseTotal
$follow_calendar ? : 1 2 3
40 }
41  
42 7 ▶sub _prayer_role {
Subroutine _prayer_role: called CC=7 SCAR=19.7
43 7 ▶ my $prayer = shift // q{};
Condition50%1/2
shift() // ""
l!l
70
MC/DC0%0/1
shift() // ""
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
44 7 ▶ return q{hail_mary} if $prayer =~ m/^hail__mary/;
Branch: 1 branch
BranchTrueFalseTotal
if $prayer =~ /^hail__mary/ 1 6 7
45 6 ▶ return q{our_father} if $prayer =~ m/^our__father/;
Branch: 1 branch
BranchTrueFalseTotal
if $prayer =~ /^our__father/ 1 5 6
46 5 ▶ return q{glory_be} if $prayer =~ m/^glory_be/;
Branch: 1 branch
BranchTrueFalseTotal
if $prayer =~ /^glory_be/ 1 4 5
47 4 ▶ return q{fatima} if $prayer =~ m/^oh_my_jesus/;
Branch: 1 branch
BranchTrueFalseTotal
if $prayer =~ /^oh_my_jesus/ 1 3 4
48 3 ▶ return q{major_prayer} if $prayer =~ m/^(?:i_believe|holy_queen|final_prayer)$/;
Branch: 1 branch
BranchTrueFalseTotal
if $prayer =~ /^(?:i_believe|holy_queen|final_prayer)$/ 3 0 3
49 0 return q{neutral};
50 }
51  
52 3 ▶sub _hail_mary_role {
Subroutine _hail_mary_role: called CC=3 SCAR=11.1
53 3 ▶ my $ordinal = shift // 1;
Condition50%1/2
shift() // 1
l!l
30
MC/DC0%0/1
shift() // 1
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
54 3 ▶ return $ordinal % 2 ? q{hail_mary} : q{hail_mary_alt};
Branch: 1 branch
BranchTrueFalseTotal
$ordinal % 2 ? : 2 1 3
55 }
56  
57 2 ▶sub _format_prayer_text {
Subroutine _format_prayer_text: called CC=4 SCAR=14.0
58 2 my ($prayer, $text) = @_;
59 2 ▶ $prayer //= q{};
Condition50%1/2
$prayer //= ""
l!l
20
MC/DC0%0/1
$prayer //= ""
$prayer
Truth table50%1/2
A
A= $prayer
Aresult
11
00
60 2 ▶ $text //= q{};
Condition50%1/2
$text //= ""
l!l
20
MC/DC0%0/1
$text //= ""
$text
Truth table50%1/2
A
A= $text
Aresult
11
00
61 2 $text =~ s/\\r\\n|\\n/\n/g;
62 2 $text =~ s/Lead/\nLead/; # us to Heaven
63  
64 # The API closing prayer may arrive as one long physical line. Keep it
65 # readable in the same 72-column terminal presentation as meditations.
66 2 ▶ $text = fold_text($text, 72) if $prayer eq q{final_prayer};
Branch: 1 branch
BranchTrueFalseTotal
if $prayer eq "final_prayer" 1 1 2
67  
68 2 return $text;
69 }
70 4 ▶sub _mystery_role {
Subroutine _mystery_role: called CC=7 SCAR=20.7
71 4 my ($group, $bold) = @_;
72 4 ▶ $group = lc($group // q{});
Condition50%1/2
$group // ""
l!l
40
MC/DC0%0/1
$group // ""
$group
Truth table50%1/2
A
A= $group
Aresult
11
00
73 4 ▶ return q{mystery_title} if $bold and $group !~ m/^(?:joyful|sorrowful|glorious|luminous)$/;
Branch: 1 branch
BranchTrueFalseTotal
if $bold and not $group =~ /^(?:joyful|sorrowful|glorious|luminous)$/ 0 4 4
Condition66%2/3
$bold and not $group =~ /^(?:joyful|sorrowful|glorious|luminous)$/
!ll&&!rl&&r
130
MC/DC0%0/2
$bold and not $group =~ /^(?:joyful|sorrowful|glorious|luminous)$/
$bold not $group =~ /^(?:joyful|sorrowful|glorious|luminous)$/
Truth table66%2/3
A and not(B)
A= $boldB= not $group =~ /^(?:joyful|sorrowful|glorious|luminous)$/
ABresult
0X0
100
111
74 4 ▶ return q{mystery} if not $bold and $group !~ m/^(?:joyful|sorrowful|glorious|luminous)$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $bold or $group =~ /^(?:joyful|sorrowful|glorious|luminous)$/ 0 4 4
Condition66%2/3
$bold or $group =~ /^(?:joyful|sorrowful|glorious|luminous)$/
l!l&&r!l&&!r
310
MC/DC0%0/2
$bold or $group =~ /^(?:joyful|sorrowful|glorious|luminous)$/
$bold $group =~ /^(?:joyful|sorrowful|glorious|luminous)$/
Truth table66%2/3
A or B
A= $boldB= $group =~ /^(?:joyful|sorrowful|glorious|luminous)$/
ABresult
1X1
011
000
75 4 ▶ return sprintf q{mystery_%s%s}, $group, ($bold ? q{_title} : q{});
Branch: 1 branch
BranchTrueFalseTotal
$bold ? : 3 1 4
76 }
77  
78 2 ▶sub _color_palette {
Subroutine _color_palette: called CC=3 SCAR=11.0
79 2 ▶ my $profile = shift // q{dark};
Condition50%1/2
shift() // "dark"
l!l
20
MC/DC0%0/1
shift() // "dark"
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
80  
81 # 256-color values are deliberately muted. The dark profile uses soft
82 # pastels; the light profile uses deeper versions of the same color families.
83 2 my %dark = (
84 reset => "\e[0m",
85 mystery => "\e[38;5;153m", # fallback pale blue-white
86 mystery_title => "\e[1;38;5;153m", # fallback bold heading
87 mystery_joyful => "\e[38;5;117m", # light Marian blue
88 mystery_joyful_title => "\e[1;38;5;117m", # bold light Marian blue
89 mystery_sorrowful => "\e[38;5;167m", # muted dark red / maroon
90 mystery_sorrowful_title => "\e[1;38;5;167m", # bold muted dark red
91 mystery_glorious => "\e[38;5;180m", # soft gold / yellow
92 mystery_glorious_title => "\e[1;38;5;180m", # bold soft gold
93 mystery_luminous => "\e[38;5;183m", # tranquil lavender-violet
94 mystery_luminous_title => "\e[1;38;5;183m", # bold lavender-violet
95 hail_mary => "\e[38;5;117m", # Marian blue
96 hail_mary_alt => "\e[38;5;255m", # soft white alternate
97 our_father => "\e[38;5;114m", # soft green
98 major_prayer => "\e[1;38;5;255m", # bold white: Creed and major closing prayers
99 glory_be => "\e[38;5;180m", # warm muted gold
100 fatima => "\e[38;5;183m", # gentle lavender
101 fruit => "\e[38;5;151m", # pale teal-green
102 intention => "\e[38;5;250m", # soft gray
103 meditation => "\e[38;5;252m", # quiet near-white
104 separator => "\e[38;5;242m", # unobtrusive gray
105 neutral => "\e[38;5;252m",
106 );
107  
108 2 my %light = (
109 reset => "\e[0m",
110 mystery => "\e[38;5;24m", # fallback deep calm blue
111 mystery_title => "\e[1;38;5;24m", # fallback bold heading
112 mystery_joyful => "\e[38;5;31m", # deeper Marian blue
113 mystery_joyful_title => "\e[1;38;5;31m", # bold deeper Marian blue
114 mystery_sorrowful => "\e[38;5;88m", # deep maroon
115 mystery_sorrowful_title => "\e[1;38;5;88m", # bold deep maroon
116 mystery_glorious => "\e[38;5;136m", # subdued gold
117 mystery_glorious_title => "\e[1;38;5;136m", # bold subdued gold
118 mystery_luminous => "\e[38;5;97m", # muted violet
119 mystery_luminous_title => "\e[1;38;5;97m", # bold muted violet
120 hail_mary => "\e[38;5;31m", # Marian blue
121 hail_mary_alt => "\e[38;5;236m", # charcoal alternate
122 our_father => "\e[38;5;65m", # muted green
123 major_prayer => "\e[1;38;5;232m", # bold near-black for a light background
124 glory_be => "\e[38;5;136m", # subdued gold
125 fatima => "\e[38;5;97m", # muted violet
126 fruit => "\e[38;5;30m", # restrained teal
127 intention => "\e[38;5;240m", # dark soft gray
128 meditation => "\e[38;5;238m", # charcoal
129 separator => "\e[38;5;250m", # pale gray
130 neutral => "\e[38;5;236m",
131 );
132  
133 2 ▶ return $profile eq q{light} ? \%light : \%dark;
Branch: 1 branch
BranchTrueFalseTotal
$profile eq 'light' ? : 1 1 2
134 }
135  
136 0 ▶sub _color_enabled {
Subroutine _color_enabled: not called CC=6 SCAR=37.4
137 0 my $o = shift;
138 0 ▶ return 0 if not $o->color;
Branch: 1 branch
BranchTrueFalseTotal
unless $o->color 0 0 0
139 0 ▶ return 0 if exists $ENV{NO_COLOR};
Branch: 1 branch
BranchTrueFalseTotal
if exists $ENV{"NO_COLOR"} 0 0 0
140 0 ▶ return 0 if defined $ENV{TERM} and $ENV{TERM} eq q{dumb};
Branch: 1 branch
BranchTrueFalseTotal
if defined $ENV{"TERM"} and $ENV{"TERM"} eq "dumb" 0 0 0
Condition0%0/3
defined $ENV{"TERM"} and $ENV{"TERM"} eq "dumb"
!ll&&!rl&&r
000
MC/DC0%0/2
defined $ENV{"TERM"} and $ENV{"TERM"} eq "dumb"
defined $ENV{"TERM"} $ENV{"TERM"} eq "dumb"
Truth table0%0/3
A and B
A= defined $ENV{"TERM"}B= $ENV{"TERM"} eq "dumb"
ABresult
0X0
100
111
141 0 ▶ return 0 if not -t STDOUT;
Branch: 1 branch
BranchTrueFalseTotal
unless -t STDOUT 0 0 0
142 0 return 1;
143 }
144  
145 0 ▶sub _styled {
Subroutine _styled: not called CC=3 SCAR=24.8
146 0 my ($text, $role, $Palette) = @_;
147 0 ▶ return $text if not $Palette;
Branch: 1 branch
BranchTrueFalseTotal
unless $Palette 0 0 0
148 0 ▶ my $start = $Palette->{$role} // $Palette->{neutral};
Condition0%0/3
$Palette->{$role} // $Palette->{"neutral"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$Palette->{$role} // $Palette->{"neutral"}
$Palette->{$role} $Palette->{"neutral"}
Truth table0%0/3
A // B
A= $Palette->{$role}B= $Palette->{"neutral"}
ABresult
1X1
011
000
149 0 return $start . $text . $Palette->{reset};
150 }
151  
152 0 ▶sub _say_styled {
Subroutine _say_styled: not called CC=1 SCAR=6.9
153 0 my ($text, $role, $Palette) = @_;
154 0 say _styled($text, $role, $Palette);
155 0 return;
156 }
157  
158 0 ▶sub _stream_styled {
Subroutine _stream_styled: not called CC=4 SCAR=30.0
159 0 my ($text, $role, $Stream, $Palette) = @_;
160 0 ▶ print $Palette->{$role} // $Palette->{neutral} if $Palette;
Branch: 1 branch
BranchTrueFalseTotal
if $Palette 0 0 0
Condition0%0/3
$Palette->{$role} // $Palette->{"neutral"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$Palette->{$role} // $Palette->{"neutral"}
$Palette->{$role} $Palette->{"neutral"}
Truth table0%0/3
A // B
A= $Palette->{$role}B= $Palette->{"neutral"}
ABresult
1X1
011
000
161 0 $Stream->stream($text);
162 0 ▶ print $Palette->{reset} if $Palette;
Branch: 1 branch
BranchTrueFalseTotal
if $Palette 0 0 0
163 0 return;
164 }
165  
166 0 ▶sub _separator {
Subroutine _separator: not called CC=1 SCAR=6.9
167 0 my $Palette = shift;
168 0 print _styled(q{-} x 72, q{separator}, $Palette), "\n";
169 0 return;
170 }
171  
172 12 ▶sub _split_command_line {
Subroutine _split_command_line: called CC=4 SCAR=13.9
173 12 my @argv = @_;
174  
175 # No arguments means "pray today's Rosary".
176 12 ▶ return (q{}, \@argv, 1) if not @argv;
Branch: 1 branch
BranchTrueFalseTotal
unless @argv 1 11 12
177  
178 11 my $first = $argv[0];
179  
180 # These are genuine top-level switches rather than prayer options.
181 11 ▶ if ($first =~ m/^(?:-h|--help|-a|--about)$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($first =~ /^(?:-h|--help|-a|--about)$/) 4 7 11
182 4 my $subcommand = shift @argv;
183 4 return ($subcommand, \@argv, 0);
184 }
185  
186 # Any other leading option belongs to the prayer command. Leave it in
187 # @argv for Getopt2h2o and implicitly select today's Mystery.
188 7 ▶ if ($first =~ m/^-/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($first =~ /^-/) 5 2 7
189 5 return (q{}, \@argv, 1);
190 }
191  
192 # Otherwise the first argument is an explicit command/day/Mystery.
193 2 my $subcommand = shift @argv;
194 2 return ($subcommand, \@argv, 0);
195 }
196  
197 0 ▶sub main {
Subroutine main: not called CC=4 SCAR=30.0
198 0 my ($subcommand, $ARGV, $implicit_today) = _split_command_line(@_);
199  
200 # Bare `avemaria`, or prayer options without an explicit day/Mystery,
201 # remain the convenient guided-prayer shortcut for today's Rosary.
202 0 ▶ push @$ARGV, q{--pray} if $implicit_today;
Branch: 1 branch
BranchTrueFalseTotal
if $implicit_today 0 0 0
203  
204 0 my $Rosary = Webservice::Rosary::API->new;
205 0 my $ok = eval {
206 #>>>
207 0 ▶ dispatch { # Dispatch::Fu
Subroutine __ANON__: not called CC=8 SCAR=42.8
208 0 my ($Rosary, $subcommand, $ARGV) = xshift_and_deref @_;
209 0 my @mp3 = qw/today yesterday tomorrow random/;
210 0 my @day = qw/sunday monday tuesday wednesday thursday friday saturday/;
211 0 my @mystery = qw/joyful glorious sorrowful luminous/;
212 0 ▶ return "day" if not $subcommand;
Branch: 1 branch
BranchTrueFalseTotal
unless $subcommand 0 0 0
213 0 ▶ return "mp3" if grep { m/^\Q$subcommand\E$/i } @mp3;
Branch: 1 branch
BranchTrueFalseTotal
if grep {/^\Q$subcommand\E$/i;} @mp3 0 0 0
214 0 ▶ return "day" if grep { m/^\Q$subcommand\E$/i } @day;
Branch: 1 branch
BranchTrueFalseTotal
if grep {/^\Q$subcommand\E$/i;} @day 0 0 0
215 0 ▶ return "mystery" if grep { m/^\Q$subcommand\E$/i } @mystery;
Branch: 1 branch
BranchTrueFalseTotal
if grep {/^\Q$subcommand\E$/i;} @mystery 0 0 0
216 0 ▶ return "about" if grep { m/^\Q$subcommand\E$/i } qw/about -a --about/;
Branch: 1 branch
BranchTrueFalseTotal
if grep {/^\Q$subcommand\E$/i;} "about", "-a", "--about" 0 0 0
217 0 ▶ return "help" if grep { m/^\Q$subcommand\E$/i } qw/-h --help help mystery/
Branch: 1 branch
BranchTrueFalseTotal
if grep {/^\Q$subcommand\E$/i;} "-h", "--help", "help", "mystery" or $subcommand =~ /^-/ 0 0 0
Condition0%0/3
grep {/^\Q$subcommand\E$/i;} "-h", "--help", "help", "mystery" or $subcommand =~ /^-/
l!l&&r!l&&!r
000
MC/DC0%0/2
grep {/^\Q$subcommand\E$/i;} "-h", "--help", "help", "mystery" or $subcommand =~ /^-/
grep {/^\Q$subcommand\E$/i;} "-h", "--help", "help", "mystery" $subcommand =~ /^-/
Truth table0%0/3
A or B
A= grep {/^\Q$subcommand\E$/i;} "-h", "--help", "help", "mystery"B= $subcommand =~ /^-/
ABresult
1X1
011
000
218 or $subcommand =~ m/^-/;
219 0 return "help";
220 0 } [ $Rosary, lc($subcommand), $ARGV ],
221 day => \&PrayTheRosary,
222 mp3 => \&do_mp3,
223 about => \&do_about,
224 help => \&do_help,
225 mystery => \&mystery,
226 ;
227 #<<<
228 0 1;
229 };
230  
231 0 ▶ if (not $ok) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($ok) 0 0 0
232 0 ▶ my $error = $@ || q{unknown error};
Condition0%0/2
$@ || 'unknown error'
l!l
00
MC/DC0%0/1
$@ || 'unknown error'
$@
Truth table0%0/2
A
A= $@
Aresult
11
00
233 0 chomp $error;
234 0 warn "avemaria: $error\n";
235 0 return EXIT_ERROR;
236 }
237  
238 0 return EXIT_SUCCESS;
239 }
240  
241 1 ▶exit main(@ARGV) unless caller;
Branch: 1 branch
BranchTrueFalseTotal
unless caller 0 1 1
242  
243 0 ▶sub do_mp3 {
Subroutine do_mp3: not called CC=1 SCAR=6.9
244 0 my ($Rosary, $subcommand, $ARGV) = xshift_and_deref @_;
245 0 say $Rosary->mp3Link($subcommand, $ARGV);
246 0 exit EXIT_SUCCESS;
247 }
248  
249 0 ▶sub do_about() {
Subroutine do_about: not called CC=1 SCAR=6.9
250 0 return print <<EOF;
251 # BACKGROUND ON THE ROSARY
252  
253 The Rosary is a traditional Catholic prayer devotion that involves the
254 repetition of prayers and meditation on key events from the lives of Jesus
255 Christ and the Virgin Mary. The prayer is structured around a set of beads,
256 each representing a specific prayer. These include the Our Father, Hail Mary,
257 and Glory Be, which are recited while reflecting on the Mysteries-twenty
258 key moments in the lives of Jesus and Mary, grouped into four categories:
259 the Joyful, Sorrowful, Glorious, and Luminous Mysteries. The Rosary is both
260 a contemplative prayer and a way to focus on the essential aspects of the
261 Catholic faith, helping the faithful deepen their relationship with God.
262  
263 The history of the Rosary dates back to the Middle Ages, with its roots often
264 linked to St. Dominic, who is traditionally credited with receiving the Rosary
265 from the Virgin Mary in the 13th century. The Rosary evolved over several
266 centuries. One of its early forms was connected to the Psalter of Our Lady,
267 where the faithful would pray 150 Hail Marys, reflecting the 150 Psalms of
268 the Old Testament. This practice was common among laypeople who could not
269 read the Psalms themselves but still wanted to engage in a structured form
270 of prayer. Over time, the Rosary's prayers and structure were refined, and
271 by the 16th century, it became formally established by the Catholic Church
272 as a central devotion, with the mysteries of the Rosary added to provide a
273 scriptural basis for the prayers.
274  
275 ## Biblical Foundations of the Hail Mary
276  
277 For Catholics, the Rosary is a deeply meaningful prayer practice that helps
278 them draw closer to God by reflecting on the pivotal moments of salvation
279 history. Its biblical foundations are grounded in scripture, with the Hail Mary
280 drawn from the Angel Gabriel's greeting to Mary in Luke 1:28 and Elizabeth's
281 words in Luke 1:42.
282  
283 The first part of the Hail Mary comes from Luke 1:28 and Luke 1:42 in the
284 Douay-Rheims translation:
285  
286 > And the angel being come in, said unto her: Hail, full of grace, the Lord
287 > is with thee: blessed art thou among women.
288  
289 https://drbo.org/cgi-bin/d?b=drb&bk=49&ch=1&l=28-#x
290  
291 and:
292  
293 > And she cried out with a loud voice, and said: Blessed art thou among women,
294 > and blessed is the fruit of thy womb.
295  
296 https://drbo.org/cgi-bin/d?b=drb&bk=49&ch=1&l=43-#x
297  
298 These biblical words form the Angelic Salutation, which Catholics begin the
299 Hail Mary with:
300  
301 > Hail Mary, full of grace, the Lord is with thee: blessed art thou
302 > among women, and blessed is the fruit of thy womb, Jesus.
303  
304 ## The Second Part of the Hail Mary
305  
306 The second part of the Hail Mary, which was added later to the prayer,
307 invokes Mary's intercession. This part is drawn from the Catholic tradition
308 and reflects the Church's desire for Mary's prayers to be a source of strength
309 and protection for all the faithful. The second part reads:
310  
311 > Holy Mary, Mother of God, pray for us sinners, now and at the hour
312 > of our death. Amen.
313  
314 This petition is based on Mary's role as Mother of God (as declared in Luke
315 1:43, when Elizabeth calls her the "Mother of my Lord") and her ongoing role
316 as intercessor for the Church. It is the second part of the Hail Mary that
317 Catholics use to seek her intercession, especially in times of trial.
318  
319 https://drbo.org/cgi-bin/d?b=drb&bk=49&ch=1&l=43-#x
320  
321 ## The Our Father
322  
323 The Our Father comes directly from Jesus' teaching in the Gospel of Matthew
324 6:9-13:
325  
326 > Thus therefore shall you pray: Our Father who art in heaven, hallowed be Thy
327 > name. Thy kingdom come. Thy will be done, on earth as it is in heaven. Give
328 > us this day our daily bread. And forgive us our trespasses, as we forgive
329 > those who trespass against us. And lead us not into temptation, but deliver
330 > us from evil. Matthew 6:9-13.
331  
332 https://drbo.org/cgi-bin/d?b=drb&bk=47&ch=6&l=9-13#x
333  
334 By meditating on the Mysteries of the Rosary, Catholics invite the presence
335 of Jesus into their lives, contemplating His birth, death, resurrection, and
336 the role of Mary in His story. These meditations, grouped into the Joyful,
337 Sorrowful, Glorious, and Luminous Mysteries, help to guide the faithful
338 through the essential moments of Christ's life and His salvation work.
339  
340 ## The Rosary as a Communal Devotion
341  
342 The Rosary is seen not just as a personal prayer, but as a communal devotion
343 that fosters a deeper understanding of God's love and a powerful means of
344 seeking His intercession. It is often prayed in groups, in parishes, or even
345 in families, helping to build unity within the faith community. Through its
346 rich combination of prayer and meditation, the Rosary has become a beloved
347 devotion for Catholics around the world, encouraging spiritual growth and
348 reflection on the central mysteries of the Christian faith.
349  
350 The importance of daily prayer of the Rosary was emphasized by Our Lady
351 during the Apparitions at Fatima in 1917, where she specifically urged the
352 children to "pray the Rosary every day" for peace in the world and for the
353 salvation of souls, making it a call for all the faithful to embrace this
354 prayer as a tool for spiritual strength and intercession. For more information
355 on Fatima, look up, "the Miracle of the Sun."
356  
357 +Deo Gratias+
358  
359 EOF
360 0 exit EXIT_SUCCESS;
361 }
362  
363 0 ▶sub do_help() {
Subroutine do_help: not called CC=1 SCAR=6.9
364 0 return print <<EOF;
365 avemaria - commandline Rosary client for dailyrosary.catholicdevotion.org and the-rosary-api.catholicdevotion.org
366  
367 VERSION $Webservice::Rosary::API::VERSION
368  
369 Note: Commandline options may change to accomodate feedback. This note will
370 be removed once the cli UX settles.
371  
372 Quick Start
373  
374 > avemaria # no arguments
375 > ... runs through the recitation of the Rosary for today, equivalent,
376 to,
377  
378 > avemaria \$(date "+%A") --pray # `date` prints today's day of week
379  
380 Getting Help
381  
382 > avemaria help
383 > ... prints help section
384  
385 Learning More
386  
387 > avemaria about
388 > ... prints an "about" section
389  
390 Functional Commands
391  
392 There are 2 types of commands. One set of commands returns a URL for an MP3,
393 which may then be piped into another program to download it. The other set
394 of commands displays the specified Mystery (by day of the week or actual
395 name of the Mystery), so that the user may be guided through the specified
396 Mystery of the Rosary - from start to finish.
397  
398 Usage - to print MP3 URL to STDOUT:
399  
400 avemaria today | yesterday | tomorrow | random
401  
402 Example 1,
403  
404 > avemaria today
405 > https://dailyrosary.catholicdevotion.org/audio-rosary-sorrowful-mysteries.mp3
406  
407 Example 2,
408  
409 > curl -O \$(avemaria random) -w "\\nDownloaded file: %{filename_effective}\\n"
410 % Total % Received % Xferd Average Speed Time Time Time Current
411 Dload Upload Total Spent Left Speed
412 100 31.5M 100 31.5M 0 0 2374k 0 0:00:13 0:00:13 --:--:-- 5043k
413  
414 Downloaded file: audio-rosary-sorrowful-mysteries.mp3
415 >
416  
417 Note, MP3 Sources are as follows:
418  
419 + https://www.discerninghearts.com/Devotionals/Rosary-Joyful-Mysteries.mp3
420  
421 + https://www.discerninghearts.com/Devotionals/Rosary-Luminous-Mysteries.mp3
422  
423 + https://www.discerninghearts.com/Devotionals/Rosary-Sorrowful-Mysteries.mp3
424  
425 + https://www.discerninghearts.com/Devotionals/Rosary-Glorious-Mysteries.mp3
426  
427 Usage - to Pray the Rosary in the commandline:
428  
429 avemaria DAY_OR_MYSTERY [--pray] [--unceasingly]
430 [--scroll] [--fully] [-i] [-t]
431 [--sleep=0.N] [--speed=N] [--between=N]
432 [--nocontrols]
433 [--color [--dark | --light]]
434  
435 Valid DAY_OR_MYSTERY values:
436  
437 Joyful, Sorrowful, Luminous, Glorious, Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, or Saturday
438  
439 Prayer mode:
440  
441 --pray : stream the selected Rosary prayer by prayer.
442 --unceasingly : continuously pray until stopped; implies --pray. With no
443 explicit day/Mystery, the calendar day is re-evaluated at
444 each Rosary boundary. An explicit day/Mystery stays fixed.
445  
446 Presentation:
447  
448 --scroll : keep prior prayers visible instead of clearing the terminal.
449 --fully : include the full decade meditation in addition to its title
450 and Fruit of the Mystery.
451 -i : require <RETURN> after each prayer (and each description
452 when used with --fully).
453 -t : require <RETURN> after each decade description; requires
454 --fully.
455  
456 Timing and interaction:
457  
458 --sleep=0.N : base delay before each character. Default is 0.04 seconds.
459 --speed=N : initial text speed multiplier. Default is 1.0.
460 --between=N : pause between prayers. Default is 0.75 seconds.
461 --nocontrols : disable live single-key controls. -i/-t <RETURN> prompts
462 still work. With --unceasingly, use Ctrl-C to stop when
463 live controls are disabled.
464  
465 Color:
466  
467 --color : enable the tranquil color palette on an interactive terminal.
468 --dark : select the dark-background profile; this is the --color default.
469 --light : select the light-background profile.
470 --dark and --light require --color and are mutually exclusive.
471  
472 Color is never emitted unless --color is requested. NO_COLOR and non-terminal
473 output remain uncolored. --color by itself uses the --dark profile. Hail Marys
474 alternate light Marian blue and a neutral foreground (soft white on dark,
475 charcoal on light), starting with blue for the introductory Hail Marys and
476 again at each decade. Our Fathers are soft green. Joyful Mystery headings are
477 light blue, Sorrowful dark red/maroon, Glorious soft yellow/gold, and Luminous
478 gentle violet. Each individual Mystery title is bold in its family's color.
479 Other prayers and supporting text use coordinated tranquil accents.
480  
481 While --pray is streaming in an interactive terminal:
482  
483 SPACE/p : pause or resume
484 + or = : speed up immediately
485 - or _ : slow down immediately
486 0 : reset to the initial --speed value
487 q : ask "Quit y/N?"; a confirmed quit exits cleanly
488  
489 Example 3,
490  
491 Used without additional options, it just prints the name of the Mystery
492  
493 > avemaria Monday
494 > Monday - The Joyful Mysteries
495 >
496  
497 > avemaria Sorrowful
498 > Friday - The Sorrowful Mysteries
499 >
500  
501 Example 4,
502  
503 > avemaria Friday --pray -t --fully
504 > .. clears screen, then prays the specified Mystery (Sorrowful in this case),
505 while pausing only at the beginning of each Mystery after the description has
506 been printed ...
507  
508 Example 5,
509  
510 Run with absolutely no subcommands or flags, runs "--pray" for Today's Mystery,
511  
512 > avemaria
513 > .. clears screen, then prays the specified Mystery for Today ...
514  
515 Example 6,
516  
517 Pray continuously until q (with confirmation) or Ctrl-C is used to stop:
518  
519 > avemaria --unceasingly --scroll --color
520  
521 --unceasingly composes with the ordinary prayer options. It implies --pray
522 and retains live speed changes between cycles. With no explicit day/Mystery,
523 the day is checked again at each complete-Rosary boundary so a prayer running
524 across midnight moves to the new day's Mysteries. An explicitly selected day
525 or Mystery remains fixed. In --scroll mode the overall heading is shown again
526 at the beginning of each new Rosary, while ordinary prayer lines remain
527 uncluttered.
528  
529 Feedback is Requested.
530  
531 The timing and presentation controls are intentionally small so that --pray can
532 remain useful in ordinary terminals without turning the client into a full-screen
533 application. In --scroll mode, the overall heading is shown once per Rosary and
534 decade headings are shown only when a new decade begins, keeping repeated
535 prayer text uncluttered. Mystery headings are displayed in uppercase. Normal prayer mode
536 shows each decade title and Fruit of the Mystery; --fully additionally presents
537 the longer meditation text. The introductory Our Father is offered for the
538 intentions and well-being of Pope Leo XIV, followed by Hail Marys for an
539 increase in Faith, Hope, and Charity.
540  
541 +Deo Gratias+
542  
543 VERSION $Webservice::Rosary::API::VERSION
544  
545 avemaria - commandline Rosary client for dailyrosary.catholicdevotion.org and the-rosary-api.catholicdevotion.org
546  
547 EOF
548  
549 0 exit EXIT_SUCCESS;
550 }
551  
552 0 ▶sub mystery {
Subroutine mystery: not called CC=1 SCAR=6.9
553 0 my ($Rosary, $subcommand, $ARGV ) = xshift_and_deref @_;
554 0 my $Convert = h2o {
555 luminous => "thursday",
556 sorrowful => "friday",
557 joyful => "saturday",
558 glorious => "sunday",
559 };
560 0 $subcommand = $Convert->$subcommand;
561 0 return PrayTheRosary([$Rosary, $subcommand, $ARGV]);
562 }
563  
564 0 ▶sub _print {
Subroutine _print: not called CC=1 SCAR=6.9
565 0 my ($Text, $Stream) = @_;
566 0 return $Stream->stream($Text);
567 }
568  
569 0 ▶sub _prompt_continue {
Subroutine _prompt_continue: not called CC=1 SCAR=6.9
570 0 my $Stream = shift;
571 0 $Stream->restore_terminal;
572 0 print "\n\n<RETURN> to continue ... ";
573 0 my $next = <STDIN>;
574 0 $Stream->resume_terminal;
575 0 return $next;
576 }
577  
578 0 ▶sub _load_rosary_data {
Subroutine _load_rosary_data: not called CC=3 SCAR=24.8
579 0 my ($Rosary, $day) = @_;
580  
581 0 my $Mystery = $Rosary->day($day);
582 0 ▶ die "Rosary API returned no Mystery for $day\n" if not $Mystery;
Branch: 1 branch
BranchTrueFalseTotal
unless $Mystery 0 0 0
583  
584 # Detailed Mystery data supplies each decade title and Fruit of the Mystery.
585 # If that secondary endpoint is temporarily unavailable, retain the basic
586 # recitation rather than making the whole Rosary unusable.
587 0 my $Details = eval { $Rosary->details(lc $Mystery->group_by) };
588 0 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
589 0 my $error = $@;
590 0 chomp $error;
591 0 warn "avemaria: could not load Mystery details: $error\n";
592 0 $Details = undef;
593 }
594  
595 0 my $Name = _mystery_heading($day, $Mystery->group_by);
596 0 my $MysteryRole = _mystery_role($Mystery->group_by, 0);
597 0 my $MysteryTitleRole = _mystery_role($Mystery->group_by, 1);
598  
599 # Add the local response/closing presentation fields used by the CLI.
600 0 $Mystery = tr4h2o o2d $Mystery;
601 0 $Mystery->{pray_for_us_most_holy_mother_of_god} = <<'EOF';
602 V. Pray for us, Oh Holy Mother of God
603 R. That we may be made worth of the promises of Christ.
604 EOF
605 0 $Mystery->{oremus} = "V. Let us Pray.";
606 0 $Mystery->{most_holy_rosary} = "";
607 0 $Mystery->{in_the_name_2} = sprintf "The Most Holy Rosary.\n%s", $Mystery->{in_the_name_2};
608 0 h2o $Mystery;
609  
610 0 return ($Mystery, $Details, $Name, $MysteryRole, $MysteryTitleRole);
611 }
612  
613 0 ▶sub PrayTheRosary {
Subroutine PrayTheRosary: not called CC=59 SCAR=81.7
614 0 my ($Rosary, $subcommand, $ARGV) = xshift_and_deref @_;
615 0 ▶ my $follow_calendar = ! defined($subcommand) || ! length($subcommand);
Condition0%0/3
defined $subcommand && length $subcommand
!ll&&!rl&&r
000
MC/DC0%0/2
defined $subcommand && length $subcommand
defined $subcommand length $subcommand
Truth table0%0/3
A && B
A= defined $subcommandB= length $subcommand
ABresult
0X0
100
111
616 0 ▶ $subcommand = _today_day() if $follow_calendar;
Branch: 1 branch
BranchTrueFalseTotal
if $follow_calendar 0 0 0
617  
618 0 my $o = Getopt2h2o $ARGV,
619 {
620 sleep => 0.04,
621 speed => 1.0,
622 between => 0.75,
623 controls => 1,
624 scroll => 0,
625 color => 0,
626 dark => 0,
627 light => 0,
628 unceasingly => 0,
629 },
630 qw/pray unceasingly i t fully without scroll|no-clear controls! sleep=f speed=f between=f color dark light/;
631  
632 0 ▶ die "--sleep must be zero or greater\n" if $o->sleep < 0;
Branch: 1 branch
BranchTrueFalseTotal
if $o->sleep < 0 0 0 0
633 0 ▶ die "--speed must be greater than zero\n" if $o->speed <= 0;
Branch: 1 branch
BranchTrueFalseTotal
if $o->speed <= 0 0 0 0
634 0 ▶ die "--between must be zero or greater\n" if $o->between < 0;
Branch: 1 branch
BranchTrueFalseTotal
if $o->between < 0 0 0 0
635 0 ▶ die "-t requires --fully\n" if $o->t and not $o->fully;
Branch: 1 branch
BranchTrueFalseTotal
if $o->t and not $o->fully 0 0 0
Condition0%0/3
$o->t and not $o->fully
!ll&&!rl&&r
000
MC/DC0%0/2
$o->t and not $o->fully
$o->t not $o->fully
Truth table0%0/3
A and not(B)
A= $o->tB= not $o->fully
ABresult
0X0
100
111
636 0 ▶ die "--dark and --light cannot be used together\n" if $o->dark and $o->light;
Branch: 1 branch
BranchTrueFalseTotal
if $o->dark and $o->light 0 0 0
Condition0%0/3
$o->dark and $o->light
!ll&&!rl&&r
000
MC/DC0%0/2
$o->dark and $o->light
$o->dark $o->light
Truth table0%0/3
A and B
A= $o->darkB= $o->light
ABresult
0X0
100
111
637 0 ▶ die "--dark and --light require --color\n" if not $o->color and ($o->dark or $o->light);
Branch: 1 branch
BranchTrueFalseTotal
if not $o->color and $o->dark || $o->light 0 0 0
Condition0%0/6
not $o->color and $o->dark || $o->light
!ll&&!rl&&r
000
$o->dark or $o->light
l!l&&r!l&&!r
000
MC/DC0%0/3
not $o->color and $o->dark || $o->light
not $o->color $o->dark $o->light
Truth table0%0/4
not(A) and B or C
A= not $o->colorB= $o->darkC= $o->light
ABCresult
0XX0
1000
11X1
1011
638  
639 # --unceasingly is itself a prayer mode rather than a presentation modifier,
640 # so it naturally implies --pray even with an explicit day or Mystery.
641 0 ▶ my $praying = $o->pray || $o->unceasingly;
Condition0%0/3
$o->pray || $o->unceasingly
l!l&&r!l&&!r
000
MC/DC0%0/2
$o->pray || $o->unceasingly
$o->pray $o->unceasingly
Truth table0%0/3
A || B
A= $o->prayB= $o->unceasingly
ABresult
1X1
011
000
642  
643 0 my ($Mystery, $Details, $Name, $MysteryRole, $MysteryTitleRole) =
644 _load_rosary_data($Rosary, $subcommand);
645  
646 0 ▶ unless ($praying) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($praying) 0 0 0
647 0 say $Name;
648 0 exit EXIT_SUCCESS;
649 }
650  
651 my $Stream = Webservice::Rosary::Stream->new(
652 delay => $o->sleep,
653 speed => $o->speed,
654 controls => $o->controls,
655 0 ▶ on_quit => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
656 0 print "\nPray the Rosary every day, +JMJ+\n";
657 0 exit EXIT_SUCCESS;
658 },
659 0 );
660  
661 # --color defaults to the dark-background profile unless --light is explicit.
662 0 ▶ my $profile = $o->light ? q{light} : q{dark};
Branch: 1 branch
BranchTrueFalseTotal
$o->light ? : 0 0 0
663 0 ▶ my $Palette = _color_enabled($o) ? _color_palette($profile) : undef;
Branch: 1 branch
BranchTrueFalseTotal
_color_enabled($o) ? : 0 0 0
664  
665 # Do not leave an interactive terminal in cbreak mode if prayer is stopped
666 # with Ctrl-C or terminated by the shell.
667 0 ▶ local $SIG{INT} = sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
668 0 $Stream->restore_terminal;
669 0 print STDERR "\n";
670 0 exit 130;
671 0 };
672 0 ▶ local $SIG{TERM} = sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
673 0 $Stream->restore_terminal;
674 0 exit 143;
675 0 };
676  
677 # Iterate over the entire Rosary, in Perl
678 0 my @Prayers = qw/In_The_Name_1 I_Believe Our__Father_1 Hail__Mary_1 Hail__Mary_2 Hail__Mary_3 Glory_Be_1 Oh_My_Jesus_1/;
679 0 my $Decade = 0;
680 0 my $Announce = 0;
681 0 my $Pater_Noster = 1; # "Our Father, who art in Heaven ..."
682 0 my $Ave_Maria = 3; # "Hail Mary, full of Grace ..."
683 0 my $Gloria_Patria = 1; # "Glory be to the Father, to the Son, and to the Holy Ghost ..."
684 0 my $O_Mi_Jesu = 1; # "O My Jesus, forgive us our sins ..." (aka, "The Fatima Prayer")
685 0 foreach my $D (1..5) {
686 0 push @Prayers, sprintf "Announce_%d", ++$Announce;
687 0 push @Prayers, sprintf "Our__Father_%d", ++$Pater_Noster;
688 0 foreach my $I (1..10) {
689 0 push @Prayers, sprintf "Hail__Mary_%d_%d", ++$Ave_Maria, $I;
690 }
691 0 push @Prayers, sprintf "Glory_Be_%d", ++$Gloria_Patria;
692 0 push @Prayers, sprintf "Oh_My_Jesus_%d", ++$O_Mi_Jesu;
693 }
694 0 push @Prayers, qw/Holy_Queen Pray_For_Us_Most_Holy_Mother_of_God Oremus Final_Prayer Most_Holy_Rosary In_The_Name_2/;
695  
696 0 my $total = scalar @Prayers;
697 0 my $cycle = 0;
698  
699 0 ROSARY: while (1) {
700 # When no day or Mystery was supplied explicitly, --unceasingly follows
701 # the calendar. Re-evaluate the day only between complete Rosaries; an
702 # explicit day/Mystery remains fixed until the process exits.
703 0 my $cycle_day = _next_cycle_day($follow_calendar, $subcommand);
704 0 ▶ if ($cycle_day ne $subcommand) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cycle_day ne $subcommand) 0 0 0
705 0 $subcommand = $cycle_day;
706 0 ($Mystery, $Details, $Name, $MysteryRole, $MysteryTitleRole) =
707 _load_rosary_data($Rosary, $subcommand);
708 }
709  
710 0 ▶ $Stream->wait($o->between) if $cycle;
Branch: 1 branch
BranchTrueFalseTotal
if $cycle 0 0 0
711 0 ▶ print "\n\n" if $cycle and $o->scroll;
Branch: 1 branch
BranchTrueFalseTotal
if $cycle and $o->scroll 0 0 0
Condition0%0/3
$cycle and $o->scroll
!ll&&!rl&&r
000
MC/DC0%0/2
$cycle and $o->scroll
$cycle $o->scroll
Truth table0%0/3
A and B
A= $cycleB= $o->scroll
ABresult
0X0
100
111
712 0 ++$cycle;
713  
714 0 my $count = 0;
715 0 my $decade = 0;
716 0 my $hail_mary_ordinal = 0;
717  
718 0 ▶ if ($o->scroll) {
Branch: 1 branch
BranchTrueFalseTotal
if ($o->scroll) 0 0 0
719 0 _say_styled($Name, $MysteryRole, $Palette);
720 0 ▶ if ($Stream->interactive) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Stream->interactive) 0 0 0
721 0 _say_styled('[' . $Stream->controls_help . ']', q{intention}, $Palette);
722 }
723 0 _separator($Palette);
724 0 print "\n";
725 }
726  
727 0 foreach my $Prayer (map { lc } @Prayers) {
728 0 my $Text = _format_prayer_text($Prayer, $Mystery->$Prayer);
729  
730 0 ▶ my $is_decade = $Prayer =~ m/^announce_(\d+)$/ ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$Prayer =~ /^announce_(\d+)$/ ? : 0 0 0
731 0 ▶ $hail_mary_ordinal = 0 if $is_decade;
Branch: 1 branch
BranchTrueFalseTotal
if $is_decade 0 0 0
732 0 ▶ my $detail = $is_decade && ref($Details) eq q{ARRAY}
Branch: 1 branch
BranchTrueFalseTotal
$is_decade && ref $Details eq 'ARRAY' ? : 0 0 0
Condition0%0/3
$is_decade and ref $Details eq "ARRAY"
!ll&&!rl&&r
000
MC/DC0%0/2
$is_decade and ref $Details eq "ARRAY"
$is_decade ref $Details eq "ARRAY"
Truth table0%0/3
A and B
A= $is_decadeB= ref $Details eq "ARRAY"
ABresult
0X0
100
111
733 ? $Details->[$decade]
734 : undef;
735  
736 0 ▶ $Stream->wait($o->between) if $count;
Branch: 1 branch
BranchTrueFalseTotal
if $count 0 0 0
737  
738 0 ▶ if ($o->scroll) {
Branch: 1 branch
BranchTrueFalseTotal
if ($o->scroll) { } 0 0 0
739 # Ordinary prayers simply continue down the terminal. A visible section
740 # break is reserved for the start of each new decade.
741 0 ▶ print "\n\n" if $count;
Branch: 1 branch
BranchTrueFalseTotal
if $count 0 0 0
742 }
743 else {
744 0 print "\033[2J\033[H"; # clear terminal
745 }
746  
747 0 ++$count;
748  
749 0 ▶ if (not $o->scroll) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($o->scroll) 0 0 0
750 0 _say_styled($Name, $MysteryRole, $Palette);
751 0 printf "Prayer %d of %d", $count, $total;
752 0 ▶ printf " [%s]", $Stream->controls_help if $Stream->interactive;
Branch: 1 branch
BranchTrueFalseTotal
if $Stream->interactive 0 0 0
753 0 print "\n";
754 0 _separator($Palette);
755 0 print "\n";
756 }
757  
758 0 ▶ if ($is_decade) {
Branch: 1 branch
BranchTrueFalseTotal
if ($is_decade) 0 0 0
759 0 ▶ my $title = $detail ? ($detail->title // q{}) : q{};
Branch: 1 branch
BranchTrueFalseTotal
$detail ? : 0 0 0
Condition0%0/2
$detail->title // ""
l!l
00
MC/DC0%0/1
$detail->title // ""
$detail->title
Truth table0%0/2
A
A= $detail->title
Aresult
11
00
760 0 ▶ my $fruit = $detail ? ($detail->fruit // q{}) : q{};
Branch: 1 branch
BranchTrueFalseTotal
$detail ? : 0 0 0
Condition0%0/2
$detail->fruit // ""
l!l
00
MC/DC0%0/1
$detail->fruit // ""
$detail->fruit
Truth table0%0/2
A
A= $detail->fruit
Aresult
11
00
761  
762 0 ▶ if (length $title) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $title) 0 0 0
763 0 ▶ _separator($Palette) if $o->scroll;
Branch: 1 branch
BranchTrueFalseTotal
if $o->scroll 0 0 0
764 0 _say_styled(uc($title), $MysteryTitleRole, $Palette);
765 0 ▶ if (length $fruit) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $fruit) 0 0 0
766 0 ▶ $fruit = "Fruit of the Mystery: $fruit" if $fruit !~ m/fruit/i;
Branch: 1 branch
BranchTrueFalseTotal
unless $fruit =~ /fruit/i 0 0 0
767 0 _say_styled($fruit, q{fruit}, $Palette);
768 }
769 0 ▶ _separator($Palette) if $o->scroll;
Branch: 1 branch
BranchTrueFalseTotal
if $o->scroll 0 0 0
770 0 print "\n";
771 }
772  
773 0 ▶ if ($o->fully and $detail) {
Branch: 1 branch
BranchTrueFalseTotal
if ($o->fully and $detail) 0 0 0
Condition0%0/3
$o->fully and $detail
!ll&&!rl&&r
000
MC/DC0%0/2
$o->fully and $detail
$o->fully $detail
Truth table0%0/3
A and B
A= $o->fullyB= $detail
ABresult
0X0
100
111
774 0 ▶ my $meditation = $detail->text // q{};
Condition0%0/2
$detail->text // ""
l!l
00
MC/DC0%0/1
$detail->text // ""
$detail->text
Truth table0%0/2
A
A= $detail->text
Aresult
11
00
775 0 ▶ if (length $meditation) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $meditation) 0 0 0
776 0 _stream_styled(fold_text($meditation, 72), q{meditation}, $Stream, $Palette);
777 0 print "\n\n";
778 }
779 0 ▶ _prompt_continue($Stream) if $o->i or $o->t;
Branch: 1 branch
BranchTrueFalseTotal
if $o->i or $o->t 0 0 0
Condition0%0/3
$o->i or $o->t
l!l&&r!l&&!r
000
MC/DC0%0/2
$o->i or $o->t
$o->i $o->t
Truth table0%0/3
A or B
A= $o->iB= $o->t
ABresult
1X1
011
000
780 }
781  
782 # The day response normally contains an announcement duplicating the
783 # detailed title. Prefer the richer title/fruit presentation when it is
784 # available; retain the API announcement as a fallback.
785 0 ▶ $Text = q{} if $detail and length $title;
Branch: 1 branch
BranchTrueFalseTotal
if $detail and length $title 0 0 0
Condition0%0/3
$detail and length $title
!ll&&!rl&&r
000
MC/DC0%0/2
$detail and length $title
$detail length $title
Truth table0%0/3
A and B
A= $detailB= length $title
ABresult
0X0
100
111
786 0 ++$decade;
787 }
788  
789 0 my $intention = opening_intention($Prayer);
790 0 ▶ if (length $intention) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $intention) 0 0 0
791 0 _say_styled($intention, q{intention}, $Palette);
792 0 print "\n";
793 }
794  
795 0 ▶ if (length $Text) {
Branch: 1 branch
BranchTrueFalseTotal
if (length $Text) 0 0 0
796 0 my $role = _prayer_role($Prayer);
797 0 ▶ if ($role eq q{hail_mary}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($role eq "hail_mary") 0 0 0
798 0 $role = _hail_mary_role(++$hail_mary_ordinal);
799 }
800 0 _stream_styled($Text, $role, $Stream, $Palette);
801 }
802 0 ▶ _prompt_continue($Stream) if $o->i and length $Text;
Branch: 1 branch
BranchTrueFalseTotal
if $o->i and length $Text 0 0 0
Condition0%0/3
$o->i and length $Text
!ll&&!rl&&r
000
MC/DC0%0/2
$o->i and length $Text
$o->i length $Text
Truth table0%0/3
A and B
A= $o->iB= length $Text
ABresult
0X0
100
111
803 }
804  
805 0 ▶ last ROSARY if not $o->unceasingly;
Branch: 1 branch
BranchTrueFalseTotal
unless $o->unceasingly 0 0 0
806 }
807  
808 0 $Stream->restore_terminal;
809 0 print "\n";
810 0 exit EXIT_SUCCESS;
811 }
812  
813 1 1;
814  
815 __END__
↑ Summary blib/lib/Webservice/Rosary/Stream.pm »