Quoth cr...@animalhead.com:
> Hi module authors,
> 
> I'm working on a module that has an accompanying script that can
> be scheduled (cron'ed on Unix/Linux) to update its database from
> the internet.  The biggest problem with this, that is not covered by  
> LWP,
> is that of proxies.
> 
> I know how to access environment variables plus the CPAN config to
> automatically take care of many systems that include a proxy.
> Nevertheless if none of these contain anything, I feel that I have to
> include a query during Build.PL execution, to ask if there's a proxy.
> (Of course there will be a default "n" to take care of smoke-testing.)
> 
> If the query (which is only asked if the environment/CPAN variables
> don't identify a proxy) comes back "y", I know how to run a WPAD
> protocol, and if that doesn't yield anything, how to search on Windows
> for *.pac.
> 
> Q1: where should one search for *.pac on non-Windows systems?

You don't, you just look at the *_PROXY env vars.

More specifically, you mean 'non-IE browsers', since this is a
browser-specific setting. Firefox apparently keeps the setting in its
'network.proxy.autoconfig_url' setting, so you could try grovelling
around in ~/.mozilla for files called 'prefs.js' and looking through
those (and no doubt Safari's settings are similarly (in)accessible), but
you've no guarantee that any particular URL you find is the one the user
wanted you to use.

> But my main problem is when a wpad or pac search succeeds.  Now I
> have a Javascript file that can tell my script what proxy should be
> used for a URL that it wants to access.  The only viable module that
> I've been able to find on CPAN to help with this is called  
> HTTP::ProxyPAC.
> 
> HTTP::ProxyPAC has JavaScript as a prerequisite.  The JavaScript
> bindings expect that the user must have 'libjs' from Mozilla installed
> (by hand) before it will install.  And if jslib is present, the  
> JavaScript
> installer asks 3 scary questions about how it was installed, to which
> only a true wizard would know the answers.

So fix it :). This is far from trivial. One way would be to write a
module Alien::LibJS, which bundles the libjs source and installs the
library somewhere it can find it later. Then you have to persuade the
author of JavaScript.pm that they should be depending on your
Alien::LibJS.

> I would like to use ProxyPAC and JavaScript but don't want to subject
> my installers to such pain.  I can put the .tar.gz of libjs from Mozilla
> inside my module, and drive the installation from Build.PL if it is  
> needed.
> (Running a proxy.pac or wpad.dat file hardly needs the latest version!)
> 
> Q2: can libjs can be installed by Build.PL before the CPAN code
> prepends HTTP::ProxyPAC and then JavaScript and tries to
> install them (based on META.yml) before it ever runs my Build.PL?

Build-time and run-time dependencies are only installed *after* Build.PL
runs, so in principle you could do that. An Alien module that either
JavaScript or (in a pinch) your own module depends on is a better
solution.

Ben

Reply via email to