line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Terse::Plugin::Glitch; |
2
|
1
|
|
|
1
|
|
67785
|
use 5.006; use strict; use warnings; |
|
1
|
|
|
1
|
|
4
|
|
|
1
|
|
|
1
|
|
6
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
48
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
4
|
1
|
|
|
1
|
|
533
|
use Glitch; |
|
1
|
|
|
|
|
9755
|
|
|
1
|
|
|
|
|
7
|
|
5
|
1
|
|
|
1
|
|
517
|
use YAML::XS; |
|
1
|
|
|
|
|
2995
|
|
|
1
|
|
|
|
|
57
|
|
6
|
1
|
|
|
1
|
|
636
|
use JSON; |
|
1
|
|
|
|
|
12450
|
|
|
1
|
|
|
|
|
7
|
|
7
|
1
|
|
|
1
|
|
155
|
use base 'Terse::Plugin'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
508
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub build_plugin { |
10
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
11
|
0
|
0
|
|
|
|
|
$self->build_glitch_config if $self->can('build_glitch_config'); |
12
|
0
|
0
|
|
|
|
|
if (!$self->glitch_config) { |
13
|
0
|
|
|
|
|
|
my $file = $0; |
14
|
0
|
|
|
|
|
|
($self->glitch_config = $0) =~ s/(\.psgi)?$/.glitch/; |
15
|
|
|
|
|
|
|
} |
16
|
0
|
0
|
|
|
|
|
if ($self->{format} eq 'YAML') { |
|
|
0
|
|
|
|
|
|
17
|
0
|
|
|
0
|
|
|
$self->{glitch_config_parser} = sub { YAML::XS::Load($_[0]) }; |
|
0
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
} elsif ($self->{format} eq 'JSON') { |
19
|
0
|
|
|
0
|
|
|
$self->{glitch_config_parser} = sub { JSON->new->encode($_[0]) }; |
|
0
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
Glitch::build_meta( |
22
|
0
|
|
|
|
|
|
map {($_, $self->{$_})} grep {$_ !~ m/^(namespace|format|app)$/} keys %{$self} |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub call { |
27
|
0
|
|
|
0
|
0
|
|
my ($self, $name) = @_; |
28
|
0
|
|
|
|
|
|
eval { glitch($name) }; |
|
0
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
return $@; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub logError { |
33
|
0
|
|
|
0
|
1
|
|
my ($self, $t, $name, $status) = @_; |
34
|
0
|
|
|
|
|
|
my $glitch = $self->call($name); |
35
|
0
|
0
|
|
|
|
|
$self->extend($glitch) if $self->can('extend'); |
36
|
0
|
|
|
|
|
|
$t->logError($glitch->hash, $status); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub logInfo { |
40
|
0
|
|
|
0
|
1
|
|
my ($self, $t, $name, $status) = @_; |
41
|
0
|
|
|
|
|
|
my $glitch = $self->call($name); |
42
|
0
|
0
|
|
|
|
|
$self->extend($glitch) if $self->can('extend'); |
43
|
0
|
|
|
|
|
|
$t->logInfo($glitch->hash); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
__END__ |