Skip to content

Commit

Permalink
RT #74078 is fixed so removed hack from FastaIO.pm. Added FastaIO to …
Browse files Browse the repository at this point in the history
…Makefile
  • Loading branch information
phil committed Jul 9, 2010
1 parent 2b8ed38 commit 887c385
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
2 changes: 2 additions & 0 deletions Makefile
Expand Up @@ -6,8 +6,10 @@ SOURCES= \
./lib/Bio/Role/Range.pm \
./lib/Bio/Role/Describe.pm \
./lib/Bio/Role/Identify.pm \
./lib/Bio/Role/FastaIO.pm \
./lib/Bio/PrimarySeq.pm \
./lib/Bio/SeqIO.pm


PIRS=$(SOURCES:.pm=.pir)

Expand Down
15 changes: 5 additions & 10 deletions lib/Bio/Role/FastaIO.pm
@@ -1,7 +1,5 @@
#stupid RT bug # 74078 Need to create new reference to see builtin functions
our &shiftt = &shift;
our &op = &open;
our &s = &say;


use Bio::Grammar::Fasta;
use Bio::Grammar::Actions::Fasta;
role Bio::Role::FastaIO[$file]{
Expand All @@ -11,14 +9,12 @@ has Int $!width=80;
has $!fh;

method next_seq() {
#rakudo bug, cannot use builtin functions in roles RT #74078
return &shiftt(@!results);
return shift(@!results);
}

#method will not be private and/or put in new buildmethod
method initial_read() {
#need to deal with stdin
#just need to replace $file with $*IN.slurp()

#perhaps a different role.... this should be in a ROOT::IO module and not here
if $file.WHAT ~~ IO {
@!results = @(Bio::Grammar::Fasta.parse($file.slurp(), :actions(Bio::Grammar::Actions::Fasta)).ast);
Expand All @@ -31,14 +27,13 @@ method initial_read() {
}

method initial_write() {
#rakudo bug RT #74078
#need error checking to ensure that we did indeed open a new file

if $file.WHAT ~~ IO {
$!fh = $file;
}
else {
$!fh = &op($file,:w);
$!fh = open($file,:w);
}
}

Expand Down

0 comments on commit 887c385

Please sign in to comment.