Filename | /Users/ether/.perlbrew/libs/36.0@std/lib/perl5/JSON/Schema/Modern/Error.pm |
Statements | Executed 4257 statements in 20.1ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
4217 | 1 | 1 | 21.3ms | 78.5ms | __ANON__[:39] | JSON::Schema::Modern::Error::
1 | 1 | 1 | 7.43ms | 10.2ms | BEGIN@18 | JSON::Schema::Modern::Error::
1 | 1 | 1 | 2.06ms | 16.4ms | BEGIN@21 | JSON::Schema::Modern::Error::
1 | 1 | 1 | 32µs | 35µs | BEGIN@1.66 | JSON::Schema::Modern::
1 | 1 | 1 | 20µs | 54µs | BEGIN@13 | JSON::Schema::Modern::Error::
1 | 1 | 1 | 15µs | 877µs | BEGIN@20 | JSON::Schema::Modern::Error::
1 | 1 | 1 | 13µs | 640µs | BEGIN@11 | JSON::Schema::Modern::Error::
1 | 1 | 1 | 13µs | 36µs | BEGIN@24 | JSON::Schema::Modern::Error::
1 | 1 | 1 | 10µs | 10µs | BEGIN@9 | JSON::Schema::Modern::Error::
1 | 1 | 1 | 9µs | 360µs | BEGIN@19 | JSON::Schema::Modern::Error::
1 | 1 | 1 | 8µs | 17µs | BEGIN@14 | JSON::Schema::Modern::Error::
1 | 1 | 1 | 8µs | 17µs | BEGIN@15 | JSON::Schema::Modern::Error::
1 | 1 | 1 | 8µs | 16µs | BEGIN@16 | JSON::Schema::Modern::Error::
1 | 1 | 1 | 6µs | 37µs | BEGIN@2.67 | JSON::Schema::Modern::
1 | 1 | 1 | 6µs | 190µs | BEGIN@10 | JSON::Schema::Modern::Error::
1 | 1 | 1 | 6µs | 93µs | BEGIN@12 | JSON::Schema::Modern::Error::
1 | 1 | 1 | 5µs | 88µs | BEGIN@17 | JSON::Schema::Modern::Error::
0 | 0 | 0 | 0s | 0s | TO_JSON | JSON::Schema::Modern::Error::
0 | 0 | 0 | 0s | 0s | __ANON__[:24] | JSON::Schema::Modern::Error::
0 | 0 | 0 | 0s | 0s | __ANON__[:51] | JSON::Schema::Modern::Error::
0 | 0 | 0 | 0s | 0s | dump | JSON::Schema::Modern::Error::
0 | 0 | 0 | 0s | 0s | stringify | JSON::Schema::Modern::Error::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | 2 | 32µs | 2 | 38µs | # spent 35µs (32+3) within JSON::Schema::Modern::BEGIN@1.66 which was called:
# once (32µs+3µs) by JSON::Schema::Modern::BEGIN@33 at line 1 # spent 35µs making 1 call to JSON::Schema::Modern::BEGIN@1.66
# spent 3µs making 1 call to strict::import |
2 | 2 | 38µs | 2 | 68µs | # spent 37µs (6+31) within JSON::Schema::Modern::BEGIN@2.67 which was called:
# once (6µs+31µs) by JSON::Schema::Modern::BEGIN@33 at line 2 # spent 37µs making 1 call to JSON::Schema::Modern::BEGIN@2.67
# spent 31µs making 1 call to warnings::import |
3 | package JSON::Schema::Modern::Error; | ||||
4 | # vim: set ts=8 sts=2 sw=2 tw=100 et : | ||||
5 | # ABSTRACT: Contains a single error from a JSON Schema evaluation | ||||
6 | |||||
7 | 1 | 1µs | our $VERSION = '0.556'; | ||
8 | |||||
9 | 2 | 27µs | 1 | 10µs | # spent 10µs within JSON::Schema::Modern::Error::BEGIN@9 which was called:
# once (10µs+0s) by JSON::Schema::Modern::BEGIN@33 at line 9 # spent 10µs making 1 call to JSON::Schema::Modern::Error::BEGIN@9 |
10 | 2 | 25µs | 2 | 374µs | # spent 190µs (6+184) within JSON::Schema::Modern::Error::BEGIN@10 which was called:
# once (6µs+184µs) by JSON::Schema::Modern::BEGIN@33 at line 10 # spent 190µs making 1 call to JSON::Schema::Modern::Error::BEGIN@10
# spent 184µs making 1 call to Moo::import |
11 | 3 | 42µs | 3 | 1.27ms | # spent 640µs (13+627) within JSON::Schema::Modern::Error::BEGIN@11 which was called:
# once (13µs+627µs) by JSON::Schema::Modern::BEGIN@33 at line 11 # spent 640µs making 1 call to JSON::Schema::Modern::Error::BEGIN@11
# spent 612µs making 1 call to strictures::import
# spent 15µs making 1 call to strictures::VERSION |
12 | 2 | 33µs | 2 | 180µs | # spent 93µs (6+87) within JSON::Schema::Modern::Error::BEGIN@12 which was called:
# once (6µs+87µs) by JSON::Schema::Modern::BEGIN@33 at line 12 # spent 93µs making 1 call to JSON::Schema::Modern::Error::BEGIN@12
# spent 87µs making 1 call to experimental::import |
13 | 2 | 27µs | 2 | 56µs | # spent 54µs (20+34) within JSON::Schema::Modern::Error::BEGIN@13 which was called:
# once (20µs+34µs) by JSON::Schema::Modern::BEGIN@33 at line 13 # spent 54µs making 1 call to JSON::Schema::Modern::Error::BEGIN@13
# spent 2µs making 1 call to if::import |
14 | 2 | 18µs | 2 | 18µs | # spent 17µs (8+9) within JSON::Schema::Modern::Error::BEGIN@14 which was called:
# once (8µs+9µs) by JSON::Schema::Modern::BEGIN@33 at line 14 # spent 17µs making 1 call to JSON::Schema::Modern::Error::BEGIN@14
# spent 1µs making 1 call to if::unimport |
15 | 2 | 19µs | 2 | 18µs | # spent 17µs (8+9) within JSON::Schema::Modern::Error::BEGIN@15 which was called:
# once (8µs+9µs) by JSON::Schema::Modern::BEGIN@33 at line 15 # spent 17µs making 1 call to JSON::Schema::Modern::Error::BEGIN@15
# spent 1µs making 1 call to if::unimport |
16 | 2 | 13µs | 2 | 16µs | # spent 16µs (8+8) within JSON::Schema::Modern::Error::BEGIN@16 which was called:
# once (8µs+8µs) by JSON::Schema::Modern::BEGIN@33 at line 16 # spent 16µs making 1 call to JSON::Schema::Modern::Error::BEGIN@16
# spent 0s making 1 call to if::unimport |
17 | 2 | 18µs | 2 | 171µs | # spent 88µs (5+83) within JSON::Schema::Modern::Error::BEGIN@17 which was called:
# once (5µs+83µs) by JSON::Schema::Modern::BEGIN@33 at line 17 # spent 88µs making 1 call to JSON::Schema::Modern::Error::BEGIN@17
# spent 83µs making 1 call to Exporter::import |
18 | 2 | 226µs | 1 | 10.2ms | # spent 10.2ms (7.43+2.73) within JSON::Schema::Modern::Error::BEGIN@18 which was called:
# once (7.43ms+2.73ms) by JSON::Schema::Modern::BEGIN@33 at line 18 # spent 10.2ms making 1 call to JSON::Schema::Modern::Error::BEGIN@18 |
19 | 2 | 30µs | 2 | 711µs | # spent 360µs (9+351) within JSON::Schema::Modern::Error::BEGIN@19 which was called:
# once (9µs+351µs) by JSON::Schema::Modern::BEGIN@33 at line 19 # spent 360µs making 1 call to JSON::Schema::Modern::Error::BEGIN@19
# spent 351µs making 1 call to MooX::TypeTiny::import |
20 | 2 | 113µs | 2 | 1.74ms | # spent 877µs (15+862) within JSON::Schema::Modern::Error::BEGIN@20 which was called:
# once (15µs+862µs) by JSON::Schema::Modern::BEGIN@33 at line 20 # spent 877µs making 1 call to JSON::Schema::Modern::Error::BEGIN@20
# spent 862µs making 1 call to Exporter::Tiny::import |
21 | 2 | 944µs | 2 | 16.8ms | # spent 16.4ms (2.06+14.4) within JSON::Schema::Modern::Error::BEGIN@21 which was called:
# once (2.06ms+14.4ms) by JSON::Schema::Modern::BEGIN@33 at line 21 # spent 16.4ms making 1 call to JSON::Schema::Modern::Error::BEGIN@21
# spent 389µs making 1 call to namespace::clean::import |
22 | |||||
23 | use overload | ||||
24 | 2 | 501µs | 2 | 59µs | # spent 36µs (13+23) within JSON::Schema::Modern::Error::BEGIN@24 which was called:
# once (13µs+23µs) by JSON::Schema::Modern::BEGIN@33 at line 24 # spent 36µs making 1 call to JSON::Schema::Modern::Error::BEGIN@24
# spent 23µs making 1 call to overload::import |
25 | |||||
26 | 1 | 5µs | 2 | 22.4ms | has [qw( # spent 22.4ms making 1 call to JSON::Schema::Modern::Error::has
# spent 1µs making 1 call to Types::Standard::Str |
27 | instance_location | ||||
28 | keyword_location | ||||
29 | error | ||||
30 | )] => ( | ||||
31 | is => 'ro', | ||||
32 | isa => Str, | ||||
33 | required => 1, | ||||
34 | ); | ||||
35 | |||||
36 | has absolute_keyword_location => ( | ||||
37 | is => 'ro', | ||||
38 | isa => InstanceOf['Mojo::URL'], | ||||
39 | 4217 | 17.9ms | 4217 | 57.2ms | # spent 78.5ms (21.3+57.2) within JSON::Schema::Modern::Error::__ANON__[/Users/ether/.perlbrew/libs/36.0@std/lib/perl5/JSON/Schema/Modern/Error.pm:39] which was called 4217 times, avg 19µs/call:
# 4217 times (21.3ms+57.2ms) by JSON::Schema::Modern::Error::new at line 68 of (eval 432)[Sub/Quote.pm:3], avg 19µs/call # spent 57.2ms making 4217 calls to Safe::Isa::__ANON__[Safe/Isa.pm:23], avg 14µs/call |
40 | 1 | 10µs | 2 | 4.77ms | ); # spent 4.03ms making 1 call to Types::Standard::InstanceOf
# spent 746µs making 1 call to JSON::Schema::Modern::Error::has |
41 | |||||
42 | 1 | 14µs | 4 | 3.47ms | has keyword => ( # spent 2.71ms making 1 call to Type::Tiny::__ANON__[Type/Tiny.pm:126]
# spent 760µs making 1 call to JSON::Schema::Modern::Error::has
# spent 2µs making 1 call to Types::Standard::Str
# spent 2µs making 1 call to Types::Standard::Undef |
43 | is => 'ro', | ||||
44 | isa => Str|Undef, | ||||
45 | required => 1, | ||||
46 | ); | ||||
47 | |||||
48 | has exception => ( | ||||
49 | is => 'ro', | ||||
50 | isa => InstanceOf['JSON::PP::Boolean'], | ||||
51 | coerce => sub { $_[0] ? JSON::PP::true : JSON::PP::false }, | ||||
52 | 1 | 5µs | 2 | 837µs | ); # spent 480µs making 1 call to JSON::Schema::Modern::Error::has
# spent 357µs making 1 call to Types::Standard::InstanceOf |
53 | |||||
54 | 1 | 6µs | 2 | 4.00ms | has mode => ( # spent 2.94ms making 1 call to Types::Standard::Enum
# spent 1.06ms making 1 call to JSON::Schema::Modern::Error::has |
55 | is => 'rw', | ||||
56 | isa => Enum[qw(traverse evaluate)], | ||||
57 | ); | ||||
58 | |||||
59 | sub TO_JSON ($self) { | ||||
60 | return +{ | ||||
61 | # note that locations are JSON pointers, not uri fragments! | ||||
62 | instanceLocation => $self->instance_location, | ||||
63 | keywordLocation => $self->keyword_location, | ||||
64 | !defined($self->absolute_keyword_location) ? () | ||||
65 | : ( absoluteKeywordLocation => $self->absolute_keyword_location->to_string ), | ||||
66 | error => $self->error, # TODO: allow localization | ||||
67 | }; | ||||
68 | } | ||||
69 | |||||
70 | sub stringify ($self) { | ||||
71 | ($self->mode//'evaluate') eq 'traverse' | ||||
72 | ? '\''.$self->keyword_location.'\': '.$self->error | ||||
73 | : '\''.$self->instance_location.'\': '.$self->error; | ||||
74 | } | ||||
75 | |||||
76 | sub dump ($self) { | ||||
77 | my $encoder = JSON::MaybeXS->new(utf8 => 0, convert_blessed => 1, canonical => 1, pretty => 1); | ||||
78 | $encoder->indent_length(2) if $encoder->can('indent_length'); | ||||
79 | $encoder->encode($self); | ||||
80 | } | ||||
81 | |||||
82 | 1 | 22µs | 1; | ||
83 | |||||
84 | 1 | 48µs | 1 | 527µs | __END__ # spent 527µs making 1 call to B::Hooks::EndOfScope::XS::__ANON__[B/Hooks/EndOfScope/XS.pm:26] |