package HTTPDownload;


#
# download a file from a web server and store it in $file
sub download {
    my( $url, $file ) = @_;

    my $success = 0;
    eval {
	require HTTP::Request;
	require LWP::UserAgent;
	my $request = new HTTP::Request( GET => $url );
	my $agent = new LWP::UserAgent;
	$agent->env_proxy();
	my $response = $agent->request( $request, $file );
	$success = $response->is_success();
    };
    return(1) if( $success );
    if( $@ ) {
        print STDERR "loading modules directly from the Big Sister module site requires Perl module LWP::UserAgent be installed\n";
    }
	# currently this will not work if LWP::UserAgent is not installed
    return 0;
}

1;
