| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package App::LDAP::Command::Import; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use Modern::Perl; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
676
|
use Moose; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
with qw( App::LDAP::Role::Command |
|
8
|
|
|
|
|
|
|
App::LDAP::Role::Bindable ); |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
use Net::LDAP::LDIF; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub run { |
|
13
|
|
|
|
|
|
|
my ($self) = shift; |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
shift @ARGV; |
|
16
|
|
|
|
|
|
|
process($_) for @ARGV; |
|
17
|
|
|
|
|
|
|
} |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub process { |
|
20
|
|
|
|
|
|
|
my ($file) = @_; |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
if (-f $file) { |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
say "import $file..."; |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
my $ldif = Net::LDAP::LDIF->new($file, "r", onerror => 'die'); |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
while (!$ldif->eof) { |
|
29
|
|
|
|
|
|
|
my $entry = $ldif->read_entry; |
|
30
|
|
|
|
|
|
|
my $msg = ldap()->add($entry); |
|
31
|
|
|
|
|
|
|
warn $msg->error() if $msg->code; |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
} else { |
|
35
|
|
|
|
|
|
|
say "$_ don\'t exist. skip."; |
|
36
|
|
|
|
|
|
|
return; |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=pod |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 NAME |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
App::LDAP::Command::Import |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
$ ldap import people.ldif |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=cut |