Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cjfields/bp6-bug
Lexical loading bug?
https://github.com/cjfields/bp6-bug
Last synced: 13 days ago
JSON representation
Lexical loading bug?
- Host: GitHub
- URL: https://github.com/cjfields/bp6-bug
- Owner: cjfields
- Created: 2017-02-03T04:12:03.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-05T03:07:01.000Z (almost 8 years ago)
- Last Synced: 2024-11-05T20:51:39.490Z (2 months ago)
- Language: Perl6
- Homepage:
- Size: 5.86 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Bug report
Instead of packaging this up, I'm posting this here so the repo can be easily cloned and tested.
I'm seeing a bug that appeared after lexical module loading was introduced, which is tied to
the name of the class and how deep it is in the path.```
[cjfields@Chriss-MacBook-Air lex-bp6]$ tree .
.
├── SeqIO.pl6
└── lib
├── Bio
│ ├── SeqIO
│ │ └── fasta.pm6
│ ├── SeqIO.pm6
│ └── fasta.pm6
└── fasta.pm63 directories, 5 files
```In the script and the directory structure, note that three modules are named similarly, e.g. `fasta`, `Bio::fasta`, and `Bio::SeqIO::fasta`. The pluggable `Bio::SeqIO` dynamically loads the module passed.
The test script:
```perl6
use v6;use lib './lib';
use Test;
# Pluggable module
use Bio::SeqIO;# Uncomment these lines and the tests pass
#use Bio::fasta;
#use Bio::SeqIO::fasta;# passes
lives-ok {Bio::SeqIO.new(format => 'fasta')}, 'simple path';# These next two fail w/ 'No such symbol' errors
lives-ok {Bio::SeqIO.new(format => 'Bio::fasta')}, 'one level deep';
lives-ok {Bio::SeqIO.new(format => 'Bio::SeqIO::fasta')}, 'two levels deep';
```Note the commented `use` statements; these should be loaded dynamically. When running this, the last two tests fail:
```
[cjfields@Chriss-MacBook-Air lex-bp6 (master)]$ perl6 SeqIO.pl6
ok 1 - simple path
not ok 2 - one level deep# Failed test 'one level deep'
# at SeqIO.pl6 line 18
# Can't load Bio::fasta: No such symbol 'Bio::fasta'
not ok 3 - two levels deep# Failed test 'two levels deep'
# at SeqIO.pl6 line 19
# Can't load Bio::SeqIO::fasta: No such symbol 'Bio::SeqIO::fasta'
```If you uncomment the line, they pass:
```
[cjfields@Chriss-MacBook-Air lex-bp6 (master)]$ cat SeqIO.pl6
use v6;use lib './lib';
use Test;
# Pluggable module
use Bio::SeqIO;# Uncomment these lines and the tests pass
use Bio::fasta;
use Bio::SeqIO::fasta;# passes
lives-ok {Bio::SeqIO.new(format => 'fasta')}, 'simple path';# These next two fail w/ 'No such symbol' errors
lives-ok {Bio::SeqIO.new(format => 'Bio::fasta')}, 'one level deep';
lives-ok {Bio::SeqIO.new(format => 'Bio::SeqIO::fasta')}, 'two levels deep';[cjfields@Chriss-MacBook-Air lex-bp6 (master)]$ perl6 SeqIO.pl6
ok 1 - simple path
ok 2 - one level deep
ok 3 - two levels deep
[cjfields@Chriss-MacBook-Air lex-bp6 (master)]$
```