| 1 | package App::LDAP::Command::Add::Host; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 1 | ▶ | use Modern::Perl; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | 1 | ▶ | use Moose; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 1 | with qw( App::LDAP::Role::Command | |||||||||||||||||||
| 8 | App::LDAP::Role::Bindable ); | ||||||||||||||||||||
| 9 | |||||||||||||||||||||
| 10 | 1 | has base => ( | |||||||||||||||||||
| 11 | is => "rw", | ||||||||||||||||||||
| 12 | isa => "Str", | ||||||||||||||||||||
| 13 | ); | ||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | 1 | ▶ | use Term::Prompt; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 16 | |||||||||||||||||||||
| 17 | 1 | ▶ | use App::LDAP::LDIF::Host; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 18 | |||||||||||||||||||||
| 19 | 0 | ▶ | sub run { | ||||||||||||||||||
|
Subroutine
run: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||
| 20 | 0 | my ($self) = shift; | |||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | 0 | ▶ | my $hostname = $self->extra_argv->[2] or die "no hostname specified"; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | die "host $hostname already exists" if App::LDAP::LDIF::Host->search( | ||||||||||||||||||||
| 25 | base => config()->{nss_base_hosts}->[0], | ||||||||||||||||||||
| 26 | 0 | ▶ | scope => config()->{nss_base_hosts}->[1], | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 27 | filter => "cn=$hostname", | ||||||||||||||||||||
| 28 | ); | ||||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | 0 | my $ip = prompt('x', 'ip address:', '', ''); | |||||||||||||||||||
| 31 | |||||||||||||||||||||
| 32 | my $host = App::LDAP::LDIF::Host->new( | ||||||||||||||||||||
| 33 | 0 | ▶ | base => $self->base // config()->{nss_base_hosts}->[0], | ||||||||||||||||||
|
Condition0%0/3
$self->base // config()->{"nss_base_hosts"}[0]
MC/DC0%0/2
$self->base // config()->{"nss_base_hosts"}[0]
$self->base
config()->{"nss_base_hosts"}[0]
Truth table0%0/3
A // B
A= $self->baseB= config()->{"nss_base_hosts"}[0]
| |||||||||||||||||||||
| 34 | cn => [$hostname], | ||||||||||||||||||||
| 35 | ipHostNumber => $ip, | ||||||||||||||||||||
| 36 | ); | ||||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | 0 | $host->save; | |||||||||||||||||||
| 39 | |||||||||||||||||||||
| 40 | 0 | $host; | |||||||||||||||||||
| 41 | } | ||||||||||||||||||||
| 42 | |||||||||||||||||||||
| 43 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||
| 44 | 1 | ▶ | no Moose; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | 1 | 1; | |||||||||||||||||||