blib/lib/Net/API/RPX/Exception/Usage.pm

filter: Statementstmt 100% 29 / 29 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod n/a totaltotal 100% 37 / 37 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/Net/API/RPX/Exception/Service.pm ↑ Summary
1 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 package Net::API::RPX::Exception::Usage;
3 BEGIN {
4 6 ▶ $Net::API::RPX::Exception::Usage::AUTHORITY = 'cpan:KONOBI';
Subroutine BEGIN: called CC=1 SCAR=0.0
5 }
6 {
7 6 $Net::API::RPX::Exception::Usage::VERSION = '0.04';
8 }
9  
10 # ABSTRACT: For when the interface is used wrongly
11 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 6 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 6 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 6 extends 'Net::API::RPX::Exception';
17  
18 6 has 'required_parameter' => ( isa => 'Str', is => 'rw', required => 1 );
19 6 has 'method_name' => ( isa => 'Str', is => 'rw', required => 1 );
20 6 has 'signature' => ( isa => 'Str', is => 'rw', required => 1 );
21 6 has 'package' => ( isa => 'Str', is => 'rw', required => 1 );
22  
23 sub _signature_string {
24 12 ▶ my ($self) = @_;
Subroutine _signature_string: called CC=1 SCAR=0.0
25 12 return $self->method_name . '(' . $self->signature . ')';
26 }
27  
28 sub _explanation {
29 12 ▶ my ($self) = @_;
Subroutine _explanation: called CC=1 SCAR=0.0
30 return
31 12 sprintf q{Method %s on package %s expects the parameter "%s"}
32 . qq{\n\n}
33 . qq{\tUsage:\t%s\n}, $self->method_name,
34 $self->package,
35 $self->required_parameter, $self->_signature_string;
36 }
37  
38 around message => sub {
39 12 ▶ my ( $orig, $self, @args ) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
40 12 return $self->$orig(@args) . qq{\n} . $self->_explanation;
41 6 };
42  
43 6 __PACKAGE__->_immutable;
44 6 1;
45  
46  
47 __END__
48 =pod
49  
50 =head1 NAME
51  
52 Net::API::RPX::Exception::Usage - For when the interface is used wrongly
53  
54 =head1 VERSION
55  
56 version 0.04
57  
58 =head1 AUTHORS
59  
60 =over 4
61  
62 =item *
63  
64 Scott McWhirter <konobi@cpan.org>
65  
66 =item *
67  
68 Kent Fredric <kentnl@cpan.org>
69  
70 =back
71  
72 =head1 COPYRIGHT AND LICENSE
73  
74 This software is Copyright (c) 2012 by Cloudtone Studios.
75  
76 This is free software, licensed under:
77  
78 The (three-clause) BSD License
79  
80 =cut
81  
« blib/lib/Net/API/RPX/Exception/Service.pm ↑ Summary