can the script find itself?

can the script find itself?

am 06.04.2008 17:53:35 von fossildoc

I'm running build 813 on 'doze XP/Home. I want my Perl script to
determine the directory from which it was run. This is equivalent to
retrieving the command line. For example, from a DOS window I type:
>\perl\bin\perl c:\mydir\myscript.pl
I want the script to be able to retrieve the string "c:\mydir".

There is a Win32 function, Find, that can look for files, but it only
searches the INC directories, so it is not reliable.

Any ideas, please.

Re: can the script find itself?

am 06.04.2008 17:55:49 von Frank Seitz

fossildoc wrote:
> I'm running build 813 on 'doze XP/Home. I want my Perl script to
> determine the directory from which it was run. This is equivalent to
> retrieving the command line. For example, from a DOS window I type:
>
>>\perl\bin\perl c:\mydir\myscript.pl
>
> I want the script to be able to retrieve the string "c:\mydir".
>
> There is a Win32 function, Find, that can look for files, but it only
> searches the INC directories, so it is not reliable.
>
> Any ideas, please.

perldoc FindBin

Frank
--
Dipl.-Inform. Frank Seitz; http://www.fseitz.de/
Anwendungen für Ihr Internet und Intranet
Tel: 04103/180301; Fax: -02; Industriestr. 31, 22880 Wedel

Re: can the script find itself?

am 06.04.2008 18:24:04 von fossildoc

On Apr 6, 11:55=A0am, Frank Seitz wrote:
>
> perldoc FindBin
>
> Frank
> --

Thanks, Frank. It works fine.

Re: can the script find itself?

am 08.04.2008 04:27:50 von Petr Vileta

fossildoc wrote:
> I'm running build 813 on 'doze XP/Home. I want my Perl script to
> determine the directory from which it was run. This is equivalent to
> retrieving the command line. For example, from a DOS window I type:
>> \perl\bin\perl c:\mydir\myscript.pl
> I want the script to be able to retrieve the string "c:\mydir".
>
> There is a Win32 function, Find, that can look for files, but it only
> searches the INC directories, so it is not reliable.
>
> Any ideas, please.

$0 can't to help you?


--
Petr Vileta, Czech republic
(My server rejects all messages from Yahoo and Hotmail. Send me your
mail from another non-spammer site please.)

Please reply to