Slackget/Network/Backend/TEST.pm untested

filter: Statementstmt 0.0% 0 / 29 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 46 CC 5 SCAR 23.0
CC
5
Cov
0%
backend_decode
20.0
backend_encode
6.0
new
2.0
CRAP 10.0
1 package Slackware::Slackget::Network::Backend::TEST;
2  
3 use warnings;
4 use strict;
5 require Slackware::Slackget::Network::Message ;
6  
7 =head1 NAME
8  
9 Slackware::Slackget::Network::Backend::TEST - TEST backend for slack-get network protocol
10  
11 =head1 VERSION
12  
13 Version 0.8.0
14  
15 =cut
16  
17 our $VERSION = '0.8.0';
18  
19 =head1 SYNOPSIS
20  
21 Still to do
22  
23 =cut
24  
25 sub new
26 {
27 my ($class,%args) = @_ ;
28 my $self = {%args};
29 bless($self,$class);
30 return $self;
31 }
32  
33 =head1 CONSTRUCTOR
34  
35 =head2 new
36  
37 Still to do
38  
39 =head1 FUNCTIONS
40  
41 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.
42  
43 =cut
44  
45 =head2 backend_decode
46  
47 =cut
48  
49 sub backend_decode {
50 my $self = shift;
51 my $test_msg = shift;
52 print "[Slackware::Slackget::Network::Backend::TEST] call backend_decode($test_msg).\n" if($ENV{SG_DAEMON_DEBUG}) ;
53 my $data = $test_msg->data ;
54 print "[Slackware::Slackget::Network::Backend::TEST] got data:\n$data.\n" if($ENV{SG_DAEMON_DEBUG}) ;
55 $data =~ s/\?\?TEST\?\?//;
56 $data =~ s/!!TEST!!//;
57 print "[Slackware::Slackget::Network::Backend::TEST] return data:\n$data.\n" if($ENV{SG_DAEMON_DEBUG}) ;
58 return Slackware::Slackget::Network::Message->new(
59 action => $test_msg->{Enveloppe}->{Action}->{content},
60 action_id => $test_msg->{Enveloppe}->{Action}->{id},
61 raw_data => $data,
62 );
63 }
64  
65 =head2 backend_encode
66  
67 =cut
68  
69 sub backend_encode {
70 my $self = shift;
71 my $message = shift ;
72 print "[Slackware::Slackget::Network::Backend::TEST] call backend_encode($message).\n" if($ENV{SG_DAEMON_DEBUG}) ;
73 $message->data( "??TEST??\n".$message->data()."\n!!TEST!!" );
74 return $message;
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::TEST