blib/lib/Net/LDAP/HTMLWidget.pm

filter: Statementstmt 32.4% 12 / 37 Branchbran 0.0% 0 / 18 Conditioncond 0.0% 0 / 24 MC/DCmcdc 0.0% 0 / 13 Subroutinesub 60.0% 3 / 5 Podpod 100% 2 / 2 totaltotal 17.1% 17 / 99 CC 21 SCAR 49.5
CC
21
Cov
15%
populate_from_widget
210.0
fill_widget
72.0
BEGIN
1.0
CRAP 140.8
↑ Summary
1 package Net::LDAP::HTMLWidget;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 our $VERSION = '0.07';
6 # pod after __END__
7 1 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 our $DECODE = 0;
9  
10 0 ▶sub fill_widget {
Subroutine fill_widget: not called CC=8 SCAR=42.8
Pod documented
11 0 my ($self,$entry,$widget)=@_;
12 0 ▶ if (ref($entry) and $entry->isa('HTML::Widget')) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $entry and $entry->isa("HTML::Widget")) 0 0 0
Condition0%0/3
ref $entry and $entry->isa("HTML::Widget")
!ll&&!rl&&r
000
MC/DC0%0/2
ref $entry and $entry->isa("HTML::Widget")
ref $entry $entry->isa("HTML::Widget")
Truth table0%0/3
A and B
A= ref $entryB= $entry->isa("HTML::Widget")
ABresult
0X0
100
111
13 0 $widget = $entry;
14 0 $entry = $self;
15 }
16 0 my @elements = $widget->find_elements;
17 0 foreach my $element ( @elements ) {
18 0 my $name=$element->name;
19 0 ▶ next unless $name && $entry->exists($name) && $element->can('value');
Branch: 1 branch
BranchTrueFalseTotal
unless $name and $entry->exists($name) and $element->can("value") 0 0 0
Condition0%0/6
$name and $entry->exists($name) and $element->can("value")
!ll&&!rl&&r
000
$name and $entry->exists($name)
!ll&&!rl&&r
000
MC/DC0%0/3
$name and $entry->exists($name) and $element->can("value")
$name $entry->exists($name) $element->can("value")
Truth table0%0/4
A and B and C
A= $nameB= $entry->exists($name)C= $element->can("value")
ABCresult
0XX0
10X0
1100
1111
20 0 my $v = $entry->get_value($name);
21 0 ▶ if ($DECODE) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Net::LDAP::HTMLWidget::DECODE) 0 0 0
22 0 $v = Encode::decode($DECODE, $v);
23 }
24 0 $element->value( $v );
25 }
26 }
27  
28  
29 0 ▶sub populate_from_widget {
Subroutine populate_from_widget: not called CC=14 SCAR=53.5
Pod documented
30 0 my ($self,$entry,$result,$ldap)=@_;
31 0 ▶ if (ref($entry) and $entry->isa('HTML::Widget::Result')) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $entry and $entry->isa("HTML::Widget::Result")) 0 0 0
Condition0%0/3
ref $entry and $entry->isa("HTML::Widget::Result")
!ll&&!rl&&r
000
MC/DC0%0/2
ref $entry and $entry->isa("HTML::Widget::Result")
ref $entry $entry->isa("HTML::Widget::Result")
Truth table0%0/3
A and B
A= ref $entryB= $entry->isa("HTML::Widget::Result")
ABresult
0X0
100
111
32 0 $ldap = $result;
33 0 $result = $entry;
34 0 $entry = $self;
35 }
36  
37 0 ▶ $ldap = $self if (ref $self && ($self->isa('Net::LDAP') || $self->isa('Catalyst::Model::LDAP::Connection')));
Branch: 1 branch
BranchTrueFalseTotal
if ref $self and $self->isa("Net::LDAP") || $self->isa("Catalyst::Model::LDAP::Connection") 0 0 0
Condition0%0/6
ref $self and $self->isa("Net::LDAP") || $self->isa("Catalyst::Model::LDAP::Connection")
!ll&&!rl&&r
000
$self->isa("Net::LDAP") or $self->isa("Catalyst::Model::LDAP::Connection")
l!l&&r!l&&!r
000
MC/DC0%0/3
ref $self and $self->isa("Net::LDAP") || $self->isa("Catalyst::Model::LDAP::Connection")
ref $self $self->isa("Net::LDAP") $self->isa("Catalyst::Model::LDAP::Connection")
Truth table0%0/4
A and B or C
A= ref $selfB= $self->isa("Net::LDAP")C= $self->isa("Catalyst::Model::LDAP::Connection")
ABCresult
0XX0
1000
11X1
1011
38 0 ▶ $ldap = $self->_ldap_client if (ref($self) and $self->isa('Catalyst::Model::LDAP::Entry') && $self->_ldap_client);
Branch: 1 branch
BranchTrueFalseTotal
if ref $self and ($self->isa("Catalyst::Model::LDAP::Entry") and $self->_ldap_client) 0 0 0
Condition0%0/6
ref $self and ($self->isa("Catalyst::Model::LDAP::Entry") and $self->_ldap_client)
!ll&&!rl&&r
000
$self->isa("Catalyst::Model::LDAP::Entry") and $self->_ldap_client
!ll&&!rl&&r
000
MC/DC0%0/3
ref $self and ($self->isa("Catalyst::Model::LDAP::Entry") and $self->_ldap_client)
ref $self $self->isa("Catalyst::Model::LDAP::Entry") $self->_ldap_client
Truth table0%0/4
A and B and C
A= ref $selfB= $self->isa("Catalyst::Model::LDAP::Entry")C= $self->_ldap_client
ABCresult
0XX0
10X0
1100
1111
39
40 0 ▶ croak("No LDAP connection: " . ref($self)) unless $ldap;
Branch: 1 branch
BranchTrueFalseTotal
unless $ldap 0 0 0
41
42 0 ▶ foreach my $oc ( ref $entry->get_value('objectClass')
Branch: 1 branch
BranchTrueFalseTotal
ref $entry->get_value('objectClass') ? : 0 0 0
43 0 ? @{$entry->get_value('objectClass')}
44 : ($entry->get_value('objectClass'))) {
45 0 foreach my $attr ($ldap->schema->must($oc),$ldap->schema->may($oc)) {
46 $entry->replace($attr->{name}, $result->param($attr->{name}))
47 0 ▶ if defined $result->param($attr->{name});
Branch: 1 branch
BranchTrueFalseTotal
if defined $result->param($attr->{"name"}) 0 0 0
48 }
49 }
50 0 return $entry->update($ldap);
51 }
52  
53  
54 1 1;
55  
56 __END__
↑ Summary