Ask a Question related to PERL Miscellaneous, Design and Development.
-
Jochen Friedmann #1
current path
Hello together,
how can I find the current path my Perlscript is started ?
Jochen
Jochen Friedmann Guest
-
Finding the current path
Octavian Rasnita wrote: Use the standard Cwd module. -
#25444 [Bgs->Opn]: php4isapi.dll path to win.ini doesn't load from current path.
ID: 25444 User updated by: ict at primus dot ca Reported By: ict at primus dot ca -Status: Bogus +Status: ... -
#25444 [Opn->Bgs]: php4isapi.dll path to win.ini doesn't load from current path.
ID: 25444 Updated by: sniper@php.net Reported By: ict at primus dot ca -Status: Open +Status: Bogus... -
#25444 [NEW]: php4isapi.dll path to win.ini doesn't load from current path.
From: ict at primus dot ca Operating system: W2K PHP version: 4.3.3 PHP Bug Type: *Configuration Issues Bug description: ... -
[PHP] get current path
Hi, The PHP site seems to be down right now ... so here's the question: Is it possible for PHP to tell me the current path of a page? For... -
Andreas Kahari #2
Re: current path
In article <bk9jel$nic$1@ns2.fe.internet.bosch.com>, Jochen Friedmann wrote:
See the documentation for the FindBin module.> how can I find the current path my Perlscript is started ?
--
Andreas Kähäri
Andreas Kahari Guest
-
Thens #3
Re: current path
"Jochen Friedmann" <jochen.friedmann2@de.bosch.com> wrote:
# how can I find the current path my Perlscript is started ?
I dont know what you meant by the current path.
If it is the current directory, you can get the current working
directory like this
use Cwd;
my $dir = cwd();
You can get the full path to the script name from the variable $0 and
then if you do a basename on it you can get the path to the directory
where the script is present.
example :
script : /home/abc/scripts.pl
#!/usr/bin/perl
use strict;
use warnings;
use File::Basename;
my $dir = File::basename($0);
--
Thens.
Thens Guest
-
Paanwa #4
Re: current path
"Jochen Friedmann" <jochen.friedmann2@de.bosch.com> wrote in message
news:bk9jel$nic$1@ns2.fe.internet.bosch.com...You can also get this information from Environment Variables....check out> Hello together,
>
> how can I find the current path my Perlscript is started ?
>
> Jochen
>
>
[url]http://www.devdaily.com/perl/edu/articles/pl020001.shtml[/url]
PAW
Paanwa Guest
-
Tad McClellan #5
Re: current path
Paanwa <paanwa@hotmail.com> wrote:
> "Jochen Friedmann" <jochen.friedmann2@de.bosch.com> wrote in message
> news:bk9jel$nic$1@ns2.fe.internet.bosch.com...>> how can I find the current path my Perlscript is started ?> You can also get this information from Environment Variables....check out
> [url]http://www.devdaily.com/perl/edu/articles/pl020001.shtml[/url]
Perl is not CGI.
The OP made no mention of what environment his Perl program runs in...
--
Tad McClellan SGML consulting
[email]tadmc@augustmail.com[/email] Perl programming
Fort Worth, Texas
Tad McClellan Guest
-
Jürgen Exner #6
Re: current path
Jochen Friedmann wrote:
Please define "current path".> how can I find the current path my Perlscript is started ?
If you are talking about the current working directory, then please have a
look at Cwd::cwd.
If you are talking about the location of the Perl script in your filesystem,
then please check $FindBin::Bin.
Or $0.
Either of them may or may not work for your specific requirements.
jue
Jürgen Exner Guest
-
Richard S Beckett #7
Re: current path
> how can I find the current path my Perlscript is started ?
use Cwd;
my $pwd = cwd; $pwd =~ s!/!\\!g;
print "Current path is $pwd\n";
--
R.
GPLRank +79.699
Richard S Beckett Guest
-
Paanwa #8
Re: current path
Hi Tad,> Perl is not CGI.
>
> The OP made no mention of what environment his Perl program runs in...
Thanks for pointing this out. I've not yet seen an environment with ENV
can't return the script path - there are always exceptions. Can anyone tell
me if there are performance consideration in using ENV vs Cwd?
PAW
Paanwa Guest
-
Tad McClellan #9
Re: current path
Paanwa <paanwa@hotmail.com> wrote:
>>>> Perl is not CGI.
>>
>> The OP made no mention of what environment his Perl program runs in...
> Hi Tad,
>
> Thanks for pointing this out.
Is your Perl programming running in the CGI environment or is it not?
> I've not yet seen an environment with ENV
> can't return the script path -
I have no idea what you are talking about.
We have asked you before to clarify what you meant by "script path",
please try and do that.
I can't tell if you want the current working directory, or the
location of your program file in the filesystem, or the URL for
some CGI program.
Which one is it that you are trying to find?
There are potentially lots and lots of environment variables,
which one is it that you are talking about? I assumed it
was $ENV{PWD}...
> there are always exceptions. Can anyone tell
> me if there are performance consideration in using ENV vs Cwd?
Now I am even more confused about what it is that you are asking.
If you are asking about the "current working directory", then why
do you keep mentioning the location of the program file?
Where your program file exists in the filesystem is not related
to what your current working directory is.
We must understand what you are asking for before we can help
you find it.
Try again explaining what it is that you are asking for.
--
Tad McClellan SGML consulting
[email]tadmc@augustmail.com[/email] Perl programming
Fort Worth, Texas
Tad McClellan Guest



Reply With Quote

