start page | rating of books | rating of authors | reviews | copyrights

Book HomeJava and XSLTSearch this book

8.44. Config

Used to access configuration information. When Perl is built, the Configure script obtains and saves this information in a hash, %Config, in Config.pm itself. Config checks to be sure it's running with the same Perl version as the one that created the hash.

The index into the hash is the shell variable name. %Config is always exported; the following three functions are exported on request.

config_sh

config_sh

Returns all Perl configuration information.

use Config(qw(config_sh));
print config_sh( );

returns:

archlibexp='sun4-solaris'
cc='cc'
ccflags='-I/usr/local/include/sfio -I/usr/local/include'
...
config_vars

config_vars (names)

Returns the name/value pairs for the requested configuration variables. Prints the results to STDOUT.

use Config(qw(config_vars));
print config_vars(qw(osname ccflags));

returns:

osname='solaris'
ccflags='-I/usr/local/include/sfio -I/usr/local/include'
myconfig

myconfig

Returns a summary of the major Perl configuration values.



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.