Lines Matching defs:constant
1 package constant;
25 # be inlined as a constant, thereby avoiding further sub calling
30 return unless @_; # Ignore 'use constant;'
47 Carp::croak("Can't use undef as constant name");
51 # Normal constant name
76 # please let me know what your constant's name was.
83 # use constant FRED == fred;
126 constant - Perl pragma to declare constants
130 use constant PI => 4 * atan2(1, 1);
131 use constant DEBUG => 0;
135 use constant {
147 use constant WEEKDAYS => qw(
155 This will declare a symbol to be a constant with the given value.
157 When you declare a constant such as C<PI> using the method shown
164 When a constant is used in an expression, perl replaces it with its
167 away if the constant is false.
171 As with all C<use> directives, defining a constant happens at
172 compile time. Thus, it's probably not correct to put a constant
174 { use constant ... }>).
182 Even though a reference may be declared as a constant, the reference may
185 use constant ARRAY => [ 1,2,3,4 ];
190 Dereferencing constant references incorrectly (such as using an array
191 subscript on a constant hash reference, or vice versa) will be trapped at
195 constant defined in another package, specify the full package name, as
202 The use of all caps for constant names is merely a convention,
212 Constants may be lists of more (or less) than one value. A constant
220 constant is evaluated in list context. This may produce surprises:
222 use constant TIMESTAMP => localtime; # WRONG!
223 use constant TIMESTAMP => scalar localtime; # right
238 Instead of writing multiple C<use constant> statements, you may define
240 constant name, a reference to a hash where the keys are the names of
244 use constant {
256 calling package doesn't know about any constant within that group
259 use constant {
270 use constant E2BIG => ($! = 7);
274 You can't produce a tied constant by giving a tied scalar as the
282 scalar constant is inserted directly in place of some subroutine
288 particular constant has been declared via this module, you may use
289 this function to examine the hash C<%constant::declared>. If the given
290 constant name does not include a package name, the current package is
294 use constant 1.01; # don't omit this!
299 $constant::declared{$full_name};
308 name as a constant in the same package. This is probably a Good Thing.
310 A constant with a name in the list C<STDIN STDOUT STDERR ARGV ARGVOUT
332 Multiple constant declarations at once added by Casey West,