Bio-Biblio

 view release on metacpan or  search on metacpan

lib/Bio/DB/Biblio/eutils.pm  view on Meta::CPAN

    my $self = shift;
    my $id = shift;
    my $db = $self->db || 'pubmed';
    $self->throw("must provide valid ID, not undef") unless defined($id);
    my $xml = get($EFETCH.'?rettype=abstract&retmode=xml&db='.$db.'&id='.$id);
    return $xml;
}


sub reset_retrieval {
    shift->cursor(0);
    return 1;
}


sub get_next {
    my $self = shift;

    return unless $self->has_next;

    my $xml = $self->get_by_id( @{ $self->ids }[$self->cursor] );
    $self->cursor( $self->cursor + 1 );

    return $xml;
}


sub get_more {
    my ($self,$more) = @_;

    my @return = ();

lib/Bio/DB/Biblio/eutils.pm  view on Meta::CPAN

        last unless $next;
        push @return, $next;
    }

    return \@return;
}


sub has_next {
    my $self = shift;
    return ($self->cursor < $self->count) ? 1 : undef;
}




sub find {
    my ($self,$query) = @_;

    $query = uri_escape($query);

lib/Bio/DB/Biblio/eutils.pm  view on Meta::CPAN

    my($querykey_element) = $self->twig->get_xpath('//QueryKey');
    if (defined $querykey_element) {
        $self->query_key($querykey_element->text());
    }

    my($webenv_element) = $self->twig->get_xpath('//WebEnv');
    if (defined $webenv_element) {
        $self->collection_id($webenv_element->text());
    }

    #initialize/reset cursor
    $self->cursor(0);

    return $self;
}



sub get_all_ids {
    my $self = shift;
    return $self->ids() if $self->ids();
    return ();

lib/Bio/DB/Biblio/eutils.pm  view on Meta::CPAN

sub get_all_values {
    return;
}


sub get_all_entries {
    return;
}


sub cursor {
    my $self = shift;
    my $arg  = shift;

    return $self->{'cursor'} = $arg if defined($arg);
    return $self->{'cursor'};
}


sub twig {
    my $self = shift;

    return $self->{'twig'} = shift if @_;
    return $self->{'twig'};
}

lib/Bio/DB/Biblio/eutils.pm  view on Meta::CPAN

  Title   : get_collection_id
  Usage   : $id = $biblio->get_collection_id();
  Function: returns WebEnv value from ESearch
  Returns : ESearch WebEnv value as a string
  Args    : none

=head2 reset_retrieval

  Title   : reset_retrieval
  Usage   : $biblio->reset_retrieval();
  Function: reset cursor in id list, see cursor()
  Returns : 1
  Args    : none

=head2 get_next

  Title   : get_next
  Usage   : $xml = $biblio->get_next();
  Function: return next record as xml
  Returns : an xml string
  Args    : none

lib/Bio/DB/Biblio/eutils.pm  view on Meta::CPAN

  Args    : none

=head2 contains

  Title   : contains
  Usage   : do not use
  Function: no-op.  this is here only for interface compatibility
  Returns : undef
  Args    : none

=head2 cursor

  Title   : cursor
  Usage   : $obj->cursor($newval)
  Function: holds position in reference collection
  Returns : value of cursor (a scalar)
  Args    : on set, new value (a scalar or undef, optional)

=head2 twig

  Title   : twig
  Usage   : $obj->twig($newval)
  Function: holds an XML::Twig instance.
  Returns : value of twig (a scalar)
  Args    : on set, new value (a scalar or undef, optional)



( run in 0.277 second using v1.01-cache-2.11-cpan-4d50c553e7e )