This file is indexed.

/usr/share/perl5/Prophet/Replica/FS/Backend/LWP.pm is in libprophet-perl 0.750-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
68
69
70
71
72
73
74
75
76
package Prophet::Replica::FS::Backend::LWP;
use Any::Moose;
use Params::Validate qw/validate validate_pos/;
use LWP::UserAgent;

has url => ( is => 'rw', isa => 'Str');

has lwp_useragent => (
    isa => 'LWP::UserAgent',
    is => 'ro',
    lazy => 1,
    default => sub {
        my $ua = LWP::UserAgent->new( timeout => 60, keep_alive => 4, agent => "Prophet/".$Prophet::VERSION);
        return $ua;
    }
);

sub read_file {
	my $self = shift;
    my ($file) = validate_pos( @_, 1 );

        return $self->lwp_get( $self->url . "/" . $file );
}

sub read_file_range {
    my $self = shift;
    my %args = validate( @_, { path => 1, position => 1, length => 1 } );

        # XXX: do range get if possible
        my $content = $self->lwp_get( $self->url . "/" . $args{path} );
        return substr($content, $args{position}, $args{length});

}

sub lwp_get {
    my $self = shift;
    my $url  = shift;

    my $response;
    for ( 1 .. 4 ) {
        $response = $self->lwp_useragent->get($url);
        if ( $response->is_success ) {
            return $response->content;
        }
    }
    warn "Could not fetch " . $url . " - " . $response->status_line . "\n";
    return undef;
}
          

sub write_file {

}

sub append_to_file {

}

sub file_exists {
	my $self = shift;
    my ($file) = validate_pos( @_, 1 );
        return defined $self->read_file($file) ? 1 : 0;
}


sub can_read { 1;

}

sub can_write { 0;

}

no Any::Moose;

1;