Front page | perl.perl5.porters |
Postings from May 2001
Re: Relocatable perl
Thread Previous
|
Thread Next
From:
Philip Newton
Date:
May 4, 2001 02:14
Subject:
Re: Relocatable perl
Message ID:
3AF28E9D.1590.DAE808@localhost
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
MY$DISK:[FOO.BAR.BAZ]FILENAME.EXT;5
. 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
m{
^
\\ \\
[\w-]+ # or who knows what characters are allowed
\\
[^\\:\0]+
\\
}x
(or something like that) for UNC-type absolute names.
Cheers,
Philip
--
Philip Newton <pnewton@gmx.de>
I appreciate copies of replies to my messages to Perl5 lists.
Thread Previous
|
Thread Next