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

AUTHOR & COPYRIGHTS

79       Please see the Net::SSH::Perl manpage for author, copyright, and
80       license information.
81
82
83
84perl v5.8.8                       2003-12-03           Net::SSH::Perl::Comp(3)
Impressum