File Coverage

blib/lib/Data/Sah/Type/Comparable.pm
Criterion Covered Total %
statement 13 13 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 18 18 100.0


line stmt bran cond sub pod time code
1              
2             use strict;
3 21     21   8105  
  21         41  
  21         567  
4             use Data::Sah::Util::Role 'has_clause';
5 21     21   92 use Role::Tiny;
  21         35  
  21         730  
6 21     21   89  
  21         32  
  21         87  
7             requires 'superclause_comparable';
8              
9             has_clause 'in',
10             v => 2,
11             tags => ['constraint'],
12             schema => ['array', {req=>1, of=>['_same', {req=>1}]}],
13             allow_expr => 1,
14             code => sub {
15             my ($self, $cd) = @_;
16 2093     2093   3706 $self->superclause_comparable('in', $cd);
17 2093         5484 };
18             has_clause 'is',
19             v => 2,
20             tags => ['constraint'],
21             schema => ['_same', {req=>1}],
22             allow_expr => 1,
23             code => sub {
24             my ($self, $cd) = @_;
25 2223     2223   4520 $self->superclause_comparable('is', $cd);
26 2223         6301 };
27              
28             our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
29             our $DATE = '2022-08-20'; # DATE
30             our $DIST = 'Data-Sah'; # DIST
31             our $VERSION = '0.912'; # VERSION
32              
33             1;
34             # ABSTRACT: Comparable type role
35              
36              
37             =pod
38              
39             =encoding UTF-8
40              
41             =head1 NAME
42              
43             Data::Sah::Type::Comparable - Comparable type role
44              
45             =head1 VERSION
46              
47             This document describes version 0.912 of Data::Sah::Type::Comparable (from Perl distribution Data-Sah), released on 2022-08-20.
48              
49             =head1 DESCRIPTION
50              
51             Role consumer must provide method C<superclause_comparable> which will be given
52             normal C<%args> given to clause methods, but with extra key C<-which> (either
53             C<in>, C<is>).
54              
55             =for Pod::Coverage ^(clause_.+|clausemeta_.+)$
56              
57             =head1 HOMEPAGE
58              
59             Please visit the project's homepage at L<https://metacpan.org/release/Data-Sah>.
60              
61             =head1 SOURCE
62              
63             Source repository is at L<https://github.com/perlancar/perl-Data-Sah>.
64              
65             =head1 AUTHOR
66              
67             perlancar <perlancar@cpan.org>
68              
69             =head1 CONTRIBUTING
70              
71              
72             To contribute, you can send patches by email/via RT, or send pull requests on
73             GitHub.
74              
75             Most of the time, you don't need to build the distribution yourself. You can
76             simply modify the code, then test via:
77              
78             % prove -l
79              
80             If you want to build the distribution (e.g. to try to install it locally on your
81             system), you can install L<Dist::Zilla>,
82             L<Dist::Zilla::PluginBundle::Author::PERLANCAR>,
83             L<Pod::Weaver::PluginBundle::Author::PERLANCAR>, and sometimes one or two other
84             Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond
85             that are considered a bug and can be reported to me.
86              
87             =head1 COPYRIGHT AND LICENSE
88              
89             This software is copyright (c) 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015, 2014, 2013, 2012 by perlancar <perlancar@cpan.org>.
90              
91             This is free software; you can redistribute it and/or modify it under
92             the same terms as the Perl 5 programming language system itself.
93              
94             =head1 BUGS
95              
96             Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=Data-Sah>
97              
98             When submitting a bug or request, please include a test-file or a
99             patch to an existing test-file that illustrates the bug or desired
100             feature.
101              
102             =cut