line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PDF::WebKit::Configuration; |
2
|
3
|
|
|
3
|
|
12
|
use strict; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
80
|
|
3
|
3
|
|
|
3
|
|
10
|
use warnings; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
69
|
|
4
|
3
|
|
|
3
|
|
1248
|
use Moo; |
|
3
|
|
|
|
|
27987
|
|
|
3
|
|
|
|
|
35
|
|
5
|
3
|
|
|
3
|
|
4056
|
use namespace::clean; |
|
3
|
|
|
|
|
22978
|
|
|
3
|
|
|
|
|
13
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
has meta_tag_prefix => ( is => 'rw' ); |
8
|
|
|
|
|
|
|
has default_options => ( is => 'rw' ); |
9
|
|
|
|
|
|
|
has wkhtmltopdf => ( is => 'rw', builder => '_find_wkhtmltopdf', lazy => 1 ); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
around 'BUILDARGS' => sub { |
12
|
|
|
|
|
|
|
my $orig = shift; |
13
|
|
|
|
|
|
|
my $self = shift; |
14
|
|
|
|
|
|
|
return $self->$orig({ |
15
|
|
|
|
|
|
|
meta_tag_prefix => 'pdf-webkit-', |
16
|
|
|
|
|
|
|
default_options => { |
17
|
|
|
|
|
|
|
disable_smart_shrinking => undef, |
18
|
|
|
|
|
|
|
page_size => 'Letter', |
19
|
|
|
|
|
|
|
margin_top => '0.75in', |
20
|
|
|
|
|
|
|
margin_right => '0.75in', |
21
|
|
|
|
|
|
|
margin_bottom => '0.75in', |
22
|
|
|
|
|
|
|
margin_left => '0.75in', |
23
|
|
|
|
|
|
|
encoding => "UTF-8", |
24
|
|
|
|
|
|
|
}, |
25
|
|
|
|
|
|
|
}); |
26
|
|
|
|
|
|
|
}; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub _find_wkhtmltopdf { |
29
|
1
|
|
|
1
|
|
351
|
my $self = shift; |
30
|
1
|
|
|
|
|
2352
|
my $found = `which wkhtmltopdf`; |
31
|
1
|
50
|
|
|
|
18
|
if ($? == 0) { |
32
|
0
|
|
|
|
|
0
|
chomp($found); |
33
|
0
|
|
|
|
|
0
|
return $found; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
else { |
36
|
1
|
|
|
|
|
17
|
return undef; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
my $_config; |
41
|
|
|
|
|
|
|
sub configuration { |
42
|
48
|
|
66
|
48
|
0
|
610
|
$_config ||= PDF::WebKit::Configuration->new; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub configure { |
46
|
2
|
|
|
2
|
0
|
41
|
my $class = shift; |
47
|
2
|
|
|
|
|
5
|
my $code = shift; |
48
|
2
|
|
|
|
|
4
|
local $_ = $class->configuration; |
49
|
2
|
|
|
|
|
5
|
$code->($_); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |