#! /usr/bin/env perl use v5.10.1; use strict; use warnings; use File::Basename; use lib "../../"; use ACU::LDAP; use ACU::Log; use ACU::Process; if ($#ARGV >= 1) { my $project_id = shift; my $year = shift; if ($year !~ /^[0-9]{4}$/) { unshift @_, $year; $year = LDAP::get_year(); } my %files; for my $f (@_) { open my $input, "<", $f or die("$f: $@"); my $cnt; $cnt .= $_ while (<$input>); close $input unless $input eq *STDIN; $files{ basename($f, ".txt", ".lst", ".list", ".xml") } = $cnt; } if (my $err = Process::Client::launch("intradata_get", { action => "new_bonus", type => "grades", id => $project_id, "year" => $year }, \%files)) { if (${ $err } ne "Ok") { log ERROR, "Erreur durant le processus de publication : " . ${ $err }; } } } else { say "$0 [-d] [project_year] [files ...]"; say "\t-d: delete bonus for listed logins (matching value if given)" }