use v6;

=begin pod

=TITLE Introduction to Protein Databases

=AUTHOR L. Grondin

L<http://rosalind.info/problems/dbpr/>

Sample input

    Q5SLP9

Sample output

    DNA recombination
    DNA repair
    DNA replication

=end pod

use LWP::Simple;

sub MAIN(Str $id = "Q5SLP9") {
    for split "\n", LWP::Simple.get(qq{http://www.uniprot.org/uniprot/$id.txt}) {
        if / GO\; .* \sP\: (.*?)\;/ {
            say $/[0].Str
        }
    }
}

# vim: expandtab shiftwidth=4 ft=perl6

use v6;

=begin pod

=TITLE Introduction to Protein Databases

=AUTHOR L. Grondin

L<http://rosalind.info/problems/dbpr/>

Sample input

    Q5SLP9

Sample output

    DNA recombination
    DNA repair
    DNA replication

=end pod

use LWP::Simple;

sub MAIN(Str $id = "Q5SLP9") {
    my $base-path = $*PROGRAM_NAME.IO.dirname;
    my $id-fname = $base-path ~ "/$id.txt";
    my $input = $id-fname.IO.e
        ?? $id-fname.IO.slurp
        !! LWP::Simple.get(qq{http://www.uniprot.org/uniprot/$id.txt});
    for split "\n", $input {
        if / GO\; .* \sP\: (.*?)\;/ {
            say $/[0].Str
        }
    }
}

# vim: expandtab shiftwidth=4 ft=perl6

Use local .txt input files if available
Use local .txt input files if available
