File Coverage

blib/lib/App/LDAP/LDIF/Host.pm
Criterion Covered Total %
statement 4 6 66.6
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 6 8 75.0


line stmt bran cond sub pod time code
1             package App::LDAP::LDIF::Host;
2              
3 1     1   6 use Modern::Perl;
  1         3  
  1         8  
4              
5 1     1   744 use Moose;
  0            
  0            
6              
7             extends qw(
8             App::LDAP::ObjectClass::IpHost
9             App::LDAP::ObjectClass::Device
10             App::LDAP::LDIF
11             );
12              
13             around BUILDARGS => sub {
14             my $orig = shift;
15             my $self = shift;
16             push @_, ( dn => "cn=" . {@_}->{cn}[0] . "," . {@_}->{base} ) if grep /^base$/, @_;
17             $self->$orig(@_);
18             };
19              
20             has '+objectClass' => (
21             default => sub {
22             [
23             qw( top
24             ipHost
25             device )
26             ]
27             },
28             );
29              
30             __PACKAGE__->meta->make_immutable;
31             no Moose;
32              
33             1;
34              
35             =pod
36              
37             =head1 NAME
38              
39             App::LDAP::LDIF::Host - the representation of hosts in LDAP
40              
41             =head1 SYNOPSIS
42              
43             my $host = App::LDAP::LDIF::Host->new(
44             base => $base, # the OU (organization unit) which the host belongs to
45             cn => [$name1, $name2], # the host name
46             ipHostNumber => $ipHostNumber, # the ip of this host
47             );
48              
49             my $entry = $host->entry;
50             # get the host as a instance of Net::Ldap::Entry
51              
52             my $host = App::LDAP::LDIF::Host->new($entry)
53             # new from a Net::LDAP::Entry instance
54              
55             =cut