Acme-constant
view release on metacpan or search on metacpan
lib/Acme/constant.pm view on Meta::CPAN
use Acme::constant KEY => "acme";
my %hash;
$hash{KEY} = 42; # Works like $hash{"KEY"} = 42;
Instead, you should use following code.
use Acme::constant KEY => "acme";
my %hash;
$hash{(KEY)} = 42;
=head1 DIAGNOSTICS
=over 4
=item Can't call %s in scalar context
(F) You tried to call constant containing constant containing different
numbers than one in scalar context. As it's hard to determine what you
mean, you have to disambiguate your call. If you want to get count of
elements, you may want to assign it to C<()>, like C<() = CONSTANT>. If
you want to get last element, use C<(CONSTANT)[-1]>.
=item Can't modify non-lvalue subroutine call
(F) You tried to assign single value to constant containing an array.
This won't work, as Perl expects a list to be assigned. If you really
want to assign an single element, use C<(CONSTANT) = $value> syntax.
This error is provided by Perl, and as such, it could be confusing,
as constant actually is lvalue, just assigned in wrong context.
=item Useless localization of subroutine entry
(W syntax) You tried to localize constant with C<local> operator. This
is legal, but currently has no effect. This may change in some future
version of Perl, but in the meantime such code is discouraged.
=item Useless use of "Acme::constant" pragma
(W) You did C<use Acme::constant;> without any arguments. This isn't
very useful. If this is what you mean, write C<use Acme::constant ();>
instead.
=back
=head1 SEE ALSO
L<constant> - Builtin constant module.
L<Readonly> - Constant scalars, arrays, and hashes.
=head1 BUGS
Please L<use GitHub|https://github.com/GlitchMr/Acme-constant/issues>
to report bugs.
=head1 SOURCE
The source code for Acme::constant is available can be found
L<https://github.com/GlitchMr/Acme-constant/>.
=head1 COPYRIGHT
Copyright 2013 by Konrad Borowski <glitchmr@myopera.com>.
( run in 0.975 second using v1.01-cache-2.11-cpan-df04353d9ac )