lib/HTTP/Promise/Headers/WantDigest.pm

filter: Statementstmt 100% 22 / 22 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 100% 1 / 1 totaltotal 96.8% 31 / 32 CC 2 SCAR 2.3
CC
2
Cov
96%
init
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« lib/HTTP/Promise/Headers/TE.pm ↑ Summary lib/HTTP/Promise/Headers/ContentSecurityPolicyReportOnly.pm »
1 ##----------------------------------------------------------------------------
2 ## Asynchronous HTTP Request and Promise - ~/lib/HTTP/Promise/Headers/WantDigest.pm
3 ## Version v0.1.0
4 ## Copyright(c) 2022 DEGUEST Pte. Ltd.
5 ## Author: Jacques Deguest <jack@deguest.jp>
6 ## Created 2022/05/09
7 ## Modified 2022/05/09
8 ## All rights reserved.
9 ##
10 ##
11 ## This program is free software; you can redistribute it and/or modify it
12 ## under the same terms as Perl itself.
13 ##----------------------------------------------------------------------------
14 package HTTP::Promise::Headers::WantDigest;
15 BEGIN
16 {
17 3 ▶ use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 3 ▶ use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 3 ▶ warnings::register_categories( 'HTTP::Promise' );
Subroutine BEGIN: called CC=1 SCAR=0.0
20 3 ▶ use parent qw( HTTP::Promise::Headers::Accept );
Subroutine BEGIN: called CC=1 SCAR=0.0
21 3 our $VERSION = 'v0.1.0';
22 };
23  
24 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27 sub init
28 {
29 4 ▶ my $self = shift( @_ );
Subroutine init: called CC=2 SCAR=7.0
Pod documented
30 4 ▶ $self->SUPER::init( @_ ) || return( $self->pass_error );
Branch: 1 branch
BranchTrueFalseTotal
$self->SUPER::init(@_) or return $self->pass_error 0 4 4
31 4 $self->_field_name( 'Want-Digest' );
32 4 return( $self );
33 }
34  
35 3 1;
36 # NOTE: POD
37 __END__
38  
39 =encoding utf-8
40  
41 =head1 NAME
42  
43 HTTP::Promise::Headers::WantDigest - Want-Digest Header Field
44  
45 =head1 SYNOPSIS
46  
47 use HTTP::Promise::Headers::WantDigest;
48 my $want = HTTP::Promise::Headers::WantDigest->new ||
49 die( HTTP::Promise::Headers::WantDigest->error, "\n" );
50 my $e = $te->add( 'sha-256' );
51 # Set deflate with a weight of 0.3
52 my $e1 = $te->add( 'SHA-512' => 0.5 );
53 my $e2 = $te->get( $e1 );
54 # $e1 and $e2 are the same
55 my $e2 = $te->get( 'SHA-512' );
56 say $e2->value; # 0.5
57 $e2->value(0.7); # Change it to 0.7
58 say "$te";
59 # sha-256, SHA-512;q=0.7
60  
61 =head1 VERSION
62  
63 v0.1.0
64  
65 =head1 DESCRIPTION
66  
67 This class inherits all its features from L<HTTP::Promise::Headers::Accept>
68  
69 The following description is taken from Mozilla documentation.
70  
71 Example:
72  
73 Want-Digest: sha-256
74 Want-Digest: SHA-512;q=0.3, sha-256;q=1, md5;q=0
75  
76 =head1 METHODS
77  
78 See L<HTTP::Promise::Headers::Accept>
79  
80 =head1 THREAD-SAFETY
81  
82 This module is thread-safe for all operations, as it operates on per-object state and uses thread-safe external libraries.
83  
84 =head1 AUTHOR
85  
86 Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
87  
88 =head1 SEE ALSO
89  
90 See also L<Mozilla documentation|https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Want-Digest>
91  
92 L<HTTP::Promise>, L<HTTP::Promise::Request>, L<HTTP::Promise::Response>, L<HTTP::Promise::Message>, L<HTTP::Promise::Entity>, L<HTTP::Promise::Headers>, L<HTTP::Promise::Body>, L<HTTP::Promise::Body::Form>, L<HTTP::Promise::Body::Form::Data>, L<HTTP::Promise::Body::Form::Field>, L<HTTP::Promise::Status>, L<HTTP::Promise::MIME>, L<HTTP::Promise::Parser>, L<HTTP::Promise::IO>, L<HTTP::Promise::Stream>, L<HTTP::Promise::Exception>
93  
94 =head1 COPYRIGHT & LICENSE
95  
96 Copyright(c) 2022 DEGUEST Pte. Ltd.
97  
98 All rights reserved.
99  
100 This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
101  
102 =cut
« lib/HTTP/Promise/Headers/TE.pm ↑ Summary lib/HTTP/Promise/Headers/ContentSecurityPolicyReportOnly.pm »