Filename | /Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Error.pm |
Statements | Executed 4236 statements in 20.2ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
4196 | 1 | 1 | 20.3ms | 74.9ms | __ANON__[:39] | JSON::Schema::Modern::Error::
1 | 1 | 1 | 7.74ms | 10.4ms | BEGIN@18 | JSON::Schema::Modern::Error::
1 | 1 | 1 | 2.04ms | 23.2ms | BEGIN@21 | JSON::Schema::Modern::Error::
1 | 1 | 1 | 25µs | 28µs | BEGIN@1.66 | JSON::Schema::Modern::
1 | 1 | 1 | 12µs | 643µs | BEGIN@11 | JSON::Schema::Modern::Error::
1 | 1 | 1 | 12µs | 34µs | BEGIN@13 | JSON::Schema::Modern::Error::
1 | 1 | 1 | 10µs | 25µs | BEGIN@14 | JSON::Schema::Modern::Error::
1 | 1 | 1 | 10µs | 552µs | BEGIN@19 | JSON::Schema::Modern::Error::
1 | 1 | 1 | 10µs | 29µs | BEGIN@24 | JSON::Schema::Modern::Error::
1 | 1 | 1 | 8µs | 88µs | BEGIN@12 | JSON::Schema::Modern::Error::
1 | 1 | 1 | 8µs | 18µs | BEGIN@15 | JSON::Schema::Modern::Error::
1 | 1 | 1 | 7µs | 16µs | BEGIN@16 | JSON::Schema::Modern::Error::
1 | 1 | 1 | 7µs | 702µs | BEGIN@20 | JSON::Schema::Modern::Error::
1 | 1 | 1 | 7µs | 7µs | BEGIN@9 | JSON::Schema::Modern::Error::
1 | 1 | 1 | 6µs | 202µs | BEGIN@10 | JSON::Schema::Modern::Error::
1 | 1 | 1 | 6µs | 76µs | BEGIN@17 | JSON::Schema::Modern::Error::
1 | 1 | 1 | 5µs | 31µs | BEGIN@2.67 | JSON::Schema::Modern::
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 | 26µs | 2 | 31µs | # spent 28µs (25+3) within JSON::Schema::Modern::BEGIN@1.66 which was called:
# once (25µs+3µs) by JSON::Schema::Modern::BEGIN@33 at line 1 # spent 28µs making 1 call to JSON::Schema::Modern::BEGIN@1.66
# spent 3µs making 1 call to strict::import |
2 | 2 | 35µs | 2 | 57µs | # spent 31µs (5+26) within JSON::Schema::Modern::BEGIN@2.67 which was called:
# once (5µs+26µs) by JSON::Schema::Modern::BEGIN@33 at line 2 # spent 31µs making 1 call to JSON::Schema::Modern::BEGIN@2.67
# spent 26µ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 | 0s | our $VERSION = '0.559'; | ||
8 | |||||
9 | 2 | 27µs | 1 | 7µs | # spent 7µs within JSON::Schema::Modern::Error::BEGIN@9 which was called:
# once (7µs+0s) by JSON::Schema::Modern::BEGIN@33 at line 9 # spent 7µs making 1 call to JSON::Schema::Modern::Error::BEGIN@9 |
10 | 2 | 22µs | 2 | 398µs | # spent 202µs (6+196) within JSON::Schema::Modern::Error::BEGIN@10 which was called:
# once (6µs+196µs) by JSON::Schema::Modern::BEGIN@33 at line 10 # spent 202µs making 1 call to JSON::Schema::Modern::Error::BEGIN@10
# spent 196µs making 1 call to Moo::import |
11 | 3 | 45µs | 3 | 1.27ms | # spent 643µs (12+631) within JSON::Schema::Modern::Error::BEGIN@11 which was called:
# once (12µs+631µs) by JSON::Schema::Modern::BEGIN@33 at line 11 # spent 643µs making 1 call to JSON::Schema::Modern::Error::BEGIN@11
# spent 616µs making 1 call to strictures::import
# spent 15µs making 1 call to strictures::VERSION |
12 | 2 | 38µs | 2 | 168µs | # spent 88µs (8+80) within JSON::Schema::Modern::Error::BEGIN@12 which was called:
# once (8µs+80µs) by JSON::Schema::Modern::BEGIN@33 at line 12 # spent 88µs making 1 call to JSON::Schema::Modern::Error::BEGIN@12
# spent 80µs making 1 call to experimental::import |
13 | 2 | 24µs | 2 | 37µs | # spent 34µs (12+22) within JSON::Schema::Modern::Error::BEGIN@13 which was called:
# once (12µs+22µs) by JSON::Schema::Modern::BEGIN@33 at line 13 # spent 34µs making 1 call to JSON::Schema::Modern::Error::BEGIN@13
# spent 3µs making 1 call to if::import |
14 | 2 | 19µs | 2 | 27µs | # spent 25µs (10+15) within JSON::Schema::Modern::Error::BEGIN@14 which was called:
# once (10µs+15µs) by JSON::Schema::Modern::BEGIN@33 at line 14 # spent 25µs making 1 call to JSON::Schema::Modern::Error::BEGIN@14
# spent 2µs making 1 call to if::unimport |
15 | 2 | 17µs | 2 | 19µs | # spent 18µs (8+10) within JSON::Schema::Modern::Error::BEGIN@15 which was called:
# once (8µs+10µs) by JSON::Schema::Modern::BEGIN@33 at line 15 # spent 18µs making 1 call to JSON::Schema::Modern::Error::BEGIN@15
# spent 1µs making 1 call to if::unimport |
16 | 2 | 15µs | 2 | 17µs | # spent 16µs (7+9) within JSON::Schema::Modern::Error::BEGIN@16 which was called:
# once (7µs+9µs) by JSON::Schema::Modern::BEGIN@33 at line 16 # spent 16µs making 1 call to JSON::Schema::Modern::Error::BEGIN@16
# spent 1µs making 1 call to if::unimport |
17 | 2 | 16µs | 2 | 146µs | # spent 76µs (6+70) within JSON::Schema::Modern::Error::BEGIN@17 which was called:
# once (6µs+70µs) by JSON::Schema::Modern::BEGIN@33 at line 17 # spent 76µs making 1 call to JSON::Schema::Modern::Error::BEGIN@17
# spent 70µs making 1 call to Exporter::import |
18 | 2 | 1.02ms | 1 | 10.4ms | # spent 10.4ms (7.74+2.62) within JSON::Schema::Modern::Error::BEGIN@18 which was called:
# once (7.74ms+2.62ms) by JSON::Schema::Modern::BEGIN@33 at line 18 # spent 10.4ms making 1 call to JSON::Schema::Modern::Error::BEGIN@18 |
19 | 2 | 29µs | 2 | 1.09ms | # spent 552µs (10+542) within JSON::Schema::Modern::Error::BEGIN@19 which was called:
# once (10µs+542µs) by JSON::Schema::Modern::BEGIN@33 at line 19 # spent 552µs making 1 call to JSON::Schema::Modern::Error::BEGIN@19
# spent 542µs making 1 call to MooX::TypeTiny::import |
20 | 2 | 43µs | 2 | 1.40ms | # spent 702µs (7+695) within JSON::Schema::Modern::Error::BEGIN@20 which was called:
# once (7µs+695µs) by JSON::Schema::Modern::BEGIN@33 at line 20 # spent 702µs making 1 call to JSON::Schema::Modern::Error::BEGIN@20
# spent 695µs making 1 call to Exporter::Tiny::import |
21 | 2 | 1.38ms | 2 | 23.4ms | # spent 23.2ms (2.04+21.1) within JSON::Schema::Modern::Error::BEGIN@21 which was called:
# once (2.04ms+21.1ms) by JSON::Schema::Modern::BEGIN@33 at line 21 # spent 23.2ms making 1 call to JSON::Schema::Modern::Error::BEGIN@21
# spent 239µs making 1 call to namespace::clean::import |
22 | |||||
23 | use overload | ||||
24 | 2 | 245µs | 2 | 48µs | # spent 29µs (10+19) within JSON::Schema::Modern::Error::BEGIN@24 which was called:
# once (10µs+19µs) by JSON::Schema::Modern::BEGIN@33 at line 24 # spent 29µs making 1 call to JSON::Schema::Modern::Error::BEGIN@24
# spent 19µs making 1 call to overload::import |
25 | |||||
26 | 1 | 5µs | 2 | 19.4ms | has [qw( # spent 19.4ms making 1 call to JSON::Schema::Modern::Error::has
# spent 2µ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 | 4196 | 17.1ms | 4196 | 54.6ms | # spent 74.9ms (20.3+54.6) within JSON::Schema::Modern::Error::__ANON__[/Users/ether/git/JSON-Schema-Modern/lib/JSON/Schema/Modern/Error.pm:39] which was called 4196 times, avg 18µs/call:
# 4196 times (20.3ms+54.6ms) by JSON::Schema::Modern::Error::new at line 68 of (eval 435)[Sub/Quote.pm:3], avg 18µs/call # spent 54.6ms making 4196 calls to Safe::Isa::__ANON__[Safe/Isa.pm:23], avg 13µs/call |
40 | 1 | 8µs | 2 | 4.08ms | ); # spent 3.53ms making 1 call to Types::Standard::InstanceOf
# spent 548µs making 1 call to JSON::Schema::Modern::Error::has |
41 | |||||
42 | 1 | 9µs | 4 | 2.62ms | has keyword => ( # spent 2.04ms making 1 call to Type::Tiny::__ANON__[Type/Tiny.pm:126]
# spent 579µs making 1 call to JSON::Schema::Modern::Error::has
# spent 3µs making 1 call to Types::Standard::Undef
# spent 1µs making 1 call to Types::Standard::Str |
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 | 713µs | ); # spent 426µs making 1 call to JSON::Schema::Modern::Error::has
# spent 287µs making 1 call to Types::Standard::InstanceOf |
53 | |||||
54 | 1 | 6µs | 2 | 3.97ms | has mode => ( # spent 3.11ms making 1 call to Types::Standard::Enum
# spent 856µs 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 | 17µs | 1; | ||
83 | 1 | 29µs | 1 | 269µs | __END__ # spent 269µs making 1 call to B::Hooks::EndOfScope::XS::__ANON__[B/Hooks/EndOfScope/XS.pm:26] |