summaryrefslogtreecommitdiff
path: root/b/membres/dump.pl
blob: d6227b9ad65a037108a33015134af5d3fce8df1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/perl -w
#
# Liste des membres.
#
use strict;

our %membres;
do 'membres.pl' or die;


if (scalar @ARGV != 1 && scalar @ARGV != 2)
{
    print <<EOF;
$0 - affiche une liste des membres.

Utilisation : $0 'code perl' [ann�e]

Variables disponibles :
    login, nom, nick, promo, adresse, tel, telparents, devise
Variables anuelles :
    role, taches, bureau, cotiz, dispo

Exemple :

Affiche une liste pour l'acc�s au local pour l'importer directement dans un
format Excel demand� par l'admin :
    $0 'print "\$nom;\$promo\\n" if \$promo >= 2006' 2006

Affiche la liste des d�veloppeurs :
    $0 'print "\$role\\t\$nom\\n" if \$role' 2006

Affiche toutes les personnes qui on un jour particip� au robot :
    $0 'print "\$nom\\n"'

� vous d'imaginer d'autre commandes !
EOF
    exit 1;
}

my ($p, $year) = @ARGV;

for (keys %membres)
{
    # 'D�compresse' le hash.
    my $login = $_;
    my $m = $membres{$_};
    next unless !defined $year || exists $$m{$year};
    my ($nom, $nick, $promo, $adresse, $tel, $telparents, $devise) =
	($$m{'nom'}, $$m{'nick'}, $$m{'promo'}, $$m{'adresse'}, $$m{'tel'},
	    $$m{'telparents'}, $$m{'devise'});
    if (defined $year)
    {
	my $y = $$m{$year};
	my ($role, $taches, $bureau, $cotiz, $dispo) =
	($$y{'role'}, $$y{'taches'}, $$y{'bureau'}, $$y{'cotiz'},
	    $$y{'dispo'});
	eval $p;
    }
    else
    {
	eval $p;
    }
}