/usr/share/perl5/HTML/Display/TempFile.pm is in libhtml-display-perl 0.40-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | package HTML::Display::TempFile;
use strict;
use parent 'HTML::Display::Common';
use vars qw($VERSION);
$VERSION='0.40';
=head1 NAME
HTML::Display::TempFile - base class to display HTML via a temporary file
=head1 SYNOPSIS
=for example begin
package HTML::Display::External;
use parent 'HTML::Display::TempFile';
sub browsercmd {
# Return the string to pass to system()
# %s will be replaced by the temp file name
};
=for example end
=cut
sub display_html {
# We need to use a temp file for communication
my ($self,$html) = @_;
$self->cleanup_tempfiles;
require File::Temp;
my($tempfh, $tempfile) = File::Temp::tempfile(SUFFIX => '.html');
print $tempfh $html;
close $tempfh;
push @{$self->{delete}}, $tempfile;
my $cmdline = sprintf($self->browsercmd, $tempfile);
system( $cmdline ) == 0
or warn "Couldn't launch '$cmdline' : $?";
};
sub cleanup_tempfiles {
my ($self) = @_;
for my $file (@{$self->{delete}}) {
unlink $file
or warn "Couldn't remove tempfile $file : $!\n";
};
$self->{delete} = [];
};
sub browsercmd { $_[0]->{browsercmd} };
=head1 AUTHOR
Copyright (c) 2004-2013 Max Maischein C<< <corion@cpan.org> >>
=head1 LICENSE
This module is released under the same terms as Perl itself.
=cut
1;
|