[Bioperl-l] BioPerl behind WebMarshall firewall

Holland, Richard Richard.Holland at agresearch.co.nz
Thu Jul 24 10:16:46 EDT 2003


Hi,

I thought the following snippet of code might be of use to anyone trying
to use BioPerl modules behind an authenticating proxy/firewall such as
WebMarshall. I couldn't find an example anywhere so thought I'd write my
own. It works with all BioPerl objects (well at least the ones I have
tried so far), not just Bio::DB::GenBank. You only need to call it once,
after instantiation of the object, after which it remembers your
details. If you create another instance of the object, you'll have to do
this again. 

Please let me know if I've missed something obvious and there is in fact
a much easier way of doing this!

Usage:

####begin code

	my $bio_perl_object = new Bio::DB::GenBank;	# instantiate
the object
	configureProxy($bio_perl_object);		# configure it
for proxy access
	...						# do something
with it, it should work fine!
	

####end code

The configureProxy subroutine looks like this:

####begin code

use strict;
sub configureProxy {
	my $bio_perl_object = shift;			# Get the
BioPerl object as first parameter

	my $proxy = "firewall.agresearch.co.nz";		#
address of your firewall/proxy
	my $port = 8080;				# port number on
your proxy
	#my $username = "joebloggs";			# username (for
proxies not using Windows authentication)
	my $username = "AGRESEARCH\\joebloggs";	# username (for proxies
requiring a Windows domain to authenticate you)
	my $password = "mypassword";			# your proxy
password
	my $domain = "agresearch.co.nz";		# requests in
this domain bypass the proxy

	my $ua = $bio_perl_object->ua();			# get
hold of the BioPerl instance's LWP::UserAgent component
	$ua->no_proxy("localhost",$domain);		# set the proxy
bypass for the local domain
	
$ua->proxy(['http','ftp','https'],"http://$username:$password\@$proxy:$p
ort");	# set proxy authentication
}

#### end code

cheers,
Richard
----
Richard Holland
Bioinformatics Database Developer
ITS, Agresearch Invermay x3279



=======================================================================
Attention: The information contained in this message and/or attachments
from AgResearch Limited is intended only for the persons or entities
to which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by persons or
entities other than the intended recipients is prohibited by AgResearch
Limited. If you have received this message in error, please notify the
sender immediately.
=======================================================================


More information about the Bioperl-l mailing list