Slackget/Network/Backend/Base64.pm untested

filter: Statementstmt 0.0% 0 / 30 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 / 48 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::Base64;
2  
3 use warnings;
4 use strict;
5 require Slackware::Slackget::Network::Message ;
6 use MIME::Base64 ();
7  
8 =head1 NAME
9  
10 Slackware::Slackget::Network::Backend::Base64 - Base64 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 $Base64_msg = shift;
53 print "[Slackware::Slackget::Network::Backend::Base64] call backend_decode($Base64_msg).\n" if($ENV{SG_DAEMON_DEBUG}) ;
54
55 my $data = MIME::Base64::decode( $Base64_msg->data );
56 print "[Slackware::Slackget::Network::Backend::Base64] 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::Base64] call backend_encode($message).\n" if($ENV{SG_DAEMON_DEBUG}) ;
68 my $Base64 = MIME::Base64::encode($message->data());
69 print "[Slackware::Slackget::Network::Backend::Base64] encoded Base64:\n$Base64\n" if($ENV{SG_DAEMON_DEBUG});
70 return Slackware::Slackget::Network::Message->new(
71 action => $message->action,
72 action_id => $message->{action_id},
73 raw_data => $Base64,
74 );
75 }
76  
77  
78  
79 =head1 AUTHOR
80  
81 DUPUIS Arnaud, C<< <a.dupuis@infinityperl.org> >>
82  
83 =head1 BUGS
84  
85 Please report any bugs or feature requests to
86 C<bug-Slackware-Slackget@rt.cpan.org>, or through the web interface at
87 L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Slackware-Slackget>.
88 I will be notified, and then you'll automatically be notified of progress on
89 your bug as I make changes.
90  
91 =head1 SUPPORT
92  
93 You can find documentation for this module with the perldoc command.
94  
95 perldoc Slackware::Slackget
96  
97  
98 You can also look for information at:
99  
100 =over 4
101  
102 =item * Infinity Perl website
103  
104 L<http://www.infinityperl.org/category/slack-get>
105  
106 =item * slack-get specific website
107  
108 L<http://slackget.infinityperl.org>
109  
110 =item * RT: CPAN's request tracker
111  
112 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Slackware-Slackget>
113  
114 =item * AnnoCPAN: Annotated CPAN documentation
115  
116 L<http://annocpan.org/dist/Slackware-Slackget>
117  
118 =item * CPAN Ratings
119  
120 L<http://cpanratings.perl.org/d/Slackware-Slackget>
121  
122 =item * Search CPAN
123  
124 L<http://search.cpan.org/dist/Slackware-Slackget>
125  
126 =back
127  
128 =head1 ACKNOWLEDGEMENTS
129  
130 Thanks to Bertrand Dupuis (yes my brother) for his contribution to the documentation.
131  
132 =head1 SEE ALSO
133  
134 L<Slackware::Slackget::Network::Message>, L<Slackware::Slackget::Status>, L<Slackware::Slackget::Network::Connection>
135  
136 =head1 COPYRIGHT & LICENSE
137  
138 Copyright 2005 DUPUIS Arnaud, All Rights Reserved.
139  
140 This program is free software; you can redistribute it and/or modify it
141 under the same terms as Perl itself.
142  
143 =cut
144  
145 1; # End of Slackware::Slackget::Network::Backend::Base64