From aebef9850ea59bfc48486292ace0e311eadaa120 Mon Sep 17 00:00:00 2001 From: Mercier Pierre-Olivier Date: Sun, 15 Sep 2013 12:32:50 +0200 Subject: [PATCH] Extract list of users by year --- commands/ldap/extract_students.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/commands/ldap/extract_students.pl b/commands/ldap/extract_students.pl index a1badb5..b9966e3 100644 --- a/commands/ldap/extract_students.pl +++ b/commands/ldap/extract_students.pl @@ -10,11 +10,11 @@ use lib "../../"; use ACU::Log; use ACU::LDAP; -sub get_students() +sub get_students { my $ldap = LDAP::ldap_connect(); - my $year = LDAP::get_year($ldap); + my $year = shift // LDAP::get_year($ldap); return LDAP::search_dns($ldap, "ou=$year,ou=users", "objectClass=epitaAccount", "cn", "uid", "uidNumber"); } @@ -25,7 +25,7 @@ if ($#ARGV == -1) { } elsif ($ARGV[0] eq "csv") { - for my $student (get_students) + for my $student (get_students $ARGV[1]) { print $student->get_value("cn"); print ",";