[Bioperl-l] typo in perldoc of get_replaced_terms

Chris Fields cjfields at illinois.edu
Sat Jun 5 09:35:51 EDT 2010


On Jun 4, 2010, at 2:58 PM, Peng Yu wrote:

> Hi,
> 
> I think that there is a typo in the document of get_replaced_terms.
> The following is from perldoc Bio::DB::EUtilities.
> $eutil->get_replaced_term should be $eutil->get_replaced_terms, right?
> (Note 's').
> 
> 
>   get_replaced_terms
>        Title    : get_replaced_terms
>        Usage    : my $term = $eutil->get_replaced_term
>        Function : returns array of strings replaced in the query
>        Returns  : string
>        Args     : none
>        Notes    : only applicable for espell
> 
> 
> Also, I tried the following code. I'm not sure I got the following
> error. Would you please let me know what I'm wrong?
> 
> $ cat ./get_replaced_terms/main.pl
> #!/usr/bin/env perl
> 
> use strict;
> use warnings;
> 
> use Bio::DB::EUtilities;
> 
> my $factory = Bio::DB::EUtilities->new(-eutil => 'espell',
>                         -term => 'brest cnacer',
>                         -email => 'mymail at foo.bar'
>                       );
> 
> print "get_replaced_terms: ",$factory->get_replaced_terms,"\n";
> 
> $  ./get_replaced_terms/main.pl
> Use of uninitialized value in print at ./get_replaced_terms/main.pl line 13.
> get_replaced_terms:
> 
> 
> -- 
> Regards,
> Peng

There were no replaced terms returned, you can see this in the raw XML (see below).  So the method doesn't return anything, hence the warning.  You can get around this if you do something like:

print "get_replaced_terms: ".($factory->get_replaced_terms || '')."\n";

chris


pyrimidine1:email cjfields$ cat espell.pl 
#!/usr/bin/env perl

use strict;
use warnings;

use Bio::DB::EUtilities;

my $factory = Bio::DB::EUtilities->new(-eutil => 'espell',
                        -term => 'brest cnacer',
                        -email => 'mymail at foo.bar'
                      );

print $factory->get_Response->content."\n";

pyrimidine1:email cjfields$ perl espell.pl 
<?xml version="1.0"?>
<!DOCTYPE eSpellResult PUBLIC "-//NLM//DTD eSpellResult, 23 November 2004//EN" "http://www.ncbi.nlm.nih.gov/entrez/query/DTD/eSpell.dtd">
<eSpellResult>
	<Database>pubmed</Database>
	<Query>brest cnacer</Query>
	<CorrectedQuery>breast cancer</CorrectedQuery>
	<SpelledQuery/>
	<ERROR/>
</eSpellResult>


chris


More information about the Bioperl-l mailing list