| 1 | package App::LDAP::Command::Search; | ||
| 2 | |||
| 3 | use Modern::Perl; | ||
| 4 | |||
| 5 | use Moose; | ||
| 6 | |||
| 7 | with qw( App::LDAP::Role::Command | ||
| 8 | App::LDAP::Role::Bindable ); | ||
| 9 | |||
| 10 | sub run { | ||
| 11 | my ($self, ) = @_; | ||
| 12 | |||
| 13 | my $filter = $self->extra_argv->[1] or die "no filter specified"; | ||
| 14 | |||
| 15 | my @entries = ldap()->search( | ||
| 16 | base => config()->{base}, | ||
| 17 | scope => "sub", | ||
| 18 | filter => $filter, | ||
| 19 | )->entries; | ||
| 20 | |||
| 21 | for (@entries) { | ||
| 22 | say $_->ldif; | ||
| 23 | } | ||
| 24 | } | ||
| 25 | |||
| 26 | __PACKAGE__->meta->make_immutable; | ||
| 27 | no Moose; | ||
| 28 | |||
| 29 | 1; |