File: Table.pm

package info (click to toggle)
libapache-asp-perl 2.62-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, wheezy
  • size: 4,108 kB
  • ctags: 830
  • sloc: perl: 6,033; php: 417; sh: 65; lisp: 22; makefile: 10
file content (48 lines) | stat: -rw-r--r-- 890 bytes parent folder | download | duplicates (4)
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

package Apache::ASP::CGI::Table;

use Carp qw(confess);

=pod

=head1 NAME

  Apache::ASP::CGI::Table - Layer for compatibility with Apache::Table objects

=head1 DESCRIPTION

Layer for compatibility with Apache::Table objects 
while running in CGI or command line / test mode.

=cut

sub new {
    my $class = shift;
    bless {}, $class;
}

sub set { 
    my($self, $key, $value) = @_;
    defined($key) || confess("no key to set value $value");
    $self->{$key} = $value;
}

sub get { shift()->{shift()}; }
sub unset { delete shift()->{shift()} };
sub clear { %{shift()} = (); };
sub add {
    my($self, $name, $value) = @_;

    my $old_value = $self->{$name};
    if(ref $old_value) {
	push(@$old_value, $value);
    } elsif(defined $old_value) {
	$self->{$name} = [$old_value, $value];
    } else {
	$self->{$name} = $value;
    }
}

sub merge { die("merge not implemented"); }

1;