On Monday, September 8, 2003, at 01:11 PM, Orton, Yves wrote:


> I've actually patched the docs to say that it will look at $ENV{PATH}
> or the local equivalent.  I think this is best, because the
> caller code shouldn't have to figure out what string to pass it.

This isnt the point. Its not an uncommon situation to need to split a path like variable in a platform intelligent way.

Consider that perl itself has several such variables. PERLLIB and PERL5LIB.

If you dont provide a way for a user to pass in variables to split then the routine is not generally useful and people will be reinventing this particular wheel (and probably badly) every time they have a path like variable in their config file or whatever.

In my understanding, the only strings that $Config{path_sep} is supposed to split are PATH, PERLLIB, and PERL5LIB. It's not supposed to be used for various generic configuration elements.


In general it's bad form to just tell the user a
To specify the behavior completely you'd also have to tell them quoting and escaping rules.


I'd rather provide APIs to access the data in these variables, than provide methods that the caller would use to do the data manipulations him/herself. I don't want to encourage the use of $Config{path_sep} in user code beyond what it was intended for - much better to use a real serialization technique like Data::Dumper or the like.

I suppose one could always say

my @parts=do {
  local $ENV{PATH}=$the_path_i_need_split;
  File::Spec->path()
};

but personally I think thats ridiculous.

Yes, of course.



> It already looks at $ENV{PATH}, $ENV{Path}, and $ENV{path} for Win32,
> since before I started maintaining the module.

As regarding looking at $ENV{PATH} and $ENV{Path} and $ENV{path} I dont understand this. All three return the same thing. ENV settings on Win32 arent case sensitive.

I don't understand it either, but I'm loath to remove it without understanding it. My guess is that it checks the variants *because* ENV settings on Win32 aren't case-sensitive, and any of those variants (plus 13 others) could be set.


-Ken



Reply via email to