Bio-BioVeL

 view release on metacpan or  search on metacpan

lib/Bio/BioVeL/Service.pm  view on Meta::CPAN

=cut

sub get_handle {
	my ( $self, $location ) = @_;
	
	# location is a URL
	if ( $location =~ m#^(?:http|ftp|https)://# ) {
		my $ua = LWP::UserAgent->new;
		my $response = $ua->get($location);
		if ( $response->is_success ) {
			my $content = $response->decoded_content;
			open my $fh, '<', \$content;
			return $fh;
		}
	}
	else {
		open my $fh, '<', $location or die $!;
		return $fh;
	}
}



( run in 0.598 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )