/usr/share/perl5/Pod/ProjectDocs/File.pm is in libpod-projectdocs-perl 0.50-1.
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 67 | package Pod::ProjectDocs::File;
use strict;
use warnings;
our $VERSION = '0.50'; # VERSION
use Moose::Role;
use IO::File;
use Carp();
has 'data' => ( is => 'ro', );
has 'default_name' => (
is => 'ro',
isa => 'Str',
);
has 'is_bin' => (
is => 'rw',
default => 0,
);
has 'config' => ( is => 'ro', );
has 'name' => (
is => 'rw',
isa => 'Str',
);
has 'relpath' => (
is => 'rw',
isa => 'Str',
);
sub _get_data {
my $self = shift;
return $self->data;
}
sub publish {
my ( $self, $data ) = @_;
$data ||= $self->_get_data();
my $path = $self->get_output_path;
my $mode = ">>";
if ( $path =~ m/html$/ ) {
$mode .= ':encoding(UTF-8)';
}
my $fh = IO::File->new( $path, $mode )
or Carp::croak(qq/Can't open $path./);
$fh->seek( 0, 0 );
$fh->truncate(0);
$fh->print($data);
$fh->close;
return;
}
sub get_output_path {
my $self = shift;
my $outroot = $self->config->outroot;
my $relpath = $self->relpath || $self->default_name;
my $path = File::Spec->catfile( $outroot, $relpath );
return $path;
}
1;
__END__
|