make xsubpp generate well-formed code with CAPI && !PERL_OBJECT
[p5sagit/p5-mst-13.2.git] / lib / constant.pm
index 4416cf2..464e20c 100644 (file)
@@ -80,6 +80,7 @@ B<necessarily> that value in the current implementation.
 
 Magical values, tied values, and references can be made into
 constants at compile time, allowing for way cool stuff like this.
+(These error numbers aren't totally portable, alas.)
 
     use constant E2BIG => ($! = 7);
     print   E2BIG, "\n";       # something like "Arg list too long"
@@ -105,6 +106,15 @@ name as a constant. This is probably a Good Thing.
 Unlike constants in some languages, these cannot be overridden
 on the command line or via environment variables.
 
+You can get into trouble if you use constants in a context which
+automatically quotes barewords (as is true for any subroutine call).
+For example, you can't say C<$hash{CONSTANT}> because C<CONSTANT> will
+be interpreted as a string.  Use C<$hash{CONSTANT()}> or
+C<$hash{+CONSTANT}> to prevent the bareword quoting mechanism from
+kicking in.  Similarly, since the C<=E<gt>> operator quotes a bareword
+immediately to its left you have to say C<CONSTANT() =E<gt> 'value'>
+instead of C<CONSTANT =E<gt> 'value'>.
+
 =head1 AUTHOR
 
 Tom Phoenix, E<lt>F<rootbeer@teleport.com>E<gt>, with help from
@@ -126,7 +136,7 @@ use vars qw($VERSION);
 #=======================================================================
 
 # Some of this stuff didn't work in version 5.003, alas.
-require 5.003_20;
+require 5.003_96;
 
 #=======================================================================
 # import() - import symbols into user's namespace