File Coverage

blib/lib/Compress/Zstd.pm
Criterion Covered Total %
statement 14 14 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 19 19 100.0


line stmt bran cond sub pod time code
1             package Compress::Zstd;
2 5     5   358793 use 5.008001;
  5         60  
3 5     5   27 use strict;
  5         7  
  5         110  
4 5     5   23 use warnings;
  5         8  
  5         130  
5 5     5   22 use Exporter 'import';
  5         9  
  5         428  
6              
7             our $VERSION = "0.20";
8              
9             our @EXPORT = qw(
10             compress
11             compress_mt
12             decompress
13             uncompress
14             ZSTD_VERSION_NUMBER
15             ZSTD_VERSION_STRING
16             ZSTD_MAX_CLEVEL
17             );
18              
19 5     5   34 use XSLoader;
  5         9  
  5         299  
20             XSLoader::load(__PACKAGE__, $VERSION);
21              
22             1;
23             __END__
24              
25             =encoding utf-8
26              
27             =head1 NAME
28              
29             Compress::Zstd - Perl interface to the Zstd (Zstandard) (de)compressor
30              
31             =head1 SYNOPSIS
32              
33             use Compress::Zstd;
34              
35             my $compressed = compress($bytes);
36             my $decompressed = decompress($compressed);
37              
38             =head1 DESCRIPTION
39              
40             The Compress::Zstd module provides an interface to the Zstd (de)compressor.
41              
42             =head1 FUNCTIONS
43              
44             =head2 compress($source [, $level])
45              
46             Compresses the given buffer and returns the resulting bytes. The input
47             buffer can be either a scalar or a scalar reference.
48              
49             On error undef is returned.
50              
51             =head2 compress_mt($source, $num_threads [, $level])
52              
53             Multi-threaded version of the C<compress> function.
54              
55             Note that this function uses experimental API of Zstandard.
56              
57             =head2 decompress($source)
58              
59             =head2 uncompress($source)
60              
61             Decompresses the given buffer and returns the resulting bytes. The input
62             buffer can be either a scalar or a scalar reference.
63              
64             On error (in case of corrupted data) undef is returned.
65              
66             =head1 CONSTANTS
67              
68             =head2 ZSTD_VERSION_NUMBER
69              
70             =head2 ZSTD_VERSION_STRING
71              
72             =head2 ZSTD_MAX_CLEVEL
73              
74             =head1 SEE ALSO
75              
76             L<http://www.zstd.net/>
77              
78             =head1 LICENSE
79              
80             Copyright (c) 2016, Jiro Nishiguchi
81             All rights reserved.
82              
83             Redistribution and use in source and binary forms, with or without modification,
84             are permitted provided that the following conditions are met:
85              
86             1. Redistributions of source code must retain the above copyright notice, this
87             list of conditions and the following disclaimer.
88              
89             2. Redistributions in binary form must reproduce the above copyright notice,
90             this list of conditions and the following disclaimer in the documentation
91             and/or other materials provided with the distribution.
92              
93             THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
94             ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
95             WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
96             DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
97             ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
98             (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
99             LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
100             ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
101             (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
102             SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
103              
104             =head1 AUTHOR
105              
106             Jiro Nishiguchi E<lt>jiro@cpan.orgE<gt>
107              
108             Zstandard by Facebook, Inc.
109              
110             =cut