File Coverage

blib/lib/Plack/Middleware/Signposting.pm
Criterion Covered Total %
statement 13 13 100.0
branch 2 2 100.0
condition n/a
subroutine 3 3 100.0
pod 1 1 100.0
total 19 19 100.0


line stmt bran cond sub pod time code
1              
2             our $VERSION = '0.06';
3              
4             use Catmandu::Sane;
5 3     3   87583 use parent 'Plack::Middleware';
  3         152645  
  3         21  
6 3     3   677  
  3         5  
  3         17  
7             my ($self, @signs) = @_;
8              
9 7     7 1 1239 my $body = join(", ", map {
10             my ($uri, $relation, $type) = @$_;
11             my $link_text = qq|<$uri>; rel="$relation"|;
12 7         18 $link_text .= qq|; type="$type"| if $type;
  12         26  
13 12         30 $link_text;
14 12 100       33 } @signs);
15 12         36  
16             $body;
17             }
18 7         31  
19             1;
20              
21              
22             =encoding utf-8
23              
24             =head1 NAME
25              
26             Plack::Middleware::Signposting - a base class for Plack implementations of the L<Signposting|https://signposting.org> protocol
27              
28             =begin markdown
29              
30             ![Test status](https://github.com/LibreCat/Plack-Middleware-Signposting/actions/workflows/linux.yml/badge.svg)
31             [![Coverage Status](https://coveralls.io/repos/github/LibreCat/Plack-Middleware-Signposting/badge.svg?branch=master)](https://coveralls.io/github/LibreCat/Plack-Middleware-Signposting?branch=master)
32             [![CPANTS kwalitee](http://cpants.cpanauthors.org/dist/Plack-Middleware-Signposting.png)](http://cpants.cpanauthors.org/dist/Plack-Middleware-Signposting)
33              
34             =end markdown
35              
36             =head1 SYNOPSIS
37              
38             package Plack::Middleware::Signposting::Foo;
39              
40             use Moo;
41              
42             extends 'Plack::Middleware::Signposting';
43              
44             sub call {
45             my ($self, $env) = @_;
46              
47             ...
48             my @data = ("0001", $relation, $type);
49             $self->to_link_format(\@data);
50             }
51              
52             =head1 METHODS
53              
54             =over
55              
56             =item * to_link_format(\@ARRAY)
57              
58             This method produces the format for the link header.
59              
60             =back
61              
62             =head1 MODULES
63              
64             =over
65              
66             =item * L<Plack::Middleware::Signposting::JSON>
67              
68             =item * L<Plack::Middleware::Signposting::Catmandu>
69              
70             =back
71              
72             =head1 AUTHOR
73              
74             Vitali Peil, C<< <vitali.peil at uni-bielefeld.de> >>
75              
76             Nicolas Steenlant, C<< <nicolas.steenlant at ugent.be> >>
77              
78             =head1 CONTRIBUTORS
79              
80             Mohammad S Anwar (@manwar)
81              
82             =head1 LICENSE
83              
84             This library is free software; you can redistribute it and/or modify
85             it under the same terms as Perl itself.
86              
87              
88             =head1 SEE ALSO
89              
90             L<Plack::Middleware>
91              
92             =cut