Filename | /Users/ether/.perlbrew/libs/36.0@std/lib/perl5/JSON/Schema/Modern/Error.pm |
Statements | Executed 4257 statements in 20.7ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
4217 | 1 | 1 | 26.5ms | 80.9ms | __ANON__[:39] | JSON::Schema::Modern::Error::
1 | 1 | 1 | 9.60ms | 13.1ms | BEGIN@18 | JSON::Schema::Modern::Error::
1 | 1 | 1 | 1.73ms | 17.2ms | BEGIN@21 | JSON::Schema::Modern::Error::
1 | 1 | 1 | 167µs | 170µs | BEGIN@1.66 | JSON::Schema::Modern::
1 | 1 | 1 | 20µs | 793µs | BEGIN@11 | JSON::Schema::Modern::Error::
1 | 1 | 1 | 17µs | 634µs | BEGIN@20 | JSON::Schema::Modern::Error::
1 | 1 | 1 | 14µs | 35µs | BEGIN@13 | JSON::Schema::Modern::Error::
1 | 1 | 1 | 14µs | 14µs | BEGIN@9 | JSON::Schema::Modern::Error::
1 | 1 | 1 | 12µs | 50µs | BEGIN@2.67 | JSON::Schema::Modern::
1 | 1 | 1 | 11µs | 35µs | BEGIN@24 | JSON::Schema::Modern::Error::
1 | 1 | 1 | 9µs | 281µs | BEGIN@10 | JSON::Schema::Modern::Error::
1 | 1 | 1 | 9µs | 584µs | BEGIN@19 | JSON::Schema::Modern::Error::
1 | 1 | 1 | 8µs | 88µs | BEGIN@12 | JSON::Schema::Modern::Error::
1 | 1 | 1 | 8µs | 20µs | BEGIN@14 | JSON::Schema::Modern::Error::
1 | 1 | 1 | 8µs | 16µs | BEGIN@16 | JSON::Schema::Modern::Error::
1 | 1 | 1 | 6µs | 16µs | BEGIN@15 | 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 | 229µs | 2 | 173µs | # spent 170µs (167+3) within JSON::Schema::Modern::BEGIN@1.66 which was called:
# once (167µs+3µs) by JSON::Schema::Modern::BEGIN@33 at line 1 # spent 170µs making 1 call to JSON::Schema::Modern::BEGIN@1.66
# spent 3µs making 1 call to strict::import |
2 | 2 | 65µs | 2 | 88µs | # spent 50µs (12+38) within JSON::Schema::Modern::BEGIN@2.67 which was called:
# once (12µs+38µs) by JSON::Schema::Modern::BEGIN@33 at line 2 # spent 50µs making 1 call to JSON::Schema::Modern::BEGIN@2.67
# spent 38µ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.552'; | ||
8 | |||||
9 | 2 | 49µs | 1 | 14µs | # spent 14µs within JSON::Schema::Modern::Error::BEGIN@9 which was called:
# once (14µs+0s) by JSON::Schema::Modern::BEGIN@33 at line 9 # spent 14µs making 1 call to JSON::Schema::Modern::Error::BEGIN@9 |
10 | 2 | 33µs | 2 | 553µs | # spent 281µs (9+272) within JSON::Schema::Modern::Error::BEGIN@10 which was called:
# once (9µs+272µs) by JSON::Schema::Modern::BEGIN@33 at line 10 # spent 281µs making 1 call to JSON::Schema::Modern::Error::BEGIN@10
# spent 272µs making 1 call to Moo::import |
11 | 3 | 34µs | 3 | 1.56ms | # spent 793µs (20+773) within JSON::Schema::Modern::Error::BEGIN@11 which was called:
# once (20µs+773µs) by JSON::Schema::Modern::BEGIN@33 at line 11 # spent 793µs making 1 call to JSON::Schema::Modern::Error::BEGIN@11
# spent 751µs making 1 call to strictures::import
# spent 21µs making 1 call to strictures::VERSION |
12 | 2 | 39µ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 | 38µs | # spent 35µs (14+21) within JSON::Schema::Modern::Error::BEGIN@13 which was called:
# once (14µs+21µs) by JSON::Schema::Modern::BEGIN@33 at line 13 # spent 35µs making 1 call to JSON::Schema::Modern::Error::BEGIN@13
# spent 3µs making 1 call to if::import |
14 | 2 | 17µs | 2 | 21µs | # spent 20µs (8+12) within JSON::Schema::Modern::Error::BEGIN@14 which was called:
# once (8µs+12µs) by JSON::Schema::Modern::BEGIN@33 at line 14 # spent 20µs making 1 call to JSON::Schema::Modern::Error::BEGIN@14
# spent 1µs making 1 call to if::unimport |
15 | 2 | 16µs | 2 | 17µs | # spent 16µs (6+10) within JSON::Schema::Modern::Error::BEGIN@15 which was called:
# once (6µs+10µs) by JSON::Schema::Modern::BEGIN@33 at line 15 # spent 16µs making 1 call to JSON::Schema::Modern::Error::BEGIN@15
# spent 1µs making 1 call to if::unimport |
16 | 2 | 14µs | 2 | 18µ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 2µs making 1 call to if::unimport |
17 | 2 | 17µ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 | 768µs | 1 | 13.1ms | # spent 13.1ms (9.60+3.48) within JSON::Schema::Modern::Error::BEGIN@18 which was called:
# once (9.60ms+3.48ms) by JSON::Schema::Modern::BEGIN@33 at line 18 # spent 13.1ms making 1 call to JSON::Schema::Modern::Error::BEGIN@18 |
19 | 2 | 46µs | 2 | 1.16ms | # spent 584µs (9+575) within JSON::Schema::Modern::Error::BEGIN@19 which was called:
# once (9µs+575µs) by JSON::Schema::Modern::BEGIN@33 at line 19 # spent 584µs making 1 call to JSON::Schema::Modern::Error::BEGIN@19
# spent 575µs making 1 call to MooX::TypeTiny::import |
20 | 2 | 39µs | 2 | 1.25ms | # spent 634µs (17+617) within JSON::Schema::Modern::Error::BEGIN@20 which was called:
# once (17µs+617µs) by JSON::Schema::Modern::BEGIN@33 at line 20 # spent 634µs making 1 call to JSON::Schema::Modern::Error::BEGIN@20
# spent 617µs making 1 call to Exporter::Tiny::import |
21 | 2 | 993µs | 2 | 17.4ms | # spent 17.2ms (1.73+15.5) within JSON::Schema::Modern::Error::BEGIN@21 which was called:
# once (1.73ms+15.5ms) by JSON::Schema::Modern::BEGIN@33 at line 21 # spent 17.2ms making 1 call to JSON::Schema::Modern::Error::BEGIN@21
# spent 234µs making 1 call to namespace::clean::import |
22 | |||||
23 | use overload | ||||
24 | 2 | 310µs | 2 | 59µs | # spent 35µs (11+24) within JSON::Schema::Modern::Error::BEGIN@24 which was called:
# once (11µs+24µs) by JSON::Schema::Modern::BEGIN@33 at line 24 # spent 35µs making 1 call to JSON::Schema::Modern::Error::BEGIN@24
# spent 24µs making 1 call to overload::import |
25 | |||||
26 | 1 | 5µs | 2 | 24.9ms | has [qw( # spent 24.9ms 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 | 4217 | 17.9ms | 4217 | 54.5ms | # spent 80.9ms (26.5+54.5) 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 (26.5ms+54.5ms) by JSON::Schema::Modern::Error::new at line 68 of (eval 432)[Sub/Quote.pm:3], avg 19µs/call # spent 54.5ms making 4217 calls to Safe::Isa::__ANON__[Safe/Isa.pm:23], avg 13µs/call |
40 | 1 | 11µs | 2 | 5.10ms | ); # spent 4.20ms making 1 call to Types::Standard::InstanceOf
# spent 901µs making 1 call to JSON::Schema::Modern::Error::has |
41 | |||||
42 | 1 | 13µs | 4 | 4.40ms | has keyword => ( # spent 3.48ms making 1 call to Type::Tiny::__ANON__[Type/Tiny.pm:126]
# spent 912µs making 1 call to JSON::Schema::Modern::Error::has
# spent 3µs making 1 call to Types::Standard::Undef
# spent 2µ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 | 1.11ms | ); # spent 652µs making 1 call to JSON::Schema::Modern::Error::has
# spent 454µs making 1 call to Types::Standard::InstanceOf |
53 | |||||
54 | 1 | 6µs | 2 | 5.18ms | has mode => ( # spent 4.11ms making 1 call to Types::Standard::Enum
# spent 1.07ms 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 | ? 'at \''.$self->keyword_location.'\': '.$self->error | ||||
73 | : 'at \''.$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 | 23µs | 1; | ||
83 | |||||
84 | 1 | 40µs | 1 | 664µs | __END__ # spent 664µs making 1 call to B::Hooks::EndOfScope::XS::__ANON__[B/Hooks/EndOfScope/XS.pm:26] |