File: simple

package info (click to toggle)
libexception-class-perl 1.45-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 372 kB
  • sloc: perl: 529; sh: 23; makefile: 2
file content (24 lines) | stat: -rw-r--r-- 465 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use strict;
use warnings;

use Moose;
use Benchmark qw( timethese );

use Exception::Class (
    'Ex1',
    Ex2 => { isa => 'Ex1' },
);

timethese(
    10_000, {
        'one arg' => sub {
            eval { Ex1->throw('foo') };
        },
        'named error arg' => sub {
            eval { Ex1->throw( error => 'foo' ) };
        },
        'several args' => sub {
            eval { Ex1->throw( message => 'foo', ignore_class => 'Bar' ) };
        },
    }
);