This file is indexed.

/usr/share/perl5/IO/All/LWP.pm is in libio-all-lwp-perl 0.14-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
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
package IO::All::LWP;
require 5.008;
use strict;
use warnings;
our $VERSION = '0.14';
use IO::All 0.30 '-base';
use LWP::UserAgent;
use IO::Handle;

my $DEFAULT_UA = LWP::UserAgent->new(env_proxy => 1);

field 'response';
field 'content';
field 'put_content';

sub lwp_init {
    my $self = shift;
    bless $self, shift;
    $self->name(shift) if @_;
    return $self->_init;
}

sub ua {
    my $self = shift;
    if (@_) {
        *$self->{ua} = ref($_[0]) ? shift :
            LWP::UserAgent->new(@_);
        return $self;
    } else {
        *$self->{ua} ||= $DEFAULT_UA;
    }
}

sub uri {
    my $self = shift;
    *$self->{uri} = ref($_[0]) ? shift : URI->new(shift)
      if @_;
    return *$self->{uri}
      if defined *$self->{uri};
    *$self->{uri} = URI->new($self->name);
}
    
sub user {
    my $self = shift;
    $self->uri->user(@_);
    return $self;
}

sub password {
    my $self = shift;
    $self->uri->password(@_);
    return $self;
}

sub get {
    my $self = shift;
    my $request = shift || HTTP::Request->new('GET', $self->uri);
    $self->request($request);
}

sub put {
    my $self = shift;
    my $request = (@_ and ref $_[0])
    ? $_[0]
    : do {
        my $content = @_ ? shift : $self->content;
        HTTP::Request->new(PUT => $self->uri, undef, $content);
    };
    $self->request($request);
    $self->is_open(0);
}

sub request {
    my $self = shift;
    $self->response($self->ua->request(shift));
}

sub open {
    my $self = shift;
    $self->is_open(1);
    my $mode = @_ ? shift : $self->mode ? $self->mode : '<';
    $self->mode($mode);
    my $fh;
    if ($mode eq '<') {
        $self->content($self->get->content);
        CORE::open $fh, "<", \ $self->content;
    } 
    elsif ($mode eq '>') {
        $self->put_content(\ do{ my $x = ''});
        CORE::open $fh, ">", $self->put_content;
    } 
    $self->io_handle($fh);
    return $self;
}

sub close {
    my $self = shift;
    if ($self->is_open and defined $self->mode and $self->mode eq '>') {
        $self->content(${$self->put_content});
        $self->put;
    }
    $self->SUPER::close;
}

1;
__END__

=head1 NAME

IO::All::LWP - IO::All interface to LWP

=head1 SYNOPSIS

    use IO::All;

    "hello world\n" > io('ftp://localhost/test/x');   # save to FTP
    $content < io('http://example.org');              # GET webpage

    io('http://example.org') > io('index.html');      # save webpage

=head1 DESCRIPTION

This module acts as glue between L<IO::All> and L<LWP>, so that files can be
read and written through the network using the convenient L<IO:All> interface.
Note that this module is not C<use>d directly: you just use L<IO::All>, which
knows when to autoload L<IO::All::HTTP>, L<IO::All::HTTPS>, L<IO::All::FTP>, or
L<IO::All::Gopher>, which implement the specific protocols based on
L<IO::All::LWP>.

=head1 EXECUTION MODEL

B<GET requests>. When the IO::All object is opened, the URI is fetched and
stored by the object in an internal file handle. It can then be accessed like
any other file via the IO::All methods and operators, it can be tied, etc.

B<PUT requests>. When the IO::All object is opened, an internal file handle is
created. It is possible to that file handle using the various IO::All methods
and operators, it can be tied, etc. If $io->put is not called explicitly, when
the IO::All object is closed, either explicitly via $io->close or automatically
upon destruction, the actual PUT request is made.

The bad news is that the whole file is stored in memory after getting it or
before putting it. This may cause problems if you are dealing with
multi-gigabyte files!

=head1 METHODS

The simplest way of doing things is via the overloaded operators > and <, as
shown in the SYNOPSIS. These take care of automatically opening and closing the
files and connections as needed. However, various methods are available to
provide a finer degree of control. 

This is a subclass of L<IO::All>. In addition to the inherited methods, the 
following methods are available:

=over

=item * ua

Set or get the user agent object (L<LWP::UserAgent> or a subclass). If called
with a list, the list is passed to LWP::UserAgent->new. If called with an
object, the object is used directly as the user agent. Note that there is a 
default user agent if no user agent is specified.

=item * uri

Set or get the URI. It can take either a L<URI> object or a string, and 
it returns an L<URI> object. Note that calling this method overrides the user
and password fields, because URIs can contain authentication information.

=item * user

Set or get the user name for authentication. Note that the user name (and the
password) can also be set as part of the URL, as in
"http://me:secret@example.com/".

=item * password

Set or get the password for authentication. Note that the password can also
be set as part of the URL, as discussed above.

=item * get

GET the current URI using LWP. Or, if called with an L<HTTP::Request> object as
a parameter, it does that request instead. It returns the L<HTTP::Response>
object.

=item * put

PUT to the current URI using LWP. If called with an L<HTTP::Request> object, it
does that request instead. If called with a scalar, it PUTs that as the
content to the current URI, instead of the current accumulated content.

=item * response

Return the L<HTTP::Response> object.

=item * request

Does an LWP request. It requires an L<HTTP::Request> object as a parameter.
Returns an L<HTTP::Response> object.

=item * open

Overrides the C<open> method from L<IO::All>. It takes care of GETting the 
content, or of setting up the internal buffer for PUTting. Just like the
C<open> method from L<IO::All>, it can take a mode: '<' for GET and 
'>' for PUT.

=item * close

Overrides the C<close> method from L<IO::All>. It takes care of PUTting
the content.

=back

=head1 DEPENDENCIES

This module uses L<LWP> for all the heavy lifting. It also requires perl-5.8.0
or a more recent version.

=head1 SEE ALSO

L<IO::All>, L<LWP>, L<IO::All::HTTP>, L<IO::All::FTP>.

=head1 AUTHORS

Ivan Tubert-Brohman <itub@cpan.org> and 
Brian Ingerson <ingy@cpan.org>

Thanks to Sergey Gleizer for the ua method.

=head1 COPYRIGHT

Copyright (c) 2007. Ivan Tubert-Brohman and Brian Ingerson. All rights reserved.

This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.

See L<http://www.perl.com/perl/misc/Artistic.html>

=cut