Skip to content

Commit

Permalink
perltidy
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Fields committed Dec 14, 2011
1 parent fc64a3e commit ded877a
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 32 deletions.
16 changes: 10 additions & 6 deletions Bio/DB/SeqVersion/gi.pm
Expand Up @@ -196,7 +196,7 @@ sub get_recent {
sub get_history {
my ( $self, $id ) = @_;
my $html = $self->_get_request($id);
my ($ref, $status) = $self->_process_data($html);
my ( $ref, $status ) = $self->_process_data($html);

# store the very last result in case some other methods
# are called using the same identifier
Expand All @@ -223,7 +223,9 @@ sub _get_request {
my $url = sprintf( $URL, $id );
my $response = $self->get($url);
if ( not $response->is_success ) {
$self->throw( "Can't query $url: " . $response->status_line . "\n" ."ID likely does not exist");
$self->throw( "Can't query $url: "
. $response->status_line . "\n"
. "ID likely does not exist" );
}
$self->debug( "Response is:\n", $response->content, "\n" );
return $response->content;
Expand All @@ -243,13 +245,15 @@ sub _process_data {
my ( $self, $html ) = @_;
my @table = ();
my $count = 0;
my ($table, $status);
my ( $table, $status );

my $p = HTML::TokeParser->new( \$html );
while ( my $token = $p->get_tag('td') ) {

my $p = HTML::TokeParser->new(\$html);
while (my $token = $p->get_tag('td')) {
#print Dumper $token;
print $p->get_text."\n";;
print $p->get_text . "\n";
}

#if ($html =~ /Current\s+status:\s+([a-z]+)<\/div>(<table.+)/xms) {
# ($status, $table) = ($1, $2);
#} else {
Expand Down
54 changes: 28 additions & 26 deletions t/RemoteDB/SeqVersion.t
Expand Up @@ -4,40 +4,42 @@
use strict;

BEGIN {
use lib '.';
use Bio::Root::Test;
use lib '.';
use Bio::Root::Test;

test_begin(#-tests => 10,
-requires_module => 'LWP::UserAgent');
test_begin( #-tests => 10,
-requires_module => 'LWP::UserAgent'
);

use_ok('Bio::DB::SeqVersion');
use_ok('Bio::DB::SeqVersion');
}

my $DEBUG = $ENV{BIOPERLDEBUG} || 0;

ok my $query = Bio::DB::SeqVersion->new(-type => 'gi');
ok my $query = Bio::DB::SeqVersion->new( -type => 'gi' );

SKIP: {
test_skip(-tests => 8, -requires_networking => 1);

throws_ok { $query->get_history('DODGY_ID_WHICH_SHOULD_FAIL') } qr/ID likely does not exist/i, 'throw on bad ID';

#my $latest_gi = $query->get_recent(2);
#is($latest_gi, 2, 'get_recent');
#
#my @all_gis = $query->get_all(2);
#cmp_ok(@all_gis, '>=', 8, 'get_all');

#my $latest_gi = $query->get_recent('A00002');
#is($latest_gi, 2, 'get_recent, string');
#
#$latest_gi = $query->get_recent(27478738);
#is($latest_gi, 42659163, 'get_recent, integer');
#
## check that default type is "gi"
#ok $query = Bio::DB::SeqVersion->new();
#ok my $ref = $query->get_history(3245);
#is($ref->[0]->[0], 578167, 'get_history');
test_skip( -tests => 8, -requires_networking => 1 );

throws_ok { $query->get_history('DODGY_ID_WHICH_SHOULD_FAIL') }
qr/ID likely does not exist/i, 'throw on bad ID';

#my $latest_gi = $query->get_recent(2);
#is($latest_gi, 2, 'get_recent');
#
#my @all_gis = $query->get_all(2);
#cmp_ok(@all_gis, '>=', 8, 'get_all');

#my $latest_gi = $query->get_recent('A00002');
#is($latest_gi, 2, 'get_recent, string');
#
#$latest_gi = $query->get_recent(27478738);
#is($latest_gi, 42659163, 'get_recent, integer');
#
## check that default type is "gi"
#ok $query = Bio::DB::SeqVersion->new();
#ok my $ref = $query->get_history(3245);
#is($ref->[0]->[0], 578167, 'get_history');
}

done_testing();

0 comments on commit ded877a

Please sign in to comment.