PerlApp needs to do some magic behind the scenes to keep FindBin working, so 
modifying $0 doesn’t have any effect.

 

Please add the following BEGIN block to the top of your script to work around 
this issue.

 

BEGIN {

    return unless defined &PerlApp::exe;

    my $exe = PerlApp::exe();

    $exe =~ s#^\\\\\?\\##;

    no warnings "redefine";

    *PerlApp::exe = sub { $exe };

}

 

I’ll fix PerlApp for PDK 7.1 to automatically strip the \\?\ prefix from $0 and 
PerlApp::exe() to make this workaround unnecessary.

 

Cheers,

-Jan

 

PS: Please send PerlApp and other PDK related questions/problems to the PDK 
mailing list (once it becomes clear that it is a PDK
related issue and not a general Perl problem).

 

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Mothi Mehta
Sent: June 5, 2007 2:51 AM
To: Kenneth Ölwing
Cc: [email protected]
Subject: Re: Absoulte path in Perl

 

and When I have tried on other machine, that havn't perl installed, this shows

 


CGI Error


The specified CGI application misbehaved by not returning a complete set of 
HTTP headers. The headers it did return are: 

Cannot find current script '\\?\c:\inetpub\wwwroot\lmtest\foo.exe' at 
/PerlApp/FindBin.pm line 201
BEGIN failed--compilation aborted at /PerlApp/FindBin.pm line 201.
BEGIN failed--compilation aborted at foo.pl line 7.



 

On 6/5/07, Mothi Mehta <[EMAIL PROTECTED]> wrote: 

Hi, 

 

I have tried that :

 

#!perl --

use strict;
use warnings;
use CGI;
BEGIN { $0 =~ s#^\\\\\?\\## };
use FindBin;
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);

my $cgi = CGI->new;
print $cgi->header;
my $jver = 'unknown or jre6 not found';

my $spath = "$ENV{SystemRoot}\\SYSTEM32";
$ENV{PATH} .= ";$spath";

my $osname = lc $^O;
if ($osname eq 'linux') {
       $jver = `./version.sh`;
} 
else 
{
       my $jrepath = "$FindBin::Bin/jre6/bin/java.exe";

       if (-e $jrepath)
       {
               $jver = `$jrepath -version 2>&1`;
       } 
}

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>

<h3>The Absolute Path to this script is: <span style="color: 
#0066FF;">$FindBin::Bin</span></h3>
<h3>The script I'm executing is: <span style="color: #0066FF;">$0</span></h3> 
<h3>The output of 'java -version' is: </h3>
<span style="color: #0066FF;">
<PRE>
$jver
</PRE>
</span>
<h3>The Perl binary I'm executing is at: <span style="color: 
#0066FF;">$^X</span></h3> 

</BODY>
</HTML>
END_HTML

exit;

 

it works while running with 
http://localhost/mydemos/examples/perlscript/foo.pl' 

 but when I have created exe and tried the same 
http://localhost/mydemos/examples/perlscript/foo.exe then its show CGI error

 

 



 

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





I have tried the same , but after creating exe using pdk its shows 

 


CGI Error


The specified CGI application misbehaved by not returning a complete set of 
HTTP headers

Umm, what exactly do you mean to have tried??? Again, I'm not skilled in CGI, 
but this seems unrelated to the FindBin problem? My
suggested workaround, e.g. the BEGIN is just a snippet of course, insert it 
into your original code. Perhaps I misunderstand you
completely...

ken1
 

 

 

_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to