blib/lib/Net/MQTT/Simple/Auth.pm untested

filter: Statementstmt 0.0% 0 / 12 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 3 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 17 CC 1 SCAR 6.9
CC
1
Cov
0%
new
2.0
_send_connect
2.0
BEGIN
2.0
CRAP 2.0
1 package Net::MQTT::Simple::Auth;
2  
3 use parent 'Net::MQTT::Simple';
4  
5 our $VERSION = '0.001';
6  
7 sub new {
8 my ($class, $server, $user, $password, $sockopts) = @_;
9 # @_ == 2 or @_ == 3 or _croak "Wrong number of arguments for $class->new";
10  
11 my $self = $class->SUPER::new ($server, $sockopts);
12  
13 $self->{mqtt_user} = $user;
14 $self->{mqtt_password} = $password;
15  
16 return $self;
17 }
18  
19 sub _send_connect {
20 my ($self) = @_;
21  
22 $self->_send("\x10" . Net::MQTT::Simple::_prepend_variable_length( pack (
23 "x C/a* C C n n/a* n/a* n/a*",
24 $Net::MQTT::Simple::PROTOCOL_NAME,
25 0x03,
26 0xC2,
27 $Net::MQTT::Simple::KEEPALIVE_INTERVAL,
28 $self->_client_identifier,
29 $self->{mqtt_user},
30 $self->{mqtt_password}
31 )));
32 }
33  
34  
35 1;
36  
37 __END__