| 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
Condition0%0/3
ref $entry and $entry->isa("HTML::Widget")
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")
| |||||||||||||||||||||||||||||||||||||||||||
| 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
Condition0%0/6
$name and $entry->exists($name) and $element->can("value")
$name and $entry->exists($name)
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")
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | my $v = $entry->get_value($name); | |||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | ▶ | if ($DECODE) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 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
Condition0%0/3
ref $entry and $entry->isa("HTML::Widget::Result")
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")
| |||||||||||||||||||||||||||||||||||||||||||
| 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
Condition0%0/6
ref $self and $self->isa("Net::LDAP") || $self->isa("Catalyst::Model::LDAP::Connection")
$self->isa("Net::LDAP") or $self->isa("Catalyst::Model::LDAP::Connection")
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")
| |||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | ▶ | $ldap = $self->_ldap_client if (ref($self) and $self->isa('Catalyst::Model::LDAP::Entry') && $self->_ldap_client); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
ref $self and ($self->isa("Catalyst::Model::LDAP::Entry") and $self->_ldap_client)
$self->isa("Catalyst::Model::LDAP::Entry") and $self->_ldap_client
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
| |||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | ▶ | croak("No LDAP connection: " . ref($self)) unless $ldap; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | ▶ | foreach my $oc ( ref $entry->get_value('objectClass') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | return $entry->update($ldap); | |||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | __END__ | ||||||||||||||||||||||||||||||||||||||||||