line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Mojo::Role::Debug; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1086
|
use Mojo::Base -base; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
4
|
1
|
|
|
1
|
|
200
|
use Mojo::File qw/path/; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
43
|
|
5
|
1
|
|
|
1
|
|
5
|
use Mojo::Util qw/encode/; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
36
|
|
6
|
1
|
|
|
1
|
|
5
|
use Role::Tiny; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6
|
|
7
|
1
|
|
|
1
|
|
154
|
use Carp qw/croak/; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
42
|
|
8
|
1
|
|
|
1
|
|
5
|
use Test::More (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
353
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '1.005002'; # VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub d { |
13
|
11
|
|
|
11
|
1
|
42068
|
my ( $self, $selector, $dump_file ) = @_; |
14
|
11
|
100
|
|
|
|
24
|
return $self->success ? $self : $self->da( $selector, $dump_file ); |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub da { |
18
|
8
|
|
|
8
|
1
|
3374
|
my ( $self, $selector, $dump_file ) = @_; |
19
|
8
|
100
|
100
|
|
|
37
|
my $markup = length($selector//'') |
20
|
|
|
|
|
|
|
? $self->tx->res->dom->at($selector) |
21
|
|
|
|
|
|
|
: $self->tx->res->dom; |
22
|
|
|
|
|
|
|
|
23
|
8
|
100
|
66
|
|
|
1321
|
unless ( defined $markup and length $markup ) { |
24
|
4
|
|
|
|
|
24
|
Test::More::diag "\nDEBUG DUMPER: the selector ($selector) you provided " |
25
|
|
|
|
|
|
|
. "did not match any elements\n\n"; |
26
|
4
|
|
|
|
|
563
|
return $self; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
4
|
0
|
33
|
|
|
428
|
if ($markup =~ // |
|
|
|
33
|
|
|
|
|
30
|
|
|
|
|
|
|
and $markup->at('div#mojobar div#mojobar-links') |
31
|
|
|
|
|
|
|
and (my $mojo_error = $markup->at('div#wrapperlicious pre#error')) |
32
|
|
|
|
|
|
|
) { |
33
|
0
|
|
|
|
|
0
|
$markup = $mojo_error->all_text; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
4
|
100
|
100
|
|
|
333
|
if (length($dump_file//'')) { |
37
|
2
|
|
|
|
|
17
|
Test::More::diag "\nDEBUG DUMPER: dumping data to $dump_file\n\n"; |
38
|
2
|
|
|
|
|
280
|
path($dump_file)->spurt(encode 'utf-8', $markup); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
else { |
41
|
2
|
|
|
|
|
6
|
Test::More::diag "\nDEBUG DUMPER:\n$markup\n\n"; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
4
|
|
|
|
|
1692
|
$self; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
q| |
48
|
|
|
|
|
|
|
The optimist says: "The glass is half full" |
49
|
|
|
|
|
|
|
The pessimist says: "The glass is half empty" |
50
|
|
|
|
|
|
|
The programmer says: "The glass is twice as large necessary" |
51
|
|
|
|
|
|
|
|; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
__END__ |