Ah, okay, I missed that it isn’t in the ‘require’ but in the symbol lookup afterwards. Okay, I think this makes some sense (I’ll look through docs to see if it goes with what is mentioned there), though it is a bit inconsistent in behavior with the base ‘fasta' module working while the nested ones (‘Bio::fasta’, ‘Bio::SeqIO::fasta’) don't.
On 2/3/17, 7:38 AM, "Chris Fields via RT" <perl6-bugs-follo...@perl.org> wrote: >Thanks nine. My suggestion is that it's at the very least a buglet, in that >there isn't consistency with how modules are loaded (note the module in the >base directory, 'fasta', worked). > >If the syntax stays, I also think it's worth noting this behavior in the docs >and pointing out why it's set up this way, both of the following imply the >'require ::($foo)' should work, but maybe this wasn't worked out prior to >lexical module fixes? > >https://docs.perl6.org/syntax/require >https://docs.perl6.org/language/packages#index-entry-%3A%3A%28%29 > >On Fri, 03 Feb 2017 02:34:45 -0800, n...@detonation.org wrote: >> The issue can be worked around/fixed with the following patch: >> >> diff --git a/lib/Bio/SeqIO.pm6 b/lib/Bio/SeqIO.pm6 >> index 9ee4980..710dec4 100644 >> --- a/lib/Bio/SeqIO.pm6 >> +++ b/lib/Bio/SeqIO.pm6 >> @@ -10,10 +10,10 @@ class Bio::SeqIO { >> require ::($format); >> }; >> >> - if ::($format) ~~ Failure { >> + if MY::{$format} ~~ Failure { >> die "Can't load $format: $!"; >> } else { >> - $!plugin = ::($format).new(); >> + $!plugin = MY::{$format}.new(); >> } >> } >> } >> >> As the symbols are imported lexically, you will find them in the >> lexical (MY) scope. I'm not sure if this should be considered a bug or >> not. I'm not familiar enough with the thoughts that went into the >> design. It's certainly a pitty, that ::() which is quite short became >> less useful and users have to use the longer MY::() instead. > >