/usr/share/perl5/Apache/ASP/Collection.pm is in libapache-asp-perl 2.62-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 | package Apache::ASP::Collection;
use Apache::ASP::CollectionItem;
use strict;
sub Contents {
my($self, $key) = @_;
if(defined $key) {
$self->Item($key);
} else {
$self;
}
}
sub Item {
my($self, $key, $value) = @_;
my @rv;
my $item_config = $main::Server->Config('CollectionItem');
if(defined $value) {
if(ref($self->{$key}) and $self->{$key} =~ /HASH/) {
# multi leveled collection go two levels down
$rv[0] = $self->{$key}{$value};
} else {
return $self->{$key} = $value;
}
} elsif(defined $key) {
my $value = $self->{$key};
if (defined $value) {
if(wantarray || $item_config) {
@rv = (ref($value) =~ /ARRAY/o) ? @{$value} : ($value);
} else {
@rv = (ref($value) =~ /ARRAY/o) ? ($value->[0]) : ($value);
}
} else {
$rv[0] = $value;
}
} else {
# returns hash to self by default, so compat with
# $Request->Form() & such null collection calls.
return $self;
}
# coming from the collections we need this like
# $Request->QueryString('foo')->Item() syntax, but is incompatible
# with $Request->QueryString('foo') syntax
if ($item_config) {
$rv[0] = Apache::ASP::CollectionItem->new(\@rv);
}
wantarray ? @rv : $rv[0];
}
sub Count {
my $self = shift;
scalar(keys %$self);
}
sub Key {
my($self, $index) = @_;
my @keys = sort(keys %$self);
$keys[$index-1];
}
sub SetProperty {
my($self, $property, $key, $value) = @_;
if($property =~ /property/io) {
# do this to avoid recursion
die("can't get the property $property for $self");
} else {
$self->$property($key, $value);
}
}
sub GetProperty {
my($self, $property, $key) = @_;
if($property =~ /property/io) {
# do this to avoid recursion
die("can't get the property $property for $self");
} else {
$self->$property($key);
}
}
1;
|