Re: absolute path of current process



On Thu, May 26, 2005 at 05:48:41AM -0500, Peter Rabbitson wrote:

> On Thu, May 26, 2005 at 05:38:50AM -0500, Peter Rabbitson wrote:
> > Is this:
> >
> > my $path = [File::Spec->splitpath (File::Spec->rel2abs ($0))]->[1];
> >
> > the only OS independent (unix/win32) way to determine the absolute path of
> > the directory which contains the current process, or there is a less cryptic
> > way that I am overlooking?
> >
>
> My bad, to work on win32 it becomes even more cryptic:
>
> my $path = join ('',@{[File::Spec->splitpath (File::Spec->rel2abs ($0))]}[0,1]);

perldoc FindBin

--
Paul Johnson - paul@xxxxxxxx
http://www.pjcj.net
.



Relevant Pages

  • absolute path of current process
    ... the only OS independent (unix/win32) way to determine the absolute path of ... Peter ... Prev by Date: ...
    (perl.beginners)
  • Re: absolute path of current process
    ... > the only OS independent (unix/win32) way to determine the absolute path of ... to work on win32 it becomes even more cryptic: ... Prev by Date: ...
    (perl.beginners)
  • Re: absolute path of current process
    ... > the only OS independent (unix/win32) way to determine the absolute path of ... use Cwd qw; ... Prev by Date: ...
    (perl.beginners)
  • Re: absolute path of current process
    ... >> the only OS independent (unix/win32) way to determine the absolute path of ... > use Cwd qw; ... absolute path, with relative path, from cron, etc.). ...
    (perl.beginners)
  • String code required please
    ... Does someone have the Python code to pull just the filename and ... extension from the end of an absolute path please. ... Prev by Date: ...
    (comp.lang.python)