thanks, its works, But when I have created exe of perl file then it is
giving error..

*My path.pl code is :.*

#!/usr/bin/perl -w
use strict;
use CGI;
my $cgi           = CGI->new;
$cgi->header;
print $cgi->header;
my $output='';
use CGI::Carp qw(warningsToBrowser fatalsToBrowser); # uncommenting this
during debugging phase may be helpful
use FindBin;

print <<"END_HTML";
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Absolute Path Sample Script Showing How To Get Absolute Path In PERL
And JavaVersion</TITLE>
</HEAD>
<BODY>
<strong>Sample Script Showing Absolute Path </strong>
<h3>The Absolute Path is: <span style="color: #0066FF;"> $FindBin::Bin
</span></h3>

</BODY>
</HTML>
END_HTML
my $osname=$^O;
if($osname eq "linux")
{
$output=`./version.sh`;
}
else
{
my $jrepath="$FindBin::Bin/"."jre6/bin/java.exe";
if(-e "$jrepath")
{
 $output = `$jrepath -version`;
}
else
{
 print "JRE6 not found at ". $FindBin::Bin ;
       }
}

exit(0);

this works with  "http://localhost/mydemos/examples/testscript/path.pl"; and
when I have created exe uisng PDK then its shows error

so please suggest me :

Software error:

Cannot find current script
'\\?\c:\inetpub\wwwroot\mydemos\examples\testscript\path.exe' at
/PerlApp/FindBin.pm line 201
BEGIN failed--compilation aborted at /PerlApp/FindBin.pm line 201.
BEGIN failed--compilation aborted at path.pl line 9.

For help, please send mail to this site's webmaster, giving this error
message and the time and date of the error.


On 5/31/07, Kenneth Ölwing <[EMAIL PROTECTED]> wrote:


> why its showing "c:/inetpub/wwwroot" instead of
> "c:/inetpub/wwwroot/mytestscripts/perl"
>
> is anything wrong ?
>
> Please suggest me asap..
There is nothing wrong as far as I can see.

There is nothing that says that your web server has to change to the
directory your script is in before executing it - I'm not skilled in
doing CGI etc, but it's not unlikely that you'll find the webserver to
consistently *always* kick off scripts with the wwwroot as the cwd;
indeed, I wouldn't be surprised to find that fact documented as part of
the interface/environment a script can expect. Perhaps you wish to force
your cwd to the script dir? Then one way is to use FindBin and cd to the
script dir that it will provide for you.

As an aside I see no reason to do abs_path on the return from getcwd -
it already is in abs format. Basically you could replace a call to cwd
with a call to abs_path('.') - this would perhaps better illustrate what
abs_path does.

HTH,

ken1

_______________________________________________
ActivePerl mailing list
ActivePerl@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to