Skip to content

Commit

Permalink
ldapsearch added
Browse files Browse the repository at this point in the history
  • Loading branch information
Marc Chantreux committed Jan 19, 2014
1 parent 95854cd commit 89aa897
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/Perlude/Sh.pm
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package Perlude::Sh;
use YAML;
use Modern::Perl;
use Perlude;
use parent 'Exporter';
our @EXPORT_OK = qw< sh ls cat zcat csv cat_with read_file from_dir >;
our @EXPORT_OK = qw< sh ls cat zcat csv cat_with read_file from_dir ldapsearch >;
our %EXPORT_TAGS = ( all => \@EXPORT_OK );
our $VERSION = '0.1';

Expand Down Expand Up @@ -108,4 +109,13 @@ sub csv {
}
}

sub ldapsearch {
my $ldap = shift;
my $rs = $ldap->search( @_ );
say join ',', map $rs->$_, qw< code count >;
my @entries = $rs->entries;
sub { (shift @entries) // () }
}


1;

0 comments on commit 89aa897

Please sign in to comment.