| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package HTML::Display::TempFile; |
|
2
|
2
|
|
|
2
|
|
2600
|
use strict; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
70
|
|
|
3
|
2
|
|
|
2
|
|
11
|
use parent 'HTML::Display::Common'; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
18
|
|
|
4
|
2
|
|
|
2
|
|
98
|
use vars qw($VERSION); |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
658
|
|
|
5
|
|
|
|
|
|
|
$VERSION='0.40'; |
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
HTML::Display::TempFile - base class to display HTML via a temporary file |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=for example begin |
|
14
|
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
1468
|
package HTML::Display::External; |
|
|
1
|
|
|
|
|
355
|
|
|
|
1
|
|
|
|
|
7
|
|
|
16
|
|
|
|
|
|
|
use parent 'HTML::Display::TempFile'; |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub browsercmd { |
|
19
|
|
|
|
|
|
|
# Return the string to pass to system() |
|
20
|
|
|
|
|
|
|
# %s will be replaced by the temp file name |
|
21
|
|
|
|
|
|
|
}; |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=for example end |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=cut |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub display_html { |
|
28
|
|
|
|
|
|
|
# We need to use a temp file for communication |
|
29
|
1
|
|
|
1
|
0
|
3
|
my ($self,$html) = @_; |
|
30
|
|
|
|
|
|
|
|
|
31
|
1
|
|
|
|
|
8
|
$self->cleanup_tempfiles; |
|
32
|
|
|
|
|
|
|
|
|
33
|
1
|
|
|
|
|
5009
|
require File::Temp; |
|
34
|
1
|
|
|
|
|
27055
|
my($tempfh, $tempfile) = File::Temp::tempfile(SUFFIX => '.html'); |
|
35
|
1
|
|
|
|
|
691
|
print $tempfh $html; |
|
36
|
1
|
|
|
|
|
60
|
close $tempfh; |
|
37
|
|
|
|
|
|
|
|
|
38
|
1
|
|
|
|
|
3
|
push @{$self->{delete}}, $tempfile; |
|
|
1
|
|
|
|
|
5
|
|
|
39
|
|
|
|
|
|
|
|
|
40
|
1
|
|
|
|
|
9
|
my $cmdline = sprintf($self->browsercmd, $tempfile); |
|
41
|
1
|
50
|
|
|
|
11946
|
system( $cmdline ) == 0 |
|
42
|
|
|
|
|
|
|
or warn "Couldn't launch '$cmdline' : $?"; |
|
43
|
|
|
|
|
|
|
}; |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub cleanup_tempfiles { |
|
46
|
1
|
|
|
1
|
0
|
3
|
my ($self) = @_; |
|
47
|
1
|
|
|
|
|
2
|
for my $file (@{$self->{delete}}) { |
|
|
1
|
|
|
|
|
12
|
|
|
48
|
0
|
0
|
|
|
|
0
|
unlink $file |
|
49
|
|
|
|
|
|
|
or warn "Couldn't remove tempfile $file : $!\n"; |
|
50
|
|
|
|
|
|
|
}; |
|
51
|
1
|
|
|
|
|
4
|
$self->{delete} = []; |
|
52
|
|
|
|
|
|
|
}; |
|
53
|
|
|
|
|
|
|
|
|
54
|
0
|
|
|
0
|
0
|
0
|
sub browsercmd { $_[0]->{browsercmd} }; |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 AUTHOR |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Copyright (c) 2004-2013 Max Maischein C<< >> |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 LICENSE |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
This module is released under the same terms as Perl itself. |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=cut |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |