Model/LDAP/Entry.pm

filter: Statementstmt 81.0% 30 / 37 Branchbran 42.8% 6 / 14 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 88.8% 8 / 9 Podpod 100% 3 / 3 totaltotal 69.1% 47 / 68 CC 9 SCAR 15.0
CC
9
Cov
67%
update
12.0
can
4.7
AUTOLOAD
4.2
CRAP 4.5
« Model/LDAP.pm ↑ Summary Model/LDAP/Search.pm »
1 package Catalyst::Model::LDAP::Entry;
2 # ABSTRACT: Convenience methods for Net::LDAP::Entry
3  
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use base qw/Net::LDAP::Entry Class::Accessor::Fast/;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use Carp qw/croak/;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use MRO::Compat;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 __PACKAGE__->mk_accessors(qw/_ldap_client/);
11  
12  
13 1 ▶sub new {
Subroutine new: called CC=2 SCAR=7.2
Pod documented
14 1 my ( $class, $dn, %attributes ) = @_;
15  
16 1 my $client = delete $attributes{_ldap_client};
17  
18 1 my $self = $class->next::method( $dn, %attributes );
19  
20 1 ▶ if ($client) {
Branch: 1 branch
BranchTrueFalseTotal
if ($client) 0 1 1
21 0 $self->_ldap_client($client);
22 }
23  
24 1 return $self;
25 }
26  
27  
28 0 ▶sub update {
Subroutine update: not called CC=3 SCAR=24.8
Pod documented
29 0 my $self = shift;
30 0 ▶ my $client = shift || $self->_ldap_client;
Condition0%0/3
shift() || $self->_ldap_client
l!l&&r!l&&!r
000
MC/DC0%0/2
shift() || $self->_ldap_client
shift() $self->_ldap_client
Truth table0%0/3
A || B
A= shift()B= $self->_ldap_client
ABresult
1X1
011
000
31 0 ▶ croak 'No LDAP client provided to update' unless $client;
Branch: 1 branch
BranchTrueFalseTotal
unless $client 0 0 0
32  
33 0 return $self->next::method( $client, @_ );
34 }
35  
36  
37 2 ▶sub can {
Subroutine can: called CC=3 SCAR=15.4
Pod documented
38 2 my ( $self, $method ) = @_;
39 2 ▶ return 0 unless ref($self);
Branch: 1 branch
BranchTrueFalseTotal
unless ref $self 2 0 2
40 0 ▶ $self->exists($method) || $self->SUPER::can($method);
Branch: 1 branch
BranchTrueFalseTotal
$self->exists($method) or $self->SUPER::can($method) 0 0 0
41 }
42  
43 3 ▶sub AUTOLOAD {
Subroutine AUTOLOAD: called CC=4 SCAR=14.3
44 3 my ( $self, @args ) = @_;
45  
46 3 my ($attribute) = ( our $AUTOLOAD =~ /([^:]+)$/ );
47 3 ▶ return if $attribute eq 'DESTROY';
Branch: 1 branch
BranchTrueFalseTotal
if $attribute eq "DESTROY" 1 2 3
48  
49 2 ▶ croak qq[Can't locate object method "$attribute" via package "]
Branch: 1 branch
BranchTrueFalseTotal
unless $self->exists($attribute) 0 2 2
50 . ref($self) . qq["]
51 unless $self->exists($attribute);
52  
53 2 ▶ if ( scalar @args ) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @args) 0 2 2
54 0 $self->replace( $attribute, @args );
55 }
56  
57 2 return $self->get_value($attribute);
58 }
59  
60  
61 2 1;
62  
63 __END__
« Model/LDAP.pm ↑ Summary Model/LDAP/Search.pm »