File Coverage

lib/Net/Minecraft/LoginFailure.pm
Criterion Covered Total %
statement 19 27 70.3
branch 0 10 0.0
condition n/a
subroutine 7 11 63.6
pod 2 2 100.0
total 28 50 56.0


line stmt bran cond sub pod time code
1 3     3   2532 use v5.16;
  3         12  
  3         157  
2 3     3   16 use warnings;
  3         5  
  3         135  
3              
4             package Net::Minecraft::LoginFailure {
5              
6             # ABSTRACT: Result info for a Minecraft Login.
7              
8 3     3   1070 use Moo;
  3         35503  
  3         21  
9             with 'Net::Minecraft::Role::LoginResult';
10              
11 3     3   6136 use Carp qw( confess );
  3         7  
  3         236  
12 3     3   2018 use Params::Validate qw( validate SCALAR );
  3         14025  
  3         404  
13 3     3   24 use overload q{""} => 'as_string';
  3         6  
  3         32  
14              
15              
16 0     0 1   sub is_success { return; }
17              
18              
19             has code => ( is => rwp =>, required => 1, isa => \&_defined_scalar_number );
20             has reason => ( is => rwp =>, required => 1, isa => \&_defined_scalar );
21              
22              
23             sub as_string {
24 0     0 1   my ($self) = @_;
25 0           return sprintf q[Login Failed: %s => %s], $self->code, $self->reason;
26             }
27              
28             ## no critic ( RequireArgUnpacking RequireFinalReturn )
29             sub _defined_scalar_number {
30 0 0   0     confess q[parameter is not a defined value] unless defined $_[0];
31 0 0         confess q[parameter is not a scalar] if ref $_[0];
32 0 0         confess q[parameter is not a number] unless $_[0] =~ /^\d{1,3}$/;
33             }
34              
35             sub _defined_scalar {
36 0 0   0     confess q[parameter is not a defined value] unless defined $_[0];
37 0 0         confess q[parameter is not a scalar] if ref $_[0];
38             }
39             };
40             BEGIN {
41 3     3   1315 $Net::Minecraft::LoginFailure::AUTHORITY = 'cpan:KENTNL';
42             }
43             {
44             $Net::Minecraft::LoginFailure::VERSION = '0.002000';
45             }
46              
47             1;
48              
49             __END__