| 1 | package Games::Cards::Troika::Util; | ||||||||||||||
| 2 | |||||||||||||||
| 3 | 1 | ▶ | use 5.010001; | ||||||||||||
|
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 | our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY | |||||||||||||
| 8 | 1 | our $DATE = '2026-07-15'; # DATE | |||||||||||||
| 9 | 1 | our $DIST = 'Games-Cards-Troika-Util'; # DIST | |||||||||||||
| 10 | 1 | our $VERSION = '0.001'; # VERSION | |||||||||||||
| 11 | |||||||||||||||
| 12 | 1 | our %SPEC; | |||||||||||||
| 13 | |||||||||||||||
| 14 | $SPEC{troika_list_cards} = { | ||||||||||||||
| 15 | 1 | v => 1.1, | |||||||||||||
| 16 | summary => 'Return the list of cards', | ||||||||||||||
| 17 | args => { | ||||||||||||||
| 18 | lang => {schema => ['str*', in=>['eng', 'ind', 'fra'], default=>'eng']}, | ||||||||||||||
| 19 | descriptive => {schema => 'bool*'}, | ||||||||||||||
| 20 | detail => {schema => 'bool*'}, | ||||||||||||||
| 21 | }, | ||||||||||||||
| 22 | args_rels => { | ||||||||||||||
| 23 | choose_one => [qw/descriptive detail/], | ||||||||||||||
| 24 | }, | ||||||||||||||
| 25 | }; | ||||||||||||||
| 26 | 0 | ▶ | sub troika_list_cards { | ||||||||||||
|
Subroutine
troika_list_cards: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||
| 27 | 0 | my %args = @_; | |||||||||||||
| 28 | |||||||||||||||
| 29 | 0 | ▶ | my $lang = $args{lang} // 'eng'; | ||||||||||||
|
Condition0%0/2
$args{"lang"} // "eng"
MC/DC0%0/1
$args{"lang"} // "eng"
$args{"lang"}
Truth table0%0/2
A
A= $args{"lang"}
| |||||||||||||||
| 30 | |||||||||||||||
| 31 | 0 | require TableData::Games::Cards::Troika; | |||||||||||||
| 32 | 0 | my $t = TableData::Games::Cards::Troika->new; | |||||||||||||
| 33 | |||||||||||||||
| 34 | 0 | my @rows; | |||||||||||||
| 35 | 0 | ▶ | while ($t->has_next_row) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 36 | 0 | my $row = $t->get_next_row_hashref; | |||||||||||||
| 37 | 0 | push @rows, $row; | |||||||||||||
| 38 | } | ||||||||||||||
| 39 | |||||||||||||||
| 40 | 0 | ▶ | if ($args{detail}) { | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 41 | 0 | 1; | |||||||||||||
| 42 | } elsif ($args{descriptive}) { | ||||||||||||||
| 43 | 0 | @rows = map { $_->{"${lang}_descriptive_name"} } @rows; | |||||||||||||
| 44 | |||||||||||||||
| 45 | } else { | ||||||||||||||
| 46 | 0 | @rows = map { $_->{"${lang}_short_name"} } @rows; | |||||||||||||
| 47 | } | ||||||||||||||
| 48 | |||||||||||||||
| 49 | 0 | [200, "OK", \@rows]; | |||||||||||||
| 50 | } | ||||||||||||||
| 51 | |||||||||||||||
| 52 | 1 | 1; | |||||||||||||
| 53 | # ABSTRACT: Utilities related to the Anak Bos Troika card game | ||||||||||||||
| 54 | |||||||||||||||
| 55 | __END__ | ||||||||||||||
| 56 | |||||||||||||||
| 57 | =pod | ||||||||||||||
| 58 | |||||||||||||||
| 59 | =encoding UTF-8 | ||||||||||||||
| 60 | |||||||||||||||
| 61 | =head1 NAME | ||||||||||||||
| 62 | |||||||||||||||
| 63 | Games::Cards::Troika::Util - Utilities related to the Anak Bos Troika card game | ||||||||||||||
| 64 | |||||||||||||||
| 65 | =head1 VERSION | ||||||||||||||
| 66 | |||||||||||||||
| 67 | This document describes version 0.001 of Games::Cards::Troika::Util (from Perl distribution Games-Cards-Troika-Util), released on 2026-07-15. | ||||||||||||||
| 68 | |||||||||||||||
| 69 | =head1 DESCRIPTION | ||||||||||||||
| 70 | |||||||||||||||
| 71 | =head1 FUNCTIONS | ||||||||||||||
| 72 | |||||||||||||||
| 73 | |||||||||||||||
| 74 | =head2 troika_list_cards | ||||||||||||||
| 75 | |||||||||||||||
| 76 | Usage: | ||||||||||||||
| 77 | |||||||||||||||
| 78 | troika_list_cards(%args) -> [$status_code, $reason, $payload, \%result_meta] | ||||||||||||||
| 79 | |||||||||||||||
| 80 | Return the list of cards. | ||||||||||||||
| 81 | |||||||||||||||
| 82 | This function is not exported. | ||||||||||||||
| 83 | |||||||||||||||
| 84 | Arguments ('*' denotes required arguments): | ||||||||||||||
| 85 | |||||||||||||||
| 86 | =over 4 | ||||||||||||||
| 87 | |||||||||||||||
| 88 | =item * B<descriptive> => I<bool> | ||||||||||||||
| 89 | |||||||||||||||
| 90 | (No description) | ||||||||||||||
| 91 | |||||||||||||||
| 92 | =item * B<detail> => I<bool> | ||||||||||||||
| 93 | |||||||||||||||
| 94 | (No description) | ||||||||||||||
| 95 | |||||||||||||||
| 96 | =item * B<lang> => I<str> (default: "eng") | ||||||||||||||
| 97 | |||||||||||||||
| 98 | (No description) | ||||||||||||||
| 99 | |||||||||||||||
| 100 | |||||||||||||||
| 101 | =back | ||||||||||||||
| 102 | |||||||||||||||
| 103 | Returns an enveloped result (an array). | ||||||||||||||
| 104 | |||||||||||||||
| 105 | First element ($status_code) is an integer containing HTTP-like status code | ||||||||||||||
| 106 | (200 means OK, 4xx caller error, 5xx function error). Second element | ||||||||||||||
| 107 | ($reason) is a string containing error message, or something like "OK" if status is | ||||||||||||||
| 108 | 200. Third element ($payload) is the actual result, but usually not present when enveloped result is an error response ($status_code is not 2xx). Fourth | ||||||||||||||
| 109 | element (%result_meta) is called result metadata and is optional, a hash | ||||||||||||||
| 110 | that contains extra information, much like how HTTP response headers provide additional metadata. | ||||||||||||||
| 111 | |||||||||||||||
| 112 | Return value: (any) | ||||||||||||||
| 113 | |||||||||||||||
| 114 | =head1 HOMEPAGE | ||||||||||||||
| 115 | |||||||||||||||
| 116 | Please visit the project's homepage at L<https://metacpan.org/release/Games-Cards-Troika-Util>. | ||||||||||||||
| 117 | |||||||||||||||
| 118 | =head1 SOURCE | ||||||||||||||
| 119 | |||||||||||||||
| 120 | Source repository is at L<https://github.com/perlancar/perl-Games-Cards-Troika-Util>. | ||||||||||||||
| 121 | |||||||||||||||
| 122 | =head1 SEE ALSO | ||||||||||||||
| 123 | |||||||||||||||
| 124 | Website of publisher. L<https://www.engaginc.com/> . | ||||||||||||||
| 125 | |||||||||||||||
| 126 | Homepage for the game. L<https://www.engaginc.com/products/anak-bos-troika/> . | ||||||||||||||
| 127 | |||||||||||||||
| 128 | Some additional materials for the game (instruction, logo, box mockup). L<https://github.com/berdikaritc/engaginc-productinfo-troika> . | ||||||||||||||
| 129 | |||||||||||||||
| 130 | =head1 AUTHOR | ||||||||||||||
| 131 | |||||||||||||||
| 132 | perlancar <perlancar@cpan.org> | ||||||||||||||
| 133 | |||||||||||||||
| 134 | =head1 CONTRIBUTOR | ||||||||||||||
| 135 | |||||||||||||||
| 136 | =for stopwords perlancar | ||||||||||||||
| 137 | |||||||||||||||
| 138 | perlancar <perlancar@gmail.com> | ||||||||||||||
| 139 | |||||||||||||||
| 140 | =head1 CONTRIBUTING | ||||||||||||||
| 141 | |||||||||||||||
| 142 | |||||||||||||||
| 143 | To contribute, you can send patches by email/via RT, or send pull requests on | ||||||||||||||
| 144 | GitHub. | ||||||||||||||
| 145 | |||||||||||||||
| 146 | Most of the time, you don't need to build the distribution yourself. You can | ||||||||||||||
| 147 | simply modify the code, then test via: | ||||||||||||||
| 148 | |||||||||||||||
| 149 | % prove -l | ||||||||||||||
| 150 | |||||||||||||||
| 151 | If you want to build the distribution (e.g. to try to install it locally on your | ||||||||||||||
| 152 | system), you can install L<Dist::Zilla>, | ||||||||||||||
| 153 | L<Dist::Zilla::PluginBundle::Author::PERLANCAR>, | ||||||||||||||
| 154 | L<Pod::Weaver::PluginBundle::Author::PERLANCAR>, and sometimes one or two other | ||||||||||||||
| 155 | Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond | ||||||||||||||
| 156 | that are considered a bug and can be reported to me. | ||||||||||||||
| 157 | |||||||||||||||
| 158 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||
| 159 | |||||||||||||||
| 160 | This software is copyright (c) 2026 by perlancar <perlancar@cpan.org>. | ||||||||||||||
| 161 | |||||||||||||||
| 162 | This is free software; you can redistribute it and/or modify it under | ||||||||||||||
| 163 | the same terms as the Perl 5 programming language system itself. | ||||||||||||||
| 164 | |||||||||||||||
| 165 | =head1 BUGS | ||||||||||||||
| 166 | |||||||||||||||
| 167 | Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=Games-Cards-Troika-Util> | ||||||||||||||
| 168 | |||||||||||||||
| 169 | When submitting a bug or request, please include a test-file or a | ||||||||||||||
| 170 | patch to an existing test-file that illustrates the bug or desired | ||||||||||||||
| 171 | feature. | ||||||||||||||
| 172 | |||||||||||||||
| 173 | =cut | ||||||||||||||