File: expand1

package info (click to toggle)
appconfig-perl 1.52-5
  • links: PTS
  • area: main
  • in suites: woody
  • size: 260 kB
  • ctags: 65
  • sloc: perl: 987; makefile: 57
file content (44 lines) | stat: -rwxr-xr-x 1,311 bytes parent folder | download
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
#!/usr/bin/perl -w
#========================================================================
#
# examples/simple
#
# AppConfig example file.  This demonstrates the use of EXPAND to 
# interpolate variable values in a configuration file.  The EXPAND
# option is passed in the $AppConfig::file() configuration hash and 
# the expansion policy is applied to all values read from the file.
#
# Written by Andy Wardley <abw@cre.canon.co.uk>
#
# Copyright (C) 1998 Canon Research Centre Europe Ltd.
# All Rights Reserved.
#
# This is free software; you can redistribute it and/or modify it
# under the same terms as Perl itself.
#
#========================================================================

use strict;

# This line will help perl find the modules if you haven't installed them
# yet.  It assumes you've run a "perl Makefile.PL; make" in the parent dir.
use lib '../blib/lib';

use AppConfig qw(:expand);



my $config = AppConfig->new({ 
	    GLOBAL=> { EXPAND => EXPAND_ALL, ARGCOUNT => 1 } 
	},
	'verbose' => { ARGCOUNT => 0 },
	'debug'   => { ARGCOUNT => 0 },
	'logfile', 
	'summary');

$config->file('sample.config');

print "verbose: ", $config->verbose(), "\n";
print "  debug: ", $config->debug(), "\n";
print "logfile: ", $config->logfile(), "\n";
print "summary: ", $config->summary(), "\n";