# man > AppConfig::File(3pm)

---
type: CommandReference
command: AppConfig::File
mode: perldoc
section: 3pm
source: perldoc
---

## Quick Reference
- `use AppConfig::File;` — import the module
- `my $cfgfile = AppConfig::File->new($state, $file);` — create a reader object
- `$cfgfile->parse('config.cfg');` — parse a single file
- `$cfgfile->parse('f1.cfg', 'f2.cfg');` — parse multiple files in sequence
- `verbose` — boolean flag sets 1 (on); `noverbose` sets 0 (off)
- `room = /home/kitchen` — single-value assignment overwrites previous
- `drink = coffee; drink = tea` — list accumulates values
- `[db] host = localhost` — block prefix creates `db_host`

## Name
`AppConfig::File` — Perl5 module for reading configuration files and updating an `AppConfig::State` object.

## Synopsis
perl
use AppConfig::File;

my $state   = AppConfig::State->new(\%cfg1);
my $cfgfile = AppConfig::File->new($state, $file);
$cfgfile->parse($file);
## Options (Configuration File Format)
- **Comments**: `#` after optional whitespace starts a comment; the rest of the line is ignored.  
  Example: `foo = bar  # this is a comment`
- **Line continuation**: End a line with `\` to continue on the next line.
- **Flags (ARGCOUNT_NONE)**:  
  - Bare name sets to 1; `novar` sets to 0.  
  - Explicit values: `verbose = 0` sets 0; anything else (except `0` and `off`) sets 1.
- **Single-value variables**:  
  `room = /home/kitchen` or `room /home/bedroom` — later assignment overwrites earlier.
- **List variables (ARGCOUNT_LIST)**:  
  Repeated assignments append values: `drink = coffee; drink = tea` yields a list.
- **Hash variables (ARGCOUNT_HASH)**:  
  `alias l="ls -CF"` adds a key-value pair; repeated assignments build a hash.
- **Heredoc**:  
  ```perl
  scalar = <<BOUNDARY
  line1
  line2
  BOUNDARY
  
  Quotes around boundary are ignored; expansion depends on the variable’s EXPAND setting.
- **Prefixes**:  
  `-variable` resets to default value; `+variable` sets to 1.
- **Variable expansion** (controlled by EXPAND option):  
  - `~` expands to home directory (EXPAND_UID)  
  - `~user` expands to user’s home  
  - `$var` or `$(var)` expands another variable (EXPAND_VAR)  
  - `${ENV}` expands environment variable (EXPAND_ENV)
- **Blocks**:  
  `[blockname]` starts a block; subsequent variable definitions are prefixed with `blockname_` until the next block or end of file.

## Examples
perl
# Heredoc for scalar
scalar = <<EOF
line 1
line 2: Space/linebreaks within a HERE document are kept.
line 3: The last linebreak (\n) is stripped.
EOF

# Heredoc for hash value
hash key1 = <<'FOO'
  * Quotes around boundary are simply ignored.
  * Variable expansion depends on EXPAND settings.
FOO

hash key2 = <<"_bar_"
Text within HERE document is kept as is.
# comments are treated as normal text.
The same applies to line continuation. \
_bar_
## See Also
- [AppConfig](http://localhost/phpMan.php/perldoc/AppConfig/markdown)
- [AppConfig::State](http://localhost/phpMan.php/perldoc/AppConfig%3A%3AState/markdown)