Commit 4c423c33 authored by Martin Mareš's avatar Martin Mareš

Access: parse_op uz neni potreba

parent 8c4e52a1
#!/usr/bin/perl
# Parse XML output of opreport
use strict;
use warnings;
use XML::Simple;
# use Data::Dumper;
my $x = XMLin($ARGV[0], ForceArray => 1);
# print STDERR Dumper($x);
my $events = $x->{'setup'}->[0]->{'eventsetup'};
my $classes = $x->{'classes'}->[0]->{'class'};
my %class_to_event;
for my $c (keys %$classes) {
my $d = $classes->{$c};
my $e = $events->{$d->{'event'}}->{'eventname'};
# print "$c: $e\n";
$class_to_event{$c} = $e;
}
my $bin = $x->{'binary'};
my $thisbin = (values %{$bin})[0];
for my $c (@{$thisbin->{'count'}}) {
# print Dumper($c);
if (ref($c) eq "HASH") {
print $class_to_event{$c->{'class'}}, " ", $c->{'content'}+0, "\n";
} else {
print $events->{0}->{'eventname'}, " ", $c+0, "\n";
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment