| 1 | package MooX::Locale::Passthrough; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use warnings FATAL => 'all'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 2 | our $VERSION = "0.001"; | |||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use Carp qw/croak/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use Moo::Role; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | =head1 NAME | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | MooX::Locale::Passthrough - provide API used in translator modules without translating | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | { package WonderBar; | ||||||||||||||||||||||||||||
| 19 | use Moo; | ||||||||||||||||||||||||||||
| 20 | with "MooX::Locale::Passthrough"; | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | sub tell_me { my $self = shift; $self->__("Hello world"); } | ||||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | WonderBar->new->tell_me; | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | C<MooX::Locale::Passthrough> is made to allow CPAN modules use translator API | ||||||||||||||||||||||||||||
| 30 | without adding heavy dependencies (external software) or requirements (operating | ||||||||||||||||||||||||||||
| 31 | resulting solution). | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | This software is released together with L<MooX::Locale::TextDomain::OO>, which | ||||||||||||||||||||||||||||
| 34 | allowes then to plugin any desired translation. | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | =head1 METHODS | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | =head2 __ MSGID | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | returns MSGID | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | =cut | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | ## no critic (Subroutines::RequireArgUnpacking) | ||||||||||||||||||||||||||||
| 45 | 1 | ▶ | sub __ { $_[1] } | ||||||||||||||||||||||||||
|
Subroutine
__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | =head2 __n MSGID, MSGID_PLURAL, COUNT | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | returns MSGID when count is equal 1, MSGID_PLURAL otherwise | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | =cut | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | sub __n | ||||||||||||||||||||||||||||
| 54 | 2 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
__n: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 55 | 2 | my (undef, $s, $p, $v) = @_; | |||||||||||||||||||||||||||
| 56 | 2 | ▶ | defined $v and int($v) == 1 and return $s; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $v and int $v == 1
MC/DC50%1/2
defined $v and int $v == 1
defined $v
int $v == 1
Truth table66%2/3
A and B
A= defined $vB= int $v == 1
| |||||||||||||||||||||||||||||
| 57 | 1 | $p; | |||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | =head2 __p MSGCTX, MSGID | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | returns MSGID | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | =cut | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | sub __p | ||||||||||||||||||||||||||||
| 67 | 1 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
__p: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 68 | 1 | my (undef, $ctx, $m) = @_; | |||||||||||||||||||||||||||
| 69 | 1 | $m; | |||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | Jens Rehsack, C<< <rehsack at cpan.org> >> | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | =head1 BUGS | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | Please report any bugs or feature requests to | ||||||||||||||||||||||||||||
| 79 | C<bug-MooX-Locale-Passthrough at rt.cpan.org>, or through the web interface at | ||||||||||||||||||||||||||||
| 80 | L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=MooX-Locale-Passthrough>. | ||||||||||||||||||||||||||||
| 81 | I will be notified, and then you'll automatically be notified of progress | ||||||||||||||||||||||||||||
| 82 | on your bug as I make changes. | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | =head1 SUPPORT | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | You can find documentation for this module with the perldoc command. | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | perldoc MooX::Locale::Passthrough | ||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | You can also look for information at: | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | =over 4 | ||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | =item * RT: CPAN's request tracker | ||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=MooX-Locale-Passthrough> | ||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | =item * AnnoCPAN: Annotated CPAN documentation | ||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | L<http://annocpan.org/dist/MooX-Locale-Passthrough> | ||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | =item * CPAN Ratings | ||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | L<http://cpanratings.perl.org/m/MooX-Locale-Passthrough> | ||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||
| 106 | =item * Search CPAN | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | L<http://search.cpan.org/dist/MooX-Locale-Passthrough/> | ||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | =back | ||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | =head1 LICENSE AND COPYRIGHT | ||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | Copyright 2017 Jens Rehsack. | ||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | This program is free software; you can redistribute it and/or modify it | ||||||||||||||||||||||||||||
| 117 | under the terms of either: the GNU General Public License as published | ||||||||||||||||||||||||||||
| 118 | by the Free Software Foundation; or the Artistic License. | ||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | See http://dev.perl.org/licenses/ for more information. | ||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | =cut | ||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | 2 | 1; | |||||||||||||||||||||||||||