Front page | perl.perl5.porters |
Postings from January 2005
[perl #33978] pod update for constant.pm
Thread Next
From:
ben @ zaeon . com
Date:
January 28, 2005 15:09
Subject:
[perl #33978] pod update for constant.pm
Message ID:
rt-3.0.11-33978-106691.12.5414181524606@perl.org
# New Ticket Created by ben@zaeon.com
# Please include the string: [perl #33978]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=33978 >
This is a bug report for perl from ben@zaeon.com,
generated with the help of perlbug 1.35 running under perl v5.8.4.
-----------------------------------------------------------------
[Please enter your report here]
Hi, I thought this might be a helpful tip to add to the documentation
of constant.pm. It saves the hassle of maintaining both the definition
of a large set of constants and a separate list for export (or whatever).
--- /usr/lib/perl5/5.8.4/constant.pm 2004-10-07 14:23:19.000000000 -0500
+++ constant.pm 2005-01-28 16:37:59.000000000 -0600
@@ -261,6 +261,18 @@
NEGMASK => ~BITMASK, # Error!
};
+It can sometimes be useful to keep track of the names of your
+constants, especially when you want to export all of the constants
+defined in a module. You can't pass a variable to use constant,
+but by assigning the hashref in passing, you can make use of it.
+
+ my $constants;
+ use contant $constants = {
+ FOO => 'first',
+ BAR => 'last',
+ };
+ @EXPORT = keys %$constants;
+
=head2 Magic constants
Magical values and references can be made into constants at compile
[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
category=docs
severity=low
---
Site configuration information for perl v5.8.4:
Configured by Gentoo at Thu Oct 7 14:06:20 CDT 2004.
Summary of my perl5 (revision 5 version 8 subversion 4) configuration:
Platform:
osname=linux, osvers=2.4.22-gentoo-r2, archname=i686-linux
uname='linux marklar.zaeon.com 2.4.22-gentoo-r2 #3 mon jan 5 06:59:15 cst 2004 i686 pentium iii (coppermine) genuineintel gnulinux '
config_args='-des -Darchname=i686-linux -Dcccdlflags=-fPIC -Dccdlflags=-rdynamic -Dcc=gcc -Dprefix=/usr -Dvendorprefix=/usr -Dsiteprefix=/usr -Dlocincpth= -Doptimize=-march=pentium3 -O3 -pipe -fomit-frame-pointer -fforce-addr -falign-functions=4 -fprefetch-loop-arrays -Duselargefiles -Dd_semctl_semun -Dscriptdir=/usr/bin -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dinstallman1dir=/usr/share/man/man1 -Dinstallman3dir=/var/tmp/portage/perl-5.8.4-r1/image//usr/share/man/man3 -Dman1ext=1 -Dman3ext=3pm -Dcf_by=Gentoo -Ud_csh -Di_ndbm -Di_gdbm -Di_db'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='gcc', ccflags ='-fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-march=pentium3 -O3 -pipe -fomit-frame-pointer -fforce-addr -falign-functions=4 -fprefetch-loop-arrays',
cppflags='-DPERL5 -fno-strict-aliasing'
ccversion='', gccversion='3.3.2 20031218 (Gentoo Linux 3.3.2-r5, propolice-3.3-7)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='gcc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lpthread -lnsl -lndbm -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc
perllibs=-lpthread -lnsl -ldl -lm -lcrypt -lutil -lc
libc=/lib/libc-2.3.2.so, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version='2.3.2'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib'
Locally applied patches:
---
@INC for perl v5.8.4:
/etc/perl
/usr/lib/perl5/site_perl/5.8.4/i686-linux
/usr/lib/perl5/site_perl/5.8.4
/usr/lib/perl5/site_perl/5.8.2
/usr/lib/perl5/site_perl/5.8.0/i686-linux
/usr/lib/perl5/site_perl/5.8.0
/usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.4/i686-linux
/usr/lib/perl5/vendor_perl/5.8.4
/usr/lib/perl5/vendor_perl/5.8.2
/usr/lib/perl5/vendor_perl/5.8.0
/usr/lib/perl5/vendor_perl
/usr/lib/perl5/5.8.4/i686-linux
/usr/lib/perl5/5.8.4
/usr/local/lib/site_perl
/usr/lib/perl5/site_perl/5.8.2
/usr/lib/perl5/site_perl/5.8.0/i686-linux
/usr/lib/perl5/site_perl/5.8.0
.
---
Environment for perl v5.8.4:
HOME=/home/ben
LANG (unset)
LANGUAGE (unset)
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=/home/ben/bin:/bin:/usr/bin:/usr/local/bin:/opt/bin:/usr/i686-pc-linux-gnu/gcc-bin/3.3:/usr/X11R6/bin
PERL_BADLANG (unset)
SHELL=/bin/bash
Thread Next
-
[perl #33978] pod update for constant.pm
by ben @ zaeon . com