line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Mojo::Role::Debug; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1275
|
use Mojo::Base -base; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
7
|
|
4
|
1
|
|
|
1
|
|
227
|
use Mojo::File qw/path/; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
54
|
|
5
|
1
|
|
|
1
|
|
7
|
use Mojo::Util qw/encode/; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
44
|
|
6
|
1
|
|
|
1
|
|
5
|
use Role::Tiny; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
7
|
1
|
|
|
1
|
|
196
|
use Carp qw/croak/; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
49
|
|
8
|
1
|
|
|
1
|
|
8
|
use Test::More (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
529
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '1.005001'; # VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub d { |
13
|
11
|
|
|
11
|
1
|
50224
|
my ( $self, $selector, $dump_file ) = @_; |
14
|
11
|
100
|
|
|
|
27
|
return $self->success ? $self : $self->da( $selector, $dump_file ); |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub da { |
18
|
8
|
|
|
8
|
1
|
4021
|
my ( $self, $selector, $dump_file ) = @_; |
19
|
8
|
100
|
100
|
|
|
45
|
my $markup = length($selector//'') |
20
|
|
|
|
|
|
|
? $self->tx->res->dom->at($selector) |
21
|
|
|
|
|
|
|
: $self->tx->res->dom; |
22
|
|
|
|
|
|
|
|
23
|
8
|
100
|
66
|
|
|
1620
|
unless ( defined $markup and length $markup ) { |
24
|
4
|
|
|
|
|
25
|
Test::More::diag "\nDEBUG DUMPER: the selector ($selector) you provided " |
25
|
|
|
|
|
|
|
. "did not match any elements\n\n"; |
26
|
4
|
|
|
|
|
691
|
return $self; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
4
|
0
|
33
|
|
|
527
|
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
|
|
|
407
|
if (length($dump_file//'')) { |
37
|
2
|
|
|
|
|
21
|
Test::More::diag "\nDEBUG DUMPER: dumping data to $dump_file\n\n"; |
38
|
2
|
|
|
|
|
340
|
path($dump_file)->spurt(encode 'utf-8', $markup); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
else { |
41
|
2
|
|
|
|
|
7
|
Test::More::diag "\nDEBUG DUMPER:\n$markup\n\n"; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
4
|
|
|
|
|
1576
|
$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__ |