#!/usr/bin/perl -s -Ilib use warnings; use strict; no strict 'refs'; our $stdin; use Data::Dumper; use CROSS::DMOSS; use CROSS::DMOSS::Reporters; my $dmoss; if ($stdin) { $dmoss = CROSS::DMOSS::from_stdout(); } else { my $file = shift; $file = 'dmoss.data' unless $file; $dmoss = CROSS::DMOSS::load($file); } my $output = __start_html_report(); my $total = 0; my $count = 0; my $reporters = $dmoss->reporters; my %html; foreach (keys %$reporters) { my $f = $reporters->{$_}; my $html = &{"CROSS::DMOSS::Reporters::$f"}($dmoss); # XXX if ($html =~ m/(\w+)<\/span/) { my $g = $1; if ($g =~ m/a/i) {$total += 5} if ($g =~ m/b/i) {$total += 4} if ($g =~ m/c/i) {$total += 3} if ($g =~ m/d/i) {$total += 2} if ($g =~ m/f/i) {$total += 0} $count++; } # /XXX if ($html and ($html=~m/grade_(\w)\W/) ) { my $l = lc $1; $html{$l} .= $html; } #$output .= $html if $html; } foreach (sort keys %html) { $output .= $html{$_}; } my %grades = (5=>'A',4=>'B',3=>'C',2=>'D',1=>'D',0=>'F'); my $final = int($total/$count); $final = $grades{$final}; $output .= "
"; $output .= "$finalFinal\n"; $output .= "
\n"; print $output; sub __start_html_report { my $html =<<'HTML'; HTML return $html; }