#! /usr/bin/env perl
use v5.10.1;
use strict;
use warnings;
use Pod::Usage;
use lib "../../";
use ACU::Log;
use ACU::LDAP;
sub get_students
{
my $ldap = LDAP::ldap_connect();
my $year = shift // LDAP::get_year($ldap);
return LDAP::search_dns($ldap, "ou=$year,ou=users", "objectClass=epitaAccount", "cn", "uid", "uidNumber");
}
if ($#ARGV == -1) {
log(USAGE, "$0 format");
say "format can be csv"
elsif ($ARGV[0] eq "csv")
for my $student (get_students $ARGV[1])
print $student->get_value("cn");
print ",";
print $student->get_value("uid");
print $student->get_value("uidNumber");
say ",Present";