File Coverage

blib/lib/IO/Uncompress/Brotli.pm
Criterion Covered Total %
statement 16 16 100.0
branch 2 2 100.0
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 24 24 100.0


line stmt bran cond sub pod time code
1             package IO::Uncompress::Brotli;
2              
3 3     3   70330 use 5.014000;
  3         17  
4 3     3   14 use strict;
  3         4  
  3         55  
5 3     3   13 use warnings;
  3         5  
  3         75  
6 3     3   337 use parent qw/Exporter/;
  3         245  
  3         21  
7              
8             our @EXPORT = qw/unbro/;
9             our @EXPORT_OK = @EXPORT;
10              
11             our $VERSION = '0.004_002';
12              
13             require XSLoader;
14             XSLoader::load('IO::Compress::Brotli', $VERSION);
15              
16             # 0.004001 has unbro with prototype $$
17             # 0.004_002 renames it to unbro_given_size, and provides unbro with
18             # prototype $;$ which calls:
19             # * unbro_given_size when called with two arguments
20             # * the OO interface when called with one argument
21             sub unbro ($;$) {
22 122     122 1 9727828 my ($buffer, $decoded_size) = @_;
23 122 100       388 if (defined $decoded_size) {
24 80         40470 return unbro_given_size($buffer, $decoded_size)
25             } else {
26 42         298 my $bro = IO::Uncompress::Brotli->create;
27 42         21140 return $bro->decompress($buffer);
28             }
29             }
30              
31             1;
32             __END__