---
name: "Apache::Tie"
section: "3pm"
platform: "linux"
package: "libapache-mod-perl"
version: "1.16-2"
release: "Debian 2.1 (Slink)"
platforms: ["linux"]
url: "https://new.carta.tech/Apache::Tie"
---

# Apache::Tie(3pm)

Apache::Tie - Tie interfaces to Apache structures

```
    my $headers_out = $r->headers_out;
    while(my($key,$val) = each %$headers_out) {
    ...
    }
```

```
    my $table = $r->headers_out;
    $table->set(From => 'dougm@perl.apache.org');
```

Mod\_perl have to be compiled with 'perl Makefile.PL PERL\_TIE\_TABLES=1' or EVERYTHING=1 for this to work. This module provides tied interfaces to Apache data structures.\
 **CLASSES**\
 The *Apache::TieHashTable* class provides methods for interfacing with the Apache `table` structure. The following *Apache* class methods, when called in a scalar context with no "key" argument, will return a *HASH* reference blessed into the *Apache::TieHashTable* class and where *HASH* is tied to *Apache::TieHashTable*:

```
 headers_in
 headers_out
 err_headers_out
 notes
 dir_config
 subprocess_env
```

**METHODS**\
 Corresponds to the `ap_table_get` function.

```
    my $value = $table->get($key);
```

```
    my $value = $headers_out->{$key};
```

Corresponds to the `ap_table_set` function.

```
    $table->set($key, $value);
```

```
    $headers_out->{$key} = $value;
```

Corresponds to the `ap_table_unset` function.

```
    $table->unset($key);
```

```
    delete $headers_out->{$key};
```

Corresponds to the `ap_table_clear` function.

```
    $table->clear;
```

```
    %$headers_out = ();
```

Corresponds to the `ap_table_add` function.

```
    $table->add($key, $value);
```

Corresponds to the `ap_table_merge` function.

```
    $table->merge($key, $value);
```

Doug MacEachern *Apache*(3), *mod\_perl*(3)
