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
|
#!/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 applied selectively to the "summary" variable only.
#
# 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('verbose', 'debug',
'logfile' => { ARGCOUNT => 1 },
'summary' => { ARGCOUNT => 1, EXPAND => EXPAND_VAR });
$config->file('sample.config');
print "verbose: ", $config->verbose(), "\n";
print " debug: ", $config->debug(), "\n";
print "logfile: ", $config->logfile(), "\n";
print "summary: ", $config->summary(), "\n";
|