blob: 2eada89ea346f6ecedd0dabf60f4265e556a1f98 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
package HTML::AutoConvert::Run;
=head1 NAME
HTML::AutoConvert::Run - Base class for HTML::AutoConvert plugs that run an external program
=cut
use strict;
use IPC::Run qw( run timeout );
sub html_convert {
my( $self, $file ) = ( shift, shift );
my $opt = ref($_[0]) ? shift : { @_ };
my @program = $self->program;
my $program = $program[0];
my $timeout = 60; #?
my( $html, $err ) = ( '', '');
local($SIG{CHLD}) = sub {};
run( [ @program, $file ], \undef, \$html, \$err, timeout($timeout) )
or die "$program failed with exit status ". ( $? >> 8 ). ": $err\n";
$html;
}
1;
|