8 use Data::Dump qw(dump);
10 my $xs = XML::Simple->new();
16 open(my $fh, '<:encoding(utf-8)', 'contributions/all.xml');
23 #warn "---xml---", dump($xml), "---/xml---\n";
25 foreach my $xml ( split(/\Q<?xml\E/, $xml) ) {
29 $xml = '<?xml' . $xml;
33 $abstract = $xs->XMLin( $xml, ForceArray => qw(PrimaryAuthor) );
35 warn "# abstract = ", dump($abstract);
37 my $id = $abstract->{'Id'}->[0] || die "no Id in ",dump($abstract);
38 warn "# $id abstract = ", dump($abstract);
40 foreach my $k (qw( ContributionType )) {
41 push @{ $stat->{$k}->{ $abstract->{$k}->[0] } }, $id;
44 if ( $abstract->{'ContributionType'}->[0] eq 'Symposium proposal' ) {
45 my $t = $abstract->{Title}->[0];
46 push @{ $stat->{_symposium}->{ $t } }, -$id;
49 if ( my $s = $abstract->{Symposium_title} ) {
51 push @{ $stat->{_symposium}->{$s} }, $id;
54 if ( exists $abstract->{PrimaryAuthor}->[0]->{FamilyName} ) {
55 $stat->{_order_by}->{$id} = $abstract->{PrimaryAuthor}->[0]->{FamilyName}->[0];
58 $abstracts->{ $id } = $abstract;
62 #warn "# stat = ",dump($stat);
66 my $csv = Text::CSV->new ( { binary => 1 } ) # should set binary attribute.
67 or die "Cannot use CSV: ".Text::CSV->error_diag ();
71 open my $fh, "<:encoding(utf8)", "session-code.csv" or die "csv: $!";
72 while ( my $row = $csv->getline( $fh ) ) {
76 $csv->eof or $csv->error_diag();
79 open(my $program_fh, '>', 'program.html');
80 print $program_fh qq{<table>\n};
82 foreach my $p ( sort { $a->[6] cmp $b->[6] || $a->[1] cmp $b->[1] } @program ) {
83 my $abstract = $abstracts->{ $p->[0] } || die "no abstract for ", $p->[0];
85 foreach my $a ( @{ $abstract->{PrimaryAuthor} } ) {
86 $authors .= '; ' . $a->{FamilyName}->[0] . ', ' . $a->{FirstName}->[0];
89 print $program_fh "<tr><td>", join("</td><td>", $p->[1], $p->[6], $p->[0], $p->[4] . '<br>' . $authors), "</td></tr>\n";