1Net::SSH::Perl::Comp(3)User Contributed Perl DocumentatioNnet::SSH::Perl::Comp(3)
2
3
4

NAME

6       Net::SSH::Perl::Comp - Compression/Decompression base class
7

SYNOPSIS

9           use Net::SSH::Perl::Comp;
10           my $comp = Net::SSH::Perl::Comp->new( $comp_type );
11           $comp->compress($data);
12

DESCRIPTION

14       Net::SSH::Perl::Comp is a base class for compression/decompression
15       classes. Currently the only such class is the Zlib implementation
16       (using Compress::Zlib), which is the class Net::SSH::Perl::Comp::Zlib.
17
18       Each compression object generally has its own internal "state"; this
19       state changes when you compress or decompress data. The SSH protocol
20       dictates that you must have two separate objects to compress and
21       decompress data: one for compression, one for decompression. So, for
22       example, you would create two Net::SSH::Perl::Comp objects:
23
24           my $in = Net::SSH::Perl::Comp->new('Zlib');
25           my $inflated = $in->decompress($data);
26
27           my $out = Net::SSH::Perl::Comp->new('Zlib');
28           my $deflated = $out->compress($data);
29

USAGE

31   $comp = Net::SSH::Perl::Comp->new( $comp_type [, @args ] )
32       Constructs a new compression object of compression type $comp_type and
33       returns that object.
34
35       If @args are provided, the class's init method is called with those
36       arguments, for any post-creation initialization.
37
38   $comp->init($level)
39       Initializes $comp and sets the compression level to $level.  This
40       method will be called automatically from new if you've provided @args
41       to new. So, for example, you could write:
42
43           my $comp = Net::SSH::Perl::Comp->new('Zlib', 5);
44
45       To create a new Zlib compression object and initialize its compression
46       level to 5.
47
48   $comp->compress( $data )
49       Compresses $data using the underlying compression mechanism; returns
50       the compressed data.
51
52   $comp->decompress( $data )
53       Decompresses $data using the underlying decompression mechanism;
54       returns the decompressed data.
55
56   $comp->enable
57       "Enables" the compression object. This is useful in the context of the
58       key exchange (Kex) classes, which create a new compression object
59       during key negotiation, but don't actually turn it on ("enable" it)
60       until receiving/sending the SSH2_MSG_NEWKEYS message.
61
62       Net::SSH::Perl::Comp objects (and subclasses) are disabled by default.
63
64   $comp->enabled
65       Returns the state of the "enabled" flag, ie. whether the compression
66       object is "turned on".
67
68       This is used by Net::SSH::Perl::Packet when determining whether data it
69       receives/sends to the server should be decompressed/compressed,
70       respectively.
71

AUTHOR & COPYRIGHTS

73       Please see the Net::SSH::Perl manpage for author, copyright, and
74       license information.
75
76
77
78perl v5.32.0                      2020-07-28           Net::SSH::Perl::Comp(3)
Impressum