/usr/share/doc/libobject-event-perl/examples/benchmark is in libobject-event-perl 1.230-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | #!/usr/bin/perl
package foo;
use common::sense;
use base qw/Object::Event/;
sub new {
my $this = shift;
my $class = ref($this) || $this;
$class->SUPER::new (@_);
}
our $cnt;
sub test : event_cb { $cnt++ }
package main;
use common::sense;
use Benchmark qw/:all/;
my $f = foo->new;
for (1..10) {
$f->reg_cb (test => sub {
my ($f) = @_;
$foo::cnt++;
});
}
my $ev;
timethese (250000, {
simple => sub { $f->event ('test') },
method => sub { $f->test }
});
print "$foo::cnt\n";
|