I have a bunch of Perl 6 tests that start with some basic tests, where I put the class name to test in a variable that uses this variable during the test:
my $package = 'Some::Class'; use-ok $package; my $class = ::($package); can-ok $class, 'new';
I did not pay attention to this a bit, but it does not work anymore, because classes are lexically loaded now :
There is no such symbol "Some :: Class"
It's not hard. Download the module without use-ok and to the area where I want ::($package) :
use Some::Class; ...
Other solutions (possibly shying away from the ugly EVAL ) have a problem I'm trying to avoid.
But I donโt particularly like it, because the name is displayed twice in the file. I especially liked my previous working idiom, which I ported from Perl 5. If I wanted to change the name of the class, it appeared only once in the file. I could easily generate test tests (although this is not much harder to fix).
Is there a way to get back to the ideal I need? (Although I believe that lexical loading in the next version will be on the way again).
perl6
brian d foy
source share