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   160936 use 5.008000;
  3         12  
4 3     3   17 use strict;
  3         7  
  3         92  
5 3     3   14 use warnings;
  3         9  
  3         192  
6 3     3   16 use parent qw/Exporter/;
  3         10  
  3         18  
7              
8             our @EXPORT = qw/unbro/;
9             our @EXPORT_OK = @EXPORT;
10              
11             our $VERSION = '0.020';
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 134     134 1 18129711 my ($buffer, $decoded_size) = @_;
23 134 100       634 if (defined $decoded_size) {
24 89         85059 return unbro_given_size($buffer, $decoded_size)
25             } else {
26 45         643 my $bro = IO::Uncompress::Brotli->create;
27 45         42026 return $bro->decompress($buffer);
28             }
29             }
30              
31             1;
32             __END__