Annotation of loncom/debugging_tools/activity_log_counting.pl, revision 1.1

1.1     ! albertel    1: use strict;
        !             2: use XML::Simple;
        !             3: my $ref = XMLin('activity.log.xml');
        !             4: my %what;
        !             5: my %who;
        !             6: print("Parsed\n");
        !             7: foreach my $key1 (keys(%$ref)) {
        !             8:     foreach my $element (@{$ref->{$key1}}) {
        !             9: 	if (ref($element) eq 'HASH') {
        !            10: 	    my $res = (split(m{(?:/|%2f)},$element->{'resource'}))[-1];
        !            11: 	    $res = &unescape($res);
        !            12: 	    $what{$element->{'student'}}{$res}++;
        !            13: 	    $who{$res}{$element->{'student'}}++;
        !            14: 	}
        !            15:     }
        !            16: }
        !            17: 
        !            18: use Data::Dumper;
        !            19: $Data::Dumper::Sortkeys=1;
        !            20: print(&Dumper(\%who));
        !            21: 
        !            22: sub unescape {
        !            23:     my $str=shift;
        !            24:     $str =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
        !            25:     return $str;
        !            26: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>