Created
January 8, 2020 16:14
-
-
Save atoomic/98ee3a7af8e26989fb6bae6085c8e3ed to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!perl | |
use Test::More; | |
my %storage; | |
use constant SAMPLE_CONSTANT => defined eval { $storage{cache} = get_string('abcd') }; | |
sub get_string { | |
my ( $str ) = @_; | |
return ":$str:"; | |
} | |
is SAMPLE_CONSTANT, 1, "constant is set to true"; | |
is $storage{cache}, ':abcd:', "cache is set at compile time"; | |
done_testing; |
Author
atoomic
commented
Jan 8, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment