| 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
| |||||||||||||||||||||
| 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
MC/DC0%0/2
shift() || $self->_ldap_client
shift()
$self->_ldap_client
Truth table0%0/3
A || B
A= shift()B= $self->_ldap_client
| |||||||||||||||||||||
| 31 | 0 | ▶ | croak 'No LDAP client provided to update' unless $client; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 40 | 0 | ▶ | $self->exists($method) || $self->SUPER::can($method); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 48 | |||||||||||||||||||||
| 49 | 2 | ▶ | croak qq[Can't locate object method "$attribute" via package "] | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 50 | . ref($self) . qq["] | ||||||||||||||||||||
| 51 | unless $self->exists($attribute); | ||||||||||||||||||||
| 52 | |||||||||||||||||||||
| 53 | 2 | ▶ | if ( scalar @args ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 54 | 0 | $self->replace( $attribute, @args ); | |||||||||||||||||||
| 55 | } | ||||||||||||||||||||
| 56 | |||||||||||||||||||||
| 57 | 2 | return $self->get_value($attribute); | |||||||||||||||||||
| 58 | } | ||||||||||||||||||||
| 59 | |||||||||||||||||||||
| 60 | |||||||||||||||||||||
| 61 | 2 | 1; | |||||||||||||||||||
| 62 | |||||||||||||||||||||
| 63 | __END__ | ||||||||||||||||||||