Slackget/Network/Backend/Bzip2.pm untested

filter: Statementstmt 0.0% 0 / 32 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 50 CC 5 SCAR 20.1
CC
5
Cov
0%
backend_decode
12.0
backend_encode
12.0
new
2.0
CRAP 7.5
1 package Slackware::Slackget::Network::Backend::Bzip2;
2  
3 use warnings;
4 use strict;
5 require Slackware::Slackget::Network::Message ;
6 use Compress::Bzip2 ;
7  
8 =head1 NAME
9  
10 Slackware::Slackget::Network::Backend::Bzip2 - Bzip2 backend for slack-get network protocol
11  
12 =head1 VERSION
13  
14 Version 0.8.0
15  
16 =cut
17  
18 our $VERSION = '0.8.0';
19  
20 =head1 SYNOPSIS
21  
22 Still to do
23  
24 =cut
25  
26 sub new
27 {
28 my ($class,%args) = @_ ;
29 my $self = {%args};
30 bless($self,$class);
31 return $self;
32 }
33  
34 =head1 CONSTRUCTOR
35  
36 =head2 new
37  
38 Still to do
39  
40 =head1 FUNCTIONS
41  
42 All methods return a Slackware::Slackget::Network::Message (L<Slackware::Slackget::Network::Message>) object, and if the remote slack-getd return some data they are accessibles via the data() accessor of the Slackware::Slackget::Network::Message object.
43  
44 =cut
45  
46 =head2 backend_decode
47  
48 =cut
49  
50 sub backend_decode {
51 my $self = shift;
52 my $Bzip2_msg = shift;
53 print "[Slackware::Slackget::Network::Backend::Bzip2] call backend_decode($Bzip2_msg).\n" if($ENV{SG_DAEMON_DEBUG}) ;
54 my $raw = $Bzip2_msg->data ;
55 my $data = memBunzip( $raw );
56 print "[Slackware::Slackget::Network::Backend::Bzip2] decoded data are :\n".$data."\n" if($ENV{SG_DAEMON_DEBUG}) ;
57 return Slackware::Slackget::Network::Message->new(raw_data => $data);
58 }
59  
60 =head2 backend_encode
61  
62 =cut
63  
64 sub backend_encode {
65 my $self = shift;
66 my $message = shift ;
67 print "[Slackware::Slackget::Network::Backend::Bzip2] call backend_encode($message).\n" if($ENV{SG_DAEMON_DEBUG}) ;
68 my $raw = $message->data();
69 my $Bzip2 = memBzip($raw);
70 print "[Slackware::Slackget::Network::Backend::Bzip2] encoded Bzip2:\n$Bzip2\n" if($ENV{SG_DAEMON_DEBUG});
71 return Slackware::Slackget::Network::Message->new(
72 action => $message->action,
73 action_id => $message->{action_id},
74 raw_data => $Bzip2,
75 );
76 }
77  
78  
79  
80 =head1 AUTHOR
81  
82 DUPUIS Arnaud, C<< <a.dupuis@infinityperl.org> >>
83  
84 =head1 BUGS
85  
86 Please report any bugs or feature requests to
87 C<bug-Slackware-Slackget@rt.cpan.org>, or through the web interface at
88 L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Slackware-Slackget>.
89 I will be notified, and then you'll automatically be notified of progress on
90 your bug as I make changes.
91  
92 =head1 SUPPORT
93  
94 You can find documentation for this module with the perldoc command.
95  
96 perldoc Slackware::Slackget
97  
98  
99 You can also look for information at:
100  
101 =over 4
102  
103 =item * Infinity Perl website
104  
105 L<http://www.infinityperl.org/category/slack-get>
106  
107 =item * slack-get specific website
108  
109 L<http://slackget.infinityperl.org>
110  
111 =item * RT: CPAN's request tracker
112  
113 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Slackware-Slackget>
114  
115 =item * AnnoCPAN: Annotated CPAN documentation
116  
117 L<http://annocpan.org/dist/Slackware-Slackget>
118  
119 =item * CPAN Ratings
120  
121 L<http://cpanratings.perl.org/d/Slackware-Slackget>
122  
123 =item * Search CPAN
124  
125 L<http://search.cpan.org/dist/Slackware-Slackget>
126  
127 =back
128  
129 =head1 ACKNOWLEDGEMENTS
130  
131 Thanks to Bertrand Dupuis (yes my brother) for his contribution to the documentation.
132  
133 =head1 SEE ALSO
134  
135 L<Slackware::Slackget::Network::Message>, L<Slackware::Slackget::Status>, L<Slackware::Slackget::Network::Connection>
136  
137 =head1 COPYRIGHT & LICENSE
138  
139 Copyright 2005 DUPUIS Arnaud, All Rights Reserved.
140  
141 This program is free software; you can redistribute it and/or modify it
142 under the same terms as Perl itself.
143  
144 =cut
145  
146 1; # End of Slackware::Slackget::Network::Backend::Bzip2