develooper Front page | perl.perl5.porters | Postings from May 2001

Re: Relocatable perl

Thread Previous | Thread Next
Philip Newton
May 4, 2001 02:14
Re: Relocatable perl
Message ID:
On 3 May 2001, at 10:44, Steve Fink wrote:

> In my own code, I check at runtime for the existence of /proc/self/exe 
> and fall back to $ENV{PATH} chasing and other gunk. The whole thing 
> looks like:
> 1. if /proc/self/exe exists, use it and return;
> 2. if argv[0] starts with /, use it and return;
> 3. if argv[0] contains any /'s then getcwd and glue them together
> 4. else chase getenv(PATH).

Shouldn't that also check for other character besides '/', for example 
'\' or ':'?

On a tangential note, I had a look in File::Spec to see whether it had 
a function that returned the pathname separator. I didn't find one, 
but I suppose that makes sense in a way -- as far as I know, a full 
path on VMS can look something like


. Now is ':', '[', '.', or ']' the pathname separator? So the function 
couldn't return anything unique.

And on MS-DOS, both /^\\/ and /^[a-zA-Z]:\\/ can begin an 
"absolute" path, depending on what you mean with "absolute". (In a 
way, the first regex matches a path relative to the current drive, 
while only the second is really absolute.) Not to mention

        \\  \\
        [\w-]+    # or who knows what characters are allowed

(or something like that) for UNC-type absolute names.

Philip Newton <>
I appreciate copies of replies to my messages to Perl5 lists.

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About