Analysis/Listener/Example1.pm untested

filter: Statementstmt 0.0% 0 / 17 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 26 CC 2 SCAR 12.0
CC
2
Cov
0%
tcp_monologue
6.0
example_bandwidth_measurement_event
2.0
BEGIN
2.0
CRAP 3.3
1 package Net::Analysis::Listener::Example1;
2 # $Id: Example1.pm 140 2005-10-21 16:31:29Z abworrall $
3  
4 use strict;
5 use warnings;
6 use base qw(Net::Analysis::Listener::Base);
7  
8 sub tcp_monologue {
9 my ($self, $args) = @_;
10 my ($mono) = $args->{monologue}; # isa Net::Analysis::TCPMonologue
11  
12 my $t = $mono->t_elapsed()->as_number();
13 my $l = $mono->length();
14  
15 $self->emit(name => 'example_bandwidth_measurement_event',
16 args => { kb_sec => ($t) ? $l/($t*1024) : 0 }
17 );
18 }
19  
20 sub example_bandwidth_measurement_event {
21 my ($self, $args) = @_;
22  
23 printf "Bandwidth: %10.2f KB/sec\n", $args->{kb_sec};
24 }
25  
26 1;
27  
28 __END__