package Config; require Exporter; @ISA = (Exporter); @EXPORT = qw(%Config); $] == 5.001 or die sprintf "Perl lib version (5.001) doesn't match executable version (%.3f)\n", $]; # This file was created by configpm when Perl was built. Any changes # made to this file will be lost the next time perl is built. =head1 NAME Config - access Perl configuration option =head1 SYNOPSIS use Config; if ($Config{'cc'} =~ /gcc/) { print "built by gcc\n"; } =head1 DESCRIPTION The Config module contains everything that was available to the C program at Perl build time. Shell variables from F are stored in the readonly-variable C<%Config>, indexed by their names. =head1 EXAMPLE Here's a more sophisticated example of using %Config: use Config; defined $Config{sig_name} || die "No sigs?"; foreach $name (split(' ', $Config{sig_name})) { $signo{$name} = $i; $signame[$i] = $name; $i++; } print "signal #17 = $signame[17]\n"; if ($signo{ALRM}) { print "SIGALRM is $signo{ALRM}\n"; } =head1 NOTE This module contains a good example of how to make a variable readonly to those outside of it. =cut ## ## This file was produced by running the Configure script. It holds all the ## definitions figured out by Configure. Should you modify one of these values, ## do not forget to propagate your changes by running "Configure -der". You may ## instead choose to run each of the .SH files by yourself, or "Configure -S". ## # ## Configuration time: Tue Jul 11 10:02:02 EDT 1995 ## Configured by: marc ## Target system: linux porky.redhat.com 1.2.9 #5 thu jun 8 09:50:07 gmt 1995 i586 # ## Variables propagated from previous config.sh file. $config_sh=<<'!END!OF!CONFIG!'; archlib='/usr/lib/perl5/i586-linux' ccflags='-D__USE_BSD_SIGNAL -Dbool=char -DHAS_BOOL' cppflags='-D__USE_BSD_SIGNAL -Dbool=char -DHAS_BOOL' dynamic_ext='DB_File Fcntl GDBM_File ODBM_File POSIX SDBM_File Socket' extensions='DB_File Fcntl GDBM_File ODBM_File POSIX SDBM_File Socket' intsize='4' libpth='/lib /usr/lib /usr/local/lib' osname='linux' osvers='1' sharpbang='#!' shsharp='true' sig_name='ZERO HUP INT QUIT ILL TRAP IOT BUS FPE KILL USR1 SEGV USR2 PIPE ALRM TERM STKFLT CHLD CONT STOP TSTP TTIN TTOU URG XCPU XFSZ VTALRM PROF WINCH LOST PWR UNUSED' so='so' startsh='#!/bin/sh' static_ext=' ' Author='' CONFIG='true' Date='$Date' Header='' Id='$Id' Locker='' Log='$Log' Mcc='Mcc' PATCHLEVEL='1' RCSfile='$RCSfile' Revision='$Revision' Source='' State='' afs='false' alignbytes='4' aphostname='' archlibexp='/usr/lib/perl5/i586-linux' archname='i586-linux' awk='awk' baserev='5.0' bash='' bin='/usr/bin' binexp='/usr/bin' bison='' byacc='byacc' byteorder='1234' c='' castflags='0' cat='cat' cc='gcc' cccdlflags='-fpic' ccdlflags='-rdynamic' cf_by='marc' cf_time='Tue Jul 11 10:02:02 EDT 1995' chgrp='' chmod='' chown='' clocktype='clock_t' comm='comm' compress='' contains='grep' cp='cp' cpio='' cpp='cpp' cpp_stuff='42' cpplast='-' cppminus='-' cpprun='gcc -E' cppstdin='gcc -E' cryptlib='' csh='csh' d_Gconvert='gcvt((x),(n),(b))' d_access='define' d_alarm='define' d_archlib='define' d_attribut='define' d_bcmp='define' d_bcopy='define' d_bsd='undef' d_bsdpgrp='undef' d_bzero='define' d_casti32='undef' d_castneg='define' d_charvspr='undef' d_chown='define' d_chroot='define' d_chsize='undef' d_closedir='define' d_const='define' d_crypt='define' d_csh='define' d_cuserid='define' d_dbl_dig='define' d_dbm_open='undef' d_difftime='define' d_dirnamlen='undef' d_dlerror='define' d_dlopen='define' d_dlsymun='undef' d_dosuid='define' d_dup2='define' d_eunice='undef' d_fchmod='define' d_fchown='define' d_fcntl='define' d_fd_macros='define' d_fd_set='define' d_fds_bits='define' d_fgetpos='define' d_flexfnam='define' d_flock='define' d_fork='define' d_fpathconf='define' d_fsetpos='define' d_getgrps='define' d_gethent='define' d_gethname='undef' d_getlogin='define' d_getpgrp2='undef' d_getpgrp='define' d_getppid='define' d_getprior='define' d_htonl='define' d_index='undef' d_isascii='define' d_killpg='define' d_link='define' d_locconv='define' d_lockf='define' d_lstat='define' d_mblen='define' d_mbstowcs='define' d_mbtowc='define' d_memcmp='define' d_memcpy='define' d_memmove='define' d_memset='define' d_mkdir='define' d_mkfifo='define' d_mktime='define' d_msg='define' d_msgctl='define' d_msgget='define' d_msgrcv='define' d_msgsnd='define' d_mymalloc='undef' d_nice='define' d_oldsock='undef' d_open3='define' d_pathconf='define' d_pause='define' d_phostname='undef' d_pipe='define' d_portable='define' d_pwage='undef' d_pwchange='undef' d_pwclass='undef' d_pwcomment='undef' d_pwexpire='undef' d_pwquota='undef' d_readdir='define' d_readlink='define' d_rename='define' d_rewinddir='define' d_rmdir='define' d_safebcpy='define' d_safemcpy='undef' d_seekdir='define' d_select='define' d_sem='define' d_semctl='define' d_semget='define' d_semop='define' d_setegid='define' d_seteuid='define' d_setlinebuf='define' d_setlocale='define' d_setpgid='define' d_setpgrp2='undef' d_setpgrp='define' d_setprior='define' d_setregid='define' d_setresgid='undef' d_setresuid='undef' d_setreuid='define' d_setrgid='undef' d_setruid='undef' d_setsid='define' d_shm='define' d_shmat='define' d_shmatprototype='define' d_shmctl='define' d_shmdt='define' d_shmget='define' d_shrplib='undef' d_sitelib='undef' d_socket='define' d_sockpair='define' d_statblks='define' d_stdio_cnt_lval='undef' d_stdio_ptr_lval='define' d_stdiobase='define' d_stdstdio='define' d_strchr='define' d_strcoll='define' d_strctcpy='define' d_strerrm='strerror(e)' d_strerror='define' d_strxfrm='define' d_suidsafe='undef' d_symlink='define' d_syscall='define' d_sysconf='define' d_sysernlst='' d_syserrlst='define' d_system='define' d_tcgetpgrp='define' d_tcsetpgrp='define' d_telldir='define' d_time='define' d_times='define' d_truncate='define' d_tzname='define' d_umask='define' d_uname='define' d_vfork='undef' d_void_closedir='undef' d_voidsig='define' d_voidtty='' d_volatile='define' d_vprintf='define' d_wait4='define' d_waitpid='define' d_wcstombs='define' d_wctomb='define' d_xenix='undef' date='date' db_hashtype='u_int32_t' db_prefixtype='size_t' defvoidused='15' direntrytype='struct dirent' dlext='so' dlsrc='dl_dlopen.xs' echo='echo' egrep='egrep' emacs='' eunicefix=':' expr='expr' find='find' flex='' fpostype='fpos_t' freetype='void' full_csh='/bin/csh' full_sed='/bin/sed' gcc='' gccversion='2.7.0' gidtype='gid_t' glibpth='/usr/shlib /lib/pa1.1 /usr/lib/large /lib /usr/lib /usr/lib/386 /lib/386 /lib/large /usr/lib/small /lib/small /usr/ccs/lib /usr/ucblib /usr/local/lib ' grep='grep' groupcat='' groupstype='gid_t' h_fcntl='false' h_sysfile='true' hint='previous' hostcat='' huge='' i_bsdioctl='' i_db='define' i_dbm='define' i_dirent='define' i_dld='undef' i_dlfcn='define' i_fcntl='undef' i_float='define' i_gdbm='define' i_grp='define' i_limits='define' i_malloc='define' i_math='define' i_memory='define' i_ndbm='undef' i_neterrno='undef' i_niin='define' i_pwd='define' i_sgtty='undef' i_stdarg='define' i_stddef='define' i_stdlib='define' i_string='define' i_sysdir='define' i_sysfile='define' i_sysfilio='undef' i_sysin='undef' i_sysioctl='define' i_sysndir='undef' i_sysparam='define' i_sysselct='undef' i_syssockio='' i_sysstat='define' i_systime='define' i_systimek='undef' i_systimes='define' i_systypes='define' i_termio='undef' i_termios='define' i_time='undef' i_unistd='define' i_utime='define' i_varargs='undef' i_varhdr='stdarg.h' i_vfork='undef' incpath='' inews='' installarchlib='/usr/lib/perl5/i586-linux' installbin='/usr/bin' installman1dir='/usr/man/man1' installman3dir='/usr/man/man3' installprivlib='/usr/lib/perl5' installscript='/usr/bin' installsitelib='' known_extensions='DB_File Fcntl GDBM_File NDBM_File ODBM_File POSIX SDBM_File Socket' ksh='' large='' ld='gcc' lddlflags='-shared' ldflags='' less='' libc='' libs='-lgdbm -ldbm -ldb -ldl -lm -lc -lbsd' libswanted='net socket inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun m c cposix posix ndir dir crypt ucb bsd BSD PW x' line='line' lint='' lkflags='' ln='ln' lns='/bin/ln -s' lp='' lpr='' ls='ls' lseektype='off_t' mail='' mailx='' make='' mallocobj='' mallocsrc='' malloctype='void *' man1dir='/usr/man/man1' man1direxp='/usr/man/man1' man1ext='1' man3dir='/usr/man/man3' man3direxp='/usr/man/man3' man3ext='3' medium='' mips='' mips_type='' mkdir='mkdir' models='none' modetype='mode_t' more='' mv='' myarchname='i586-linux' mydomain='' myhostname='porky.redhat.com' myuname='linux porky.redhat.com 1.2.9 #5 thu jun 8 09:50:07 gmt 1995 i586 ' n='-n' nm_opt='' nroff='nroff' optimize='-O2 -m486' orderlib='false' package='perl5' passcat='' patchlevel='1' perl='perl' pg='' phostname='hostname' plibpth='' pmake='' pr='' prefix='/usr' prefixexp='/usr' privlib='/usr/lib/perl5' privlibexp='/usr/lib/perl5' prototype='define' randbits='31' ranlib=':' rm='rm' rmail='' runnm='false' scriptdir='/usr/bin' scriptdirexp='/usr/bin' sed='sed' selecttype='fd_set *' sendmail='' sh='' shar='' shmattype='char *' shrpdir='none' signal_t='void' sitelib='' sitelibexp='' sizetype='size_t' sleep='' smail='' small='' sockethdr='' socketlib='' sort='sort' spackage='Perl5' spitshell='cat' split='' ssizetype='ssize_t' stdchar='char' stdio_base='((fp)->_IO_read_base)' stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)' stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)' stdio_ptr='((fp)->_IO_read_ptr)' strings='/usr/include/string.h' submit='' sysman='/usr/man/man1' tail='' tar='' tbl='' test='test' timeincl='/usr/include/sys/time.h ' timetype='time_t' touch='touch' tr='tr' troff='' uidtype='uid_t' uname='uname' uniq='uniq' usedl='define' usemymalloc='n' usenm='false' useposix='true' usevfork='false' usrinc='/usr/include' uuname='' vi='' voidflags='15' xlibpth='/usr/lib/386 /lib/386' zcat='' !END!OF!CONFIG! tie %Config, Config; sub TIEHASH { bless {} } sub FETCH { # check for cached value (which maybe undef so we use exists not defined) return $_[0]->{$_[1]} if (exists $_[0]->{$_[1]}); my($value); # search for the item in the big $config_sh string return undef unless (($value) = $config_sh =~ m/^$_[1]='(.*)'\s*$/m); $value = undef if $value eq 'undef'; # So we can say "if $Config{'foo'}". $_[0]->{$_[1]} = $value; # cache it return $value; } sub FIRSTKEY { $prevpos = 0; my $key; ($key) = $config_sh =~ m/^(.*)=/; $key; } sub NEXTKEY { my ($pos, $len); $pos = $prevpos; $pos = index( $config_sh, "\n", $pos) + 1; $prevpos = $pos; $len = index( $config_sh, "=", $pos) - $pos; $len > 0 ? substr( $config_sh, $pos, $len) : undef; } sub EXISTS{ exists($_[0]->{$_[1]}) or $config_sh =~ m/^$_[1]=/m; } sub readonly { die "\%Config::Config is read-only\n" } sub myconfig { my($output); $output = <<'END'; Summary of my $package (patchlevel $PATCHLEVEL) configuration: Platform: osname=$osname, osver=$osvers, archname=$archname uname='$myuname' hint=$hint Compiler: cc='$cc', optimize='$optimize' cppflags='$cppflags' ccflags ='$ccflags' ldflags ='$ldflags' stdchar='$stdchar', d_stdstdio=$d_stdstdio, usevfork=$usevfork voidflags=$voidflags, castflags=$castflags, d_casti32=$d_casti32, d_castneg=$d_castneg intsize=$intsize, alignbytes=$alignbytes, usemymalloc=$usemymalloc, randbits=$randbits Libraries: so=$so libpth=$libpth libs=$libs libc=$libc Dynamic Linking: dlsrc=$dlsrc, dlext=$dlext, d_dlsymun=$d_dlsymun cccdlflags='$cccdlflags', ccdlflags='$ccdlflags', lddlflags='$lddlflags' END $output =~ s/\$(\w+)/$Config{$1}/ge; $output; } sub STORE { &readonly } sub DELETE{ &readonly } sub CLEAR { &readonly } 1;