/usr/share/perl5/WWW/IndexParser/Entry.pm is in libwww-indexparser-perl 0.91-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 | package WWW::IndexParser::Entry;
use strict;
use warnings;
use overload '""' => \&_as_string;
BEGIN {
our $VERSION = "0.6";
}
sub new {
my $proto = shift;
my $class = ref($proto) || $proto;
my $self = {};
bless $self, $class;
return $self;
}
sub filename {
my $self = shift;
if (@_) {
$self->{filename} = shift;
}
return $self->{filename};
}
sub url {
my $self = shift;
if (@_) {
my $new_url = shift;
return unless $new_url =~ m!^\w+://[^:\s/]+(:\d+)?/!;
$self->{url} = $new_url;
}
return $self->{url};
}
sub time {
my $self = shift;
if (@_) {
my $new_time = shift;
return unless $new_time =~ /^\d+$/;
$self->{time} = $new_time;
}
return $self->{time};
}
sub type {
my $self = shift;
if (@_) {
$self->{type} = shift;
}
return $self->{type};
}
sub size {
my $self = shift;
if (@_) {
my $new_size = shift;
return unless $new_size =~ /^\d+(\.\d+)?$/;
$self->{size} = $new_size;
}
return $self->{size};
}
sub size_units {
my $self = shift;
if (@_) {
$self->{size_units} = shift;
}
return $self->{size_units};
}
sub _as_string {
my $self = shift;
my $string;
$string.= sprintf "Filename : %s\n", $self->filename if defined $self->filename;
$string.= sprintf "Size : %s\n", $self->size if defined $self->size;
$string.= sprintf "Size Units: %s\n", $self->size_units if defined $self->size_units;
$string.= sprintf "Type : %s\n", $self->type if defined $self->type;
$string.= sprintf "URL : %s\n", $self->url if defined $self->url;
$string.= sprintf "Time : %s\n", scalar localtime($self->time) if defined $self->time;
return $string;
}
=head1 NAME
WWW::IndexParser::Entry - Object representing an item in a directory
=head1 SYNOPSIS
my @files = WWW::IndexParser->new('http://www.james.rcpt.to/misc/');
foreach my $file (@files) {
print $file->url;
}
=head1 DESCRIPTION
B<WWW::IndexParser::Entry> is not used directly, but is the class of
items returned by B<WWW::IndexParser> when it successfully parses an
auto index from a web server.
=head1 METHODS
=over 4
=item filename
=item url
=item size
=item size_units
=item type
=back
=head1 OSNAMES
any
=head1 AUTHOR
James Bromberger E<lt>james@rcpt.toE<gt>
=head1 COPYRIGHT
Copyright (c) 2005 James Bromberger. All rights reserved. All rights
reserved. This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
=cut
1;
1;
|