Absoulte path in Perl

--===============1362664856==
Content-Type: multipart/alternative;
boundary="----=_Part_7554_13669829.1180593407015"

------=_Part_7554_13669829.1180593407015
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hello everyone,

I am getting problems in Perl to get Absolute path,

My Directory structure is :

c:\Inetpub\wwwroot\mytestscripts\perl\path.pl

scripts details:

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


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
</TITLE>
</HEAD>
<BODY>
<strong>Sample Script Showing Absolute Path </strong>
<h3>The Absolute Path is: $abs_path </h3>

</BODY>
</HTML>
END_HTML




But when I run this its shows :

Sample Script Showing Absolute Path
The Absolute Path is: c:/inetpub/wwwroot

why its showing "c:/inetpub/wwwroot" instead of
"c:/inetpub/wwwroot/mytestscripts/perl"

is anything wrong ?

Please suggest me asap..

Thanks in advance..
Mohit Mehta

------=_Part_7554_13669829.1180593407015
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hello everyone,
<br>
<br>I am getting problems in Perl to get Absolute path,
<br>
<br>My Directory structure is :  
<br>
<br>c:\Inetpub\wwwroot\mytestscripts\perl\path.pl
<br>
<br>scripts details:
<br>
<br>#!/usr/bin/perl -w
<br>use strict;
<br>use CGI;
<br>use Cwd 'abs_path';
<br>use Cwd;
<br>my $cgi           = CGI->new;
<br>$cgi->header;
<br>print $cgi->header;
<br>my $file = getcwd;
<br>my $abs_path = abs_path($file);
<br>my $output='';
<br>use CGI::Carp qw(warningsToBrowser fatalsToBrowser); # uncommenting this during debugging phase may be helpful
<br>
<br> 
<br>print <<"END_HTML";
<br><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<br><HTML>
<br><HEAD>
<br><TITLE>Absolute Path Sample Script Showing How To Get Absolute Path In PERL </TITLE>
<br></HEAD>
<br><BODY>
<br><strong>Sample Script Showing Absolute Path </strong>
<br><h3>The Absolute Path is: <span style="color: rgb(0, 102, 255);"> $abs_path </span></h3>
<br>
<br></BODY>
<br></HTML>
<br>END_HTML
<br>
<br>
<br>
<br>
<br>But when I run this its shows :
<br>
<br>Sample Script Showing Absolute Path
<br>The Absolute Path is: c:/inetpub/wwwroot
<br>
<br>why its showing "c:/inetpub/wwwroot" instead of "c:/inetpub/wwwroot/mytestscripts/perl"
<br>
<br>is anything wrong ?
<br>
<br>Please suggest me asap..
<br>
<br>Thanks in advance..
<br>Mohit Mehta

------=_Part_7554_13669829.1180593407015--

--===============1362664856==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============1362664856==--
Mothi Mehta [ Do, 31 Mai 2007 08:36 ] [ ID #1727470 ]

Re: Absoulte path in Perl

> 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 [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
ken1 [ Do, 31 Mai 2007 09:21 ] [ ID #1727471 ]

RE: Absoulte path in Perl

This is a multi-part message in MIME format.

--===============0487222854==
Content-class: urn:content-classes:message
Content-Type: multipart/alternative;
boundary="----_=_NextPart_001_01C7A387.AFE2AB54"

This is a multi-part message in MIME format.

------_=_NextPart_001_01C7A387.AFE2AB54
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

what do you get when you print out the result of 'getcwd'? does that
give you what you expect?

________________________________

From: activeperl-bounces [at] listserv.ActiveState.com
[mailto:activeperl-bounces [at] listserv.ActiveState.com] On Behalf Of Mothi
Mehta
Sent: Thursday, May 31, 2007 1:37 AM
To: activeperl [at] listserv.ActiveState.com
Subject: Absoulte path in Perl


Hello everyone,

I am getting problems in Perl to get Absolute path,

My Directory structure is :

c:\Inetpub\wwwroot\mytestscripts\perl\path.pl

scripts details:

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


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 </TITLE>
</HEAD>
<BODY>
<strong>Sample Script Showing Absolute Path </strong>
<h3>The Absolute Path is: $abs_path </h3>

</BODY>
</HTML>
END_HTML




But when I run this its shows :

Sample Script Showing Absolute Path
The Absolute Path is: c:/inetpub/wwwroot

why its showing "c:/inetpub/wwwroot" instead of
"c:/inetpub/wwwroot/mytestscripts/perl"

is anything wrong ?

Please suggest me asap..

Thanks in advance..
Mohit Mehta

------_=_NextPart_001_01C7A387.AFE2AB54
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii">
<META content=3D"MSHTML 6.00.2900.3086" name=3DGENERATOR></HEAD>
<BODY>
<DIV dir=3Dltr align=3Dleft><SPAN class=3D211252813-31052007><FONT =
face=3D"Courier New"
color=3D#0000ff>what do you get when you print out the result of =
'getcwd'? 
does that give you what you expect?</FONT></SPAN></DIV><BR>
<DIV class=3DOutlookMessageHeader lang=3Den-us dir=3Dltr align=3Dleft>
<HR tabIndex=3D-1>
<FONT face=3DTahoma size=3D2><B>From:</B>
activeperl-bounces [at] listserv.ActiveState.com
[mailto:activeperl-bounces [at] listserv.ActiveState.com] <B>On Behalf Of =
</B>Mothi
Mehta<BR><B>Sent:</B> Thursday, May 31, 2007 1:37 AM<BR><B>To:</B>
activeperl [at] listserv.ActiveState.com<BR><B>Subject:</B> Absoulte path in
Perl<BR></FONT><BR></DIV>
<DIV></DIV>Hello everyone, <BR><BR>I am getting problems in Perl to get =
Absolute
path, <BR><BR>My Directory structure is :  
<BR><BR>c:\Inetpub\wwwroot\mytestscripts\perl\path.pl <BR><BR>scripts =
details:
<BR><BR>#!/usr/bin/perl -w <BR>use strict; <BR>use CGI; <BR>use Cwd =
'abs_path';
<BR>use Cwd; <BR>my $cgi           =3D =
CGI->new;
<BR>$cgi->header; <BR>print $cgi->header; <BR>my $file =3D getcwd; =
<BR>my
$abs_path =3D abs_path($file); <BR>my $output=3D''; <BR>use CGI::Carp
qw(warningsToBrowser fatalsToBrowser); # uncommenting this during =
debugging
phase may be helpful <BR><BR>  <BR>print <<"END_HTML";
<BR><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 =
Transitional//EN">
<BR><HTML> <BR><HEAD> <BR><TITLE>Absolute Path Sample =
Script
Showing How To Get Absolute Path In PERL </TITLE> =
<BR></HEAD>
<BR><BODY> <BR><strong>Sample Script Showing Absolute Path
</strong> <BR><h3>The Absolute Path is: <SPAN
style=3D"COLOR: rgb(0,102,255)"> $abs_path </SPAN></h3>
<BR><BR></BODY> <BR></HTML> <BR>END_HTML =
<BR><BR><BR><BR><BR>But
when I run this its shows : <BR><BR>Sample Script Showing Absolute Path =
<BR>The
Absolute Path is: c:/inetpub/wwwroot <BR><BR>why its showing
"c:/inetpub/wwwroot" instead of "c:/inetpub/wwwroot/mytestscripts/perl"
<BR><BR>is anything wrong ? <BR><BR>Please suggest me asap.. =
<BR><BR>Thanks in
advance.. <BR>Mohit Mehta </BODY></HTML>

------_=_NextPart_001_01C7A387.AFE2AB54--

--===============0487222854==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============0487222854==--
matt.pettis [ Do, 31 Mai 2007 15:29 ] [ ID #1727472 ]

Re: Absoulte path in Perl

--===============2138195819==
Content-Type: multipart/alternative;
boundary="----=_Part_891_19584802.1180963889710"

------=_Part_891_19584802.1180963889710
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Thanks


On 5/31/07, Kenneth =D6lwing <kenneth [at] olwing.se> 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
>

------=_Part_891_19584802.1180963889710
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Thanks<br><br><br><div><span class=3D"gmail_quote">On 5/31/07, <b class=3D"=
gmail_sendername">Kenneth =D6lwing</b> <<a href=3D"mailto:kenneth [at] olwing=
..se">kenneth [at] olwing.se</a>> wrote:</span><blockquote class=3D"gmail_quot=
e" style=3D"border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt =
0.8ex; padding-left: 1ex;">
<br>> why its showing "c:/inetpub/wwwroot" instead of<br>> =
"c:/inetpub/wwwroot/mytestscripts/perl"<br>><br>> is anythi=
ng wrong ?<br>><br>> Please suggest me asap..<br>There is nothing wro=
ng as far as I can see.
<br><br>There is nothing that says that your web server has to change to th=
e<br>directory your script is in before executing it - I'm not skilled =
in<br>doing CGI etc, but it's not unlikely that you'll find the web=
server to
<br>consistently *always* kick off scripts with the wwwroot as the cwd;<br>=
indeed, I wouldn't be surprised to find that fact documented as part of=
<br>the interface/environment a script can expect. Perhaps you wish to forc=
e
<br>your cwd to the script dir? Then one way is to use FindBin and cd to th=
e<br>script dir that it will provide for you.<br><br>As an aside I see no r=
eason to do abs_path on the return from getcwd -<br>it already is in abs fo=
rmat. Basically you could replace a call to cwd
<br>with a call to abs_path('.') - this would perhaps better illust=
rate what<br>abs_path does.<br><br>HTH,<br><br>ken1<br></blockquote></div><=
br>

------=_Part_891_19584802.1180963889710--

--===============2138195819==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============2138195819==--
Mothi Mehta [ Mo, 04 Juni 2007 15:31 ] [ ID #1730013 ]

Re: Absoulte path in Perl

--===============1624568677==
Content-Type: multipart/alternative;
boundary="----=_Part_6235_20360283.1181024427600"

------=_Part_6235_20360283.1181024427600
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

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 =3D CGI->new;
$cgi->header;
print $cgi->header;
my $output=3D'';
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=3D"color: #0066FF;"> $FindBin::Bin
</span></h3>

</BODY>
</HTML>
END_HTML
my $osname=3D$^O;
if($osname eq "linux")
{
$output=3D`./version.sh`;
}
else
{
my $jrepath=3D"$FindBin::Bin/"."jre6/bin/java.exe";
if(-e "$jrepath")
{
$output =3D `$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 =D6lwing <kenneth [at] olwing.se> 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
>

------=_Part_6235_20360283.1181024427600
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

<div>thanks, its works, But when I have created exe of perl file then it is=
giving error.. </div>
<div> </div>
<div><strong>My path.pl code is :.</strong></div>
<p>#!/usr/bin/perl -w<br>use strict;<br>use CGI;<br>my $cgi  &nbs=
p;        =3D CGI->new;<br>$cgi->h=
eader;<br>print $cgi->header;<br>my $output=3D''; <br>use CGI::C=
arp qw(warningsToBrowser fatalsToBrowser); # uncommenting this during debug=
ging phase may be helpful
<br>use FindBin;<br> <br>print <<"END_HTML";<br><!D=
OCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><b=
r><HTML><br><HEAD><br><TITLE>Absolute Path Sample Script =
Showing How To Get Absolute Path In PERL And JavaVersion</TITLE>
<br></HEAD><br><BODY><br><strong>Sample Script Showing Ab=
solute Path </strong><br><h3>The Absolute Path is: <span sty=
le=3D"color: #0066FF;"> $FindBin::Bin </span></h3>
</p>
<p></BODY><br></HTML> <br>END_HTML<br>my $osname=3D$^O;<br>if($=
osname eq "linux")<br>{<br> $output=3D`./version.sh`;<br>}<b=
r>else<br>{<br> my $jrepath=3D"$FindBin::Bin/"."jre6/bi=
n/java.exe";
<br> if(-e "$jrepath")<br> {<br>  $output =3D=
`$jrepath -version`; <br> }<br> else<br> {<br>  p=
rint "JRE6 not found at ". $FindBin::Bin ; <br>   =
     }<br>}</p>
<p>exit(0);</p>
<div> </div>
<div>this works with  "<a href=3D"http://localhost/mydemos/exampl=
es/testscript/path.pl">http://localhost/mydemos/examples/tes tscript/path.pl=
</a>" and when I have created exe uisng PDK then its shows error</div>
<div> </div>
<div>so please suggest me :</div>
<div> </div>
<div>
<h1>Software error:</h1><pre>Cannot find current script '\\?\c:\inetpub=
\wwwroot\mydemos\examples\testscript\path.exe' at /PerlApp/FindBin.pm l=
ine 201
BEGIN failed--compilation aborted at /PerlApp/FindBin.pm line 201.
BEGIN failed--compilation aborted at path.pl line 9.
</pre>
<p>For help, please send mail to this site's webmaster, giving this err=
or message and the time and date of the error. </p></div>
<div><br> </div>
<div><span class=3D"gmail_quote">On 5/31/07, <b class=3D"gmail_sendername">=
Kenneth =D6lwing</b> <<a href=3D"mailto:kenneth [at] olwing.se">kenneth [at] olwin=
g.se</a>> wrote:</span>
<blockquote class=3D"gmail_quote" style=3D"PADDING-LEFT: 1ex; MARGIN: 0px 0=
px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><br>> why its showing "c=
:/inetpub/wwwroot" instead of<br>> "c:/inetpub/wwwroot/mytests=
cripts/perl"
<br>><br>> is anything wrong ?<br>><br>> Please suggest me asap=
...<br>There is nothing wrong as far as I can see.<br><br>There is nothing t=
hat says that your web server has to change to the<br>directory your script=
is in before executing it - I'm not skilled in
<br>doing CGI etc, but it's not unlikely that you'll find the webse=
rver to<br>consistently *always* kick off scripts with the wwwroot as the c=
wd;<br>indeed, I wouldn't be surprised to find that fact documented as =
part of
<br>the interface/environment a script can expect. Perhaps you wish to forc=
e<br>your cwd to the script dir? Then one way is to use FindBin and cd to t=
he<br>script dir that it will provide for you.<br><br>As an aside I see no =
reason to do abs_path on the return from getcwd -
<br>it already is in abs format. Basically you could replace a call to cwd<=
br>with a call to abs_path('.') - this would perhaps better illustr=
ate what<br>abs_path does.<br><br>HTH,<br><br>ken1<br></blockquote></div>
<br>

------=_Part_6235_20360283.1181024427600--

--===============1624568677==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============1624568677==--
Mothi Mehta [ Di, 05 Juni 2007 08:20 ] [ ID #1730898 ]

Re: Absoulte path in Perl

> 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 some reason IIS (?) is using the unicode form of the path (i.e.
prefixing with \\?) and this causes FindBin to fail. Actually, just
putting the following in c:\tmp\foo.pl:

use FindBin;

and then trying to run with 'perl \\?\c:\tmp\foo.pl' causes the same
error (note that the script *does* run however - giving a path this way
is thus legal).

Tracing it shows that it is a 'file exist' check that fails, and indeed,
trying it specifically shows this. Assuming c:\tmp\foo.pl exists as a file:

perl -e "print -f $ARGV[0]" c:\tmp\foo.pl

will print '1', while

perl -e "print -f $ARGV[0]" \\?\c:\tmp\x.pl

will print '' (i.e. a blank value, indicating false). Still, it's
generally ok to use the \\? form (since the example above, running 'perl
\\?\c:\tmp\foo.pl' nicely runs the script).

Thus, I'd file this as a bug with the '-f' operator...?

For your particular problem - whether you can get IIS to avoid that form
I have no idea. A workaround might be this...

....
BEGIN { $0 =~ s#^\\\\\?\\## };
use FindBin;
....

Ugh...not very nice and I don't know if it might cause problems
elsewhere, or if it'll work when perlapped...

ken1

_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
ken1 [ Di, 05 Juni 2007 10:14 ] [ ID #1730899 ]

Re: Absoulte path in Perl

--===============0679160307==
Content-Type: multipart/alternative;
boundary="----=_Part_6989_32133560.1181034974607"

------=_Part_6989_32133560.1181034974607
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Thanks,
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

--LM


On 6/5/07, Kenneth =D6lwing <kenneth [at] olwing.se> wrote:
>
>
> > 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 some reason IIS (?) is using the unicode form of the path (i.e.
> prefixing with \\?) and this causes FindBin to fail. Actually, just
> putting the following in c:\tmp\foo.pl:
>
> use FindBin;
>
> and then trying to run with 'perl \\?\c:\tmp\foo.pl' causes the same
> error (note that the script *does* run however - giving a path this way
> is thus legal).
>
> Tracing it shows that it is a 'file exist' check that fails, and indeed,
> trying it specifically shows this. Assuming c:\tmp\foo.pl exists as a
> file:
>
> perl -e "print -f $ARGV[0]" c:\tmp\foo.pl
>
> will print '1', while
>
> perl -e "print -f $ARGV[0]" \\?\c:\tmp\x.pl
>
> will print '' (i.e. a blank value, indicating false). Still, it's
> generally ok to use the \\? form (since the example above, running 'perl
> \\?\c:\tmp\foo.pl' nicely runs the script).
>
> Thus, I'd file this as a bug with the '-f' operator...?
>
> For your particular problem - whether you can get IIS to avoid that form
> I have no idea. A workaround might be this...
>
> ...
> BEGIN { $0 =3D~ s#^\\\\\?\\## };
> use FindBin;
> ...
>
> Ugh...not very nice and I don't know if it might cause problems
> elsewhere, or if it'll work when perlapped...
>
> ken1
>
>

------=_Part_6989_32133560.1181034974607
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

<div>Thanks, </div>
<div>I have tried the same , but after creating exe using pdk its shows </d=
iv>
<div> </div>
<h1>CGI Error</h1>
<div>The specified CGI application misbehaved by not returning a complete s=
et of HTTP headers</div>
<div> </div>
<div>--LM<br><br> </div>
<div><span class=3D"gmail_quote">On 6/5/07, <b class=3D"gmail_sendername">K=
enneth =D6lwing</b> <<a href=3D"mailto:kenneth [at] olwing.se">kenneth [at] olwing=
..se</a>> wrote:</span>
<blockquote class=3D"gmail_quote" style=3D"PADDING-LEFT: 1ex; MARGIN: 0px 0=
px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><br>> Cannot find current scr=
ipt '\\?\c:\inetpub\wwwroot\mydemos\examples\testscript\path.exe ' a=
t /PerlApp/FindBin.pm line 201
<br>> BEGIN failed--compilation aborted at /PerlApp/FindBin.pm line 201.=
<br>> BEGIN failed--compilation aborted at path.pl line 9.<br>><br>Fo=
r some reason IIS (?) is using the unicode form of the path (i.e.<br>prefix=
ing with \\?) and this causes FindBin to fail. Actually, just
<br>putting the following in c:\tmp\foo.pl:<br><br>use FindBin;<br><br>and =
then trying to run with 'perl \\?\c:\tmp\foo.pl' causes the same<br=
>error (note that the script *does* run however - giving a path this way
<br>is thus legal).<br><br>Tracing it shows that it is a 'file exist=
9; check that fails, and indeed,<br>trying it specifically shows this. Assu=
ming c:\tmp\foo.pl exists as a file:<br><br>   perl -e "prin=
t -f $ARGV[0]" c:\tmp\foo.pl
<br><br>will print '1', while<br><br>   perl -e "pri=
nt -f $ARGV[0]" \\?\c:\tmp\x.pl<br><br>will print '' (i.e. a b=
lank value, indicating false). Still, it's<br>generally ok to use the \=
\? form (since the example above, running 'perl
<br>\\?\c:\tmp\foo.pl' nicely runs the script).<br><br>Thus, I'd fi=
le this as a bug with the '-f' operator...?<br><br>For your particu=
lar problem - whether you can get IIS to avoid that form<br>I have no idea.=
A workaround might be this...
<br><br>...<br>BEGIN { $0 =3D~ s#^\\\\\?\\## };<br>use FindBin;<br>...<br><=
br>Ugh...not very nice and I don't know if it might cause problems<br>e=
lsewhere, or if it'll work when perlapped...<br><br>ken1<br><br></block=
quote>
</div><br>

------=_Part_6989_32133560.1181034974607--

--===============0679160307==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============0679160307==--
Mothi Mehta [ Di, 05 Juni 2007 11:16 ] [ ID #1730900 ]

Re: Absoulte path in Perl

--===============1354752981==
Content-Type: multipart/alternative;
boundary="----=_Part_6997_12747268.1181035054445"

------=_Part_6997_12747268.1181035054445
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

also I am ship jre6 with my application, so I don't wants to use existing..

On 6/5/07, Mothi Mehta <evergreenudaipur [at] gmail.com> wrote:
>
> Thanks,
> 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
>
> --LM
>
>
> On 6/5/07, Kenneth =D6lwing <kenneth [at] olwing.se> wrote:
> >
> >
> > > 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 some reason IIS (?) is using the unicode form of the path (i.e.
> > prefixing with \\?) and this causes FindBin to fail. Actually, just
> > putting the following in c:\tmp\foo.pl:
> >
> > use FindBin;
> >
> > and then trying to run with 'perl \\?\c:\tmp\foo.pl' causes the same
> > error (note that the script *does* run however - giving a path this way
> > is thus legal).
> >
> > Tracing it shows that it is a 'file exist' check that fails, and indeed=
,
> > trying it specifically shows this. Assuming c:\tmp\foo.pl exists as a
> > file:
> >
> > perl -e "print -f $ARGV[0]" c:\tmp\foo.pl
> >
> > will print '1', while
> >
> > perl -e "print -f $ARGV[0]" \\?\c:\tmp\x.pl
> >
> > will print '' (i.e. a blank value, indicating false). Still, it's
> > generally ok to use the \\? form (since the example above, running 'per=
l
> >
> > \\?\c:\tmp\foo.pl' nicely runs the script).
> >
> > Thus, I'd file this as a bug with the '-f' operator...?
> >
> > For your particular problem - whether you can get IIS to avoid that for=
m
> > I have no idea. A workaround might be this...
> >
> > ...
> > BEGIN { $0 =3D~ s#^\\\\\?\\## };
> > use FindBin;
> > ...
> >
> > Ugh...not very nice and I don't know if it might cause problems
> > elsewhere, or if it'll work when perlapped...
> >
> > ken1
> >
> >
>

------=_Part_6997_12747268.1181035054445
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

also I am ship jre6 with my application, so I don't wants to use existi=
ng..<br><br>
<div><span class=3D"gmail_quote">On 6/5/07, <b class=3D"gmail_sendername">M=
othi Mehta</b> <<a href=3D"mailto:evergreenudaipur [at] gmail.com">evergreenu=
daipur [at] gmail.com</a>> wrote:</span>
<blockquote class=3D"gmail_quote" style=3D"PADDING-LEFT: 1ex; MARGIN: 0px 0=
px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div>Thanks, </div>
<div>I have tried the same , but after creating exe using pdk its shows </d=
iv>
<div> </div>
<h1>CGI Error</h1>
<div>The specified CGI application misbehaved by not returning a complete s=
et of HTTP headers</div>
<div> </div>
<div>--LM<br><br> </div>
<div><span class=3D"e" id=3D"q_112fb2b8c6d01118_1">
<div><span class=3D"gmail_quote">On 6/5/07, <b class=3D"gmail_sendername">K=
enneth =D6lwing</b> <<a onclick=3D"return top.js.OpenExtLink(window,even=
t,this)" href=3D"mailto:kenneth [at] olwing.se" target=3D"_blank">kenneth [at] olwing=
..se</a>
> wrote:</span>
<blockquote class=3D"gmail_quote" style=3D"PADDING-LEFT: 1ex; MARGIN: 0px 0=
px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><br>> Cannot find current scr=
ipt '\\?\c:\inetpub\wwwroot\mydemos\examples\testscript\path.exe ' a=
t /PerlApp/FindBin.pm line 201
<br>> BEGIN failed--compilation aborted at /PerlApp/FindBin.pm line 201.=
<br>> BEGIN failed--compilation aborted at path.pl line 9.<br>><br>Fo=
r some reason IIS (?) is using the unicode form of the path (i.e.<br>prefix=
ing with \\?) and this causes FindBin to fail. Actually, just
<br>putting the following in c:\tmp\foo.pl:<br><br>use FindBin;<br><br>and =
then trying to run with 'perl \\?\c:\tmp\foo.pl' causes the same<br=
>error (note that the script *does* run however - giving a path this way
<br>is thus legal).<br><br>Tracing it shows that it is a 'file exist=
9; check that fails, and indeed,<br>trying it specifically shows this. Assu=
ming c:\tmp\foo.pl exists as a file:<br><br>   perl -e "prin=
t -f $ARGV[0]" c:\tmp\foo.pl
<br><br>will print '1', while<br><br>   perl -e "pri=
nt -f $ARGV[0]" \\?\c:\tmp\x.pl<br><br>will print '' (i.e. a b=
lank value, indicating false). Still, it's<br>generally ok to use the \=
\? form (since the example above, running 'perl
<br>\\?\c:\tmp\foo.pl' nicely runs the script).<br><br>Thus, I'd fi=
le this as a bug with the '-f' operator...?<br><br>For your particu=
lar problem - whether you can get IIS to avoid that form<br>I have no idea.=
A workaround might be this...
<br><br>...<br>BEGIN { $0 =3D~ s#^\\\\\?\\## };<br>use FindBin;<br>...<br><=
br>Ugh...not very nice and I don't know if it might cause problems<br>e=
lsewhere, or if it'll work when perlapped...<br><br>ken1<br><br></block=
quote>
</div><br></span></div></blockquote></div><br>

------=_Part_6997_12747268.1181035054445--

--===============1354752981==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============1354752981==--
Mothi Mehta [ Di, 05 Juni 2007 11:17 ] [ ID #1730901 ]

Re: Absoulte path in Perl

This is a multi-part message in MIME format.
--===============1012080602==
Content-Type: multipart/alternative;
boundary="------------030603090005080200080201"

This is a multi-part message in MIME format.
--------------030603090005080200080201
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit


> 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

--------------030603090005080200080201
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
<blockquote
cite="mid:68ab69220706050216q6fc413e7h1f1434189a403af2 [at] mail. gmail.com"
type="cite">
<div>I have tried the same , but after creating exe using pdk its
shows </div>
<div> </div>
<h1>CGI Error</h1>
<div>The specified CGI application misbehaved by not returning a
complete set of HTTP headers</div>
</blockquote>
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...<br>
<br>
ken1<br>
</body>
</html>

--------------030603090005080200080201--

--===============1012080602==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============1012080602==--
ken1 [ Di, 05 Juni 2007 11:30 ] [ ID #1730902 ]

Re: Absoulte path in Perl

--===============1796209139==
Content-Type: multipart/alternative;
boundary="----=_Part_7175_32039121.1181036920985"

------=_Part_7175_32039121.1181036920985
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Hi,

I have tried that :


#!perl --

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

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

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

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

if (-e $jrepath)
{
$jver =3D `$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=3D"color:
#0066FF;">$FindBin::Bin</span></h3>
<h3>The script I'm executing is: <span style=3D"color:
#0066FF;">$0</span></h3>
<h3>The output of 'java -version' is: </h3>
<span style=3D"color: #0066FF;">
<PRE>
$jver
</PRE>
</span>
<h3>The Perl binary I'm executing is at: <span style=3D"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 erro=
r





On 6/5/07, Kenneth =D6lwing <kenneth [at] olwing.se> 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
>
>

------=_Part_7175_32039121.1181036920985
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

<div>Hi, </div>
<div> </div>
<div>I have tried that :</div>
<div> </div>
<p>#!perl --</p>
<p>use strict;<br>use warnings;<br>use CGI;<br>BEGIN { $0 =3D~ s#^\\\\\?\\#=
# };<br>use FindBin;<br>use CGI::Carp qw(warningsToBrowser fatalsToBrowser)=
;</p>
<p>my $cgi =3D CGI->new;<br>print $cgi->header;<br>my $jver =3D '=
unknown or jre6 not found';</p>
<p>my $spath =3D "$ENV{SystemRoot}\\SYSTEM32";<br>$ENV{PATH} .=3D=
";$spath";</p>
<p>my $osname =3D lc $^O;<br>if ($osname eq 'linux') {<br> &nb=
sp;     $jver =3D `./version.sh`;<br>} <br>else <br>{<b=
r>       my $jrepath =3D "$FindBin::Bin/=
jre6/bin/java.exe";</p>
<p>       if (-e $jrepath)<br>  &nb=
sp;    {<br>        =
       $jver =3D `$jrepath -version 2>&=
;1`;<br>       } <br>}</p>
<p>print <<END_HTML;<br><!DOCTYPE HTML PUBLIC "-//W3C//DTD HT=
ML 4.01 Transitional//EN"><br><HTML><br><HEAD><br><T=
ITLE>Absolute Path Sample Script Showing How To Get Absolute Path In PER=
L And JavaVersion</TITLE>
<br></HEAD><br><BODY></p>
<p><h3>The Absolute Path to this script is: <span style=3D"co=
lor: #0066FF;">$FindBin::Bin</span></h3><br><h3>T=
he script I'm executing is: <span style=3D"color: #0066FF;"=
;>$0</span></h3>
<br><h3>The output of 'java -version' is: </h3><br><=
span style=3D"color: #0066FF;"><br><PRE><br>$jver<br><=
;/PRE><br></span><br><h3>The Perl binary I'm executing i=
s at: <span style=3D"color: #0066FF;">$^X</span></=
h3>
</p>
<p></BODY><br></HTML><br>END_HTML</p>
<p>exit;<br></p>
<p> </p>
<div>it works while running with <a href=3D"http://localhost/mydemos/exampl=
es/perlscript/foo.pl'">http://localhost/mydemos/examples/perlscript/foo=
..pl'</a></div>
<div> but when I have created exe and tried the same <a href=3D"http:/=
/localhost/mydemos/examples/perlscript/foo.exe">http://local host/mydemos/ex=
amples/perlscript/foo.exe</a> then its show CGI error</div>
<div> </div>
<div> </div>
<div><br><br> </div>
<div><span class=3D"gmail_quote">On 6/5/07, <b class=3D"gmail_sendername">K=
enneth =D6lwing</b> <<a href=3D"mailto:kenneth [at] olwing.se">kenneth [at] olwing=
..se</a>> wrote:</span>
<blockquote class=3D"gmail_quote" style=3D"PADDING-LEFT: 1ex; MARGIN: 0px 0=
px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div text=3D"#000000" bgcolor=3D"#ffffff"><br>
<blockquote type=3D"cite"><span class=3D"q">
<div>I have tried the same , but after creating exe using pdk its shows </d=
iv>
<div> </div>
<h1>CGI Error</h1>
<div>The specified CGI application misbehaved by not returning a complete s=
et of HTTP headers</div></span></blockquote>Umm, what exactly do you mean t=
o 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 co=
de. Perhaps I misunderstand you completely...<br><br>ken1<br> </div></=
blockquote></div><br>

------=_Part_7175_32039121.1181036920985--

--===============1796209139==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============1796209139==--
Mothi Mehta [ Di, 05 Juni 2007 11:48 ] [ ID #1730903 ]

Re: Absoulte path in Perl

--===============1170227680==
Content-Type: multipart/alternative;
boundary="----=_Part_7191_27333936.1181037036259"

------=_Part_7191_27333936.1181037036259
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

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

CGI ErrorThe 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 <evergreenudaipur [at] gmail.com> wrote:
>
> Hi,
>
> I have tried that :
>
>
> #!perl --
>
> use strict;
> use warnings;
> use CGI;
> BEGIN { $0 =3D~ s#^\\\\\?\\## };
> use FindBin;
> use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
>
> my $cgi =3D CGI->new;
> print $cgi->header;
> my $jver =3D 'unknown or jre6 not found';
>
> my $spath =3D "$ENV{SystemRoot}\\SYSTEM32";
> $ENV{PATH} .=3D ";$spath";
>
> my $osname =3D lc $^O;
> if ($osname eq 'linux') {
> $jver =3D `./version.sh`;
> }
> else
> {
> my $jrepath =3D "$FindBin::Bin/jre6/bin/java.exe";
>
> if (-e $jrepath)
> {
> $jver =3D `$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=3D"color:
> #0066FF;">$FindBin::Bin</span></h3>
> <h3>The script I'm executing is: <span style=3D"color:
> #0066FF;">$0</span></h3>
> <h3>The output of 'java -version' is: </h3>
> <span style=3D"color: #0066FF;">
> <PRE>
> $jver
> </PRE>
> </span>
> <h3>The Perl binary I'm executing is at: <span style=3D"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 =D6lwing <kenneth [at] olwing.se> 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 i=
n
> > 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
> >
> >
>
>

------=_Part_7191_27333936.1181037036259
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

<div>and When I have tried on other machine, that havn't perl installed=
, this shows</div>
<div> </div>
<div>
<h1>CGI Error</h1>The specified CGI application misbehaved by not returning=
a complete set of HTTP headers. The headers it did return are:
<p>
<p><pre>Cannot find current script '\\?\c:\inetpub\wwwroot\lmtest\foo.e=
xe' 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.
</pre><br><br> </p></p></div>
<div><span class=3D"gmail_quote">On 6/5/07, <b class=3D"gmail_sendername">M=
othi Mehta</b> <<a href=3D"mailto:evergreenudaipur [at] gmail.com">evergreenu=
daipur [at] gmail.com</a>> wrote:</span>
<blockquote class=3D"gmail_quote" style=3D"PADDING-LEFT: 1ex; MARGIN: 0px 0=
px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div>Hi, </div>
<div> </div>
<div>I have tried that :</div>
<div> </div>
<p>#!perl --</p>
<p><span class=3D"q">use strict;<br>use warnings;<br>use CGI;<br></span><sp=
an class=3D"q">BEGIN { $0 =3D~ s#^\\\\\?\\## };<br>use FindBin;<br></span><=
span class=3D"q">use CGI::Carp qw(warningsToBrowser fatalsToBrowser);</span=
></p>

<p>my $cgi =3D CGI->new;<br>print $cgi->header;<br>my $jver =3D '=
unknown or jre6 not found';</p><span class=3D"q">
<p>my $spath =3D "$ENV{SystemRoot}\\SYSTEM32";<br>$ENV{PATH} .=3D=
";$spath";</p></span>
<p>my $osname =3D lc $^O;<br>if ($osname eq 'linux') {<br> &nb=
sp;     $jver =3D `./version.sh`;<span class=3D"q"><br>=
} <br>else <br>{<br>       my $jrepath =3D &q=
uot;$FindBin::Bin/jre6/bin/java.exe";</span></p>
<p>       if (-e $jrepath)<br>  &nb=
sp;    {<br>        =
       $jver =3D `$jrepath -version 2>&=
;1`;<br>       } <br>}</p><span class=3D"q">
<p>print <<END_HTML;<br><!DOCTYPE HTML PUBLIC "-//W3C//DTD HT=
ML 4.01 Transitional//EN"><br><HTML><br><HEAD><br><T=
ITLE>Absolute Path Sample Script Showing How To Get Absolute Path In PER=
L And JavaVersion</TITLE>
<br></HEAD><br><BODY></p></span>
<p><span class=3D"q"><h3>The Absolute Path to this script is: <spa=
n style=3D"color: #0066FF;">$FindBin::Bin</span></h3&=
gt;<br><h3>The script I'm executing is: <span style=3D"co=
lor: #0066FF;">$0</span></h3>
<br><h3>The output of 'java -version' is: </h3><br><=
span style=3D"color: #0066FF;"><br><PRE><br>$jver<br><=
;/PRE><br></span><br></span><h3>The Perl binary I'm exec=
uting is at: <span style=3D"color: #0066FF;">$^X</span&g=
t;</h3>
</p>
<p></BODY><br></HTML><br>END_HTML</p>
<p>exit;<br></p>
<p> </p>
<div>it works while running with <a onclick=3D"return top.js.OpenExtLink(wi=
ndow,event,this)" href=3D"http://localhost/mydemos/examples/perlscript/foo.=
pl'" target=3D"_blank">http://localhost/mydemos/examples/perlscri pt/foo=
..pl'
</a></div>
<div> but when I have created exe and tried the same <a onclick=3D"ret=
urn top.js.OpenExtLink(window,event,this)" href=3D"http://localhost/mydemos=
/examples/perlscript/foo.exe" target=3D"_blank">http://localhost/mydemos/ex=
amples/perlscript/foo.exe
</a> then its show CGI error</div>
<div> </div>
<div> </div>
<div><br><br> </div>
<div><span class=3D"q"><span class=3D"gmail_quote">On 6/5/07, <b class=3D"g=
mail_sendername">Kenneth =D6lwing</b> <<a onclick=3D"return top.js.OpenE=
xtLink(window,event,this)" href=3D"mailto:kenneth [at] olwing.se" target=3D"_bla=
nk">kenneth [at] olwing.se
</a>> wrote:</span> </span>
<div><span class=3D"e" id=3D"q_112fb49416e9d75c_14">
<blockquote class=3D"gmail_quote" style=3D"PADDING-LEFT: 1ex; MARGIN: 0px 0=
px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div text=3D"#000000" bgcolor=3D"#ffffff"><br>
<blockquote type=3D"cite"><span>
<div>I have tried the same , but after creating exe using pdk its shows </d=
iv>
<div> </div>
<h1>CGI Error</h1>
<div>The specified CGI application misbehaved by not returning a complete s=
et of HTTP headers</div></span></blockquote>Umm, what exactly do you mean t=
o 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 co=
de. Perhaps I misunderstand you completely...<br><br>ken1<br> </div></=
blockquote></span></div></div><br></blockquote></div><br>

------=_Part_7191_27333936.1181037036259--

--===============1170227680==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============1170227680==--
Mothi Mehta [ Di, 05 Juni 2007 11:50 ] [ ID #1730904 ]

Re: Absoulte path in Perl

This is a multi-part message in MIME format.
--============== 74852544==
Content-Type: multipart/alternative;
boundary="------------010005050207080007010700"

This is a multi-part message in MIME format.
--------------010005050207080007010700
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit


> 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.
>
Well, how to make the CGI stuff behave I have no idea. The error above
suggest that the BEGIN never ran (you did recompile?), or, that it isn't
possible to assign to $0 in that manner in a perlapp. Or something else
is broken...sorry, can't help much beyond here.

ken1

--------------010005050207080007010700
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
<blockquote
cite="mid:68ab69220706050250k340f428h13cddbc51df9c479 [at] mail.g mail.com"
type="cite">
<div>
<h1>CGI Error</h1>
The specified CGI application misbehaved by not returning a complete
set of HTTP headers. The headers it did return are:
<p></p>
<pre>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.
</pre>
</div>
</blockquote>
Well, how to make the CGI stuff behave I have no idea. The error above
suggest that the BEGIN never ran (you did recompile?), or, that it
isn't possible to assign to $0 in that manner in a perlapp. Or
something else is broken...sorry, can't help much beyond here.<br>
<br>
ken1<br>
</body>
</html>

--------------010005050207080007010700--

--============== 74852544==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--============== 74852544==--
ken1 [ Di, 05 Juni 2007 15:19 ] [ ID #1730906 ]

RE: Absoulte path in Perl

This is a multipart message in MIME format.

--===============1392853872==
Content-Type: multipart/alternative;
boundary="----=_NextPart_000_0333_01C7A749.929F8ED0"
Content-Language: en-ca

This is a multipart message in MIME format.

------=_NextPart_000_0333_01C7A749.929F8ED0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

PerlApp needs to do some magic behind the scenes to keep FindBin =
working, so modifying $0 doesn=92t 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 =3D PerlApp::exe();

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

no warnings "redefine";

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

}



I=92ll 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: activeperl-bounces [at] listserv.ActiveState.com =
[mailto:activeperl-bounces [at] listserv.ActiveState.com] On Behalf Of Mothi =
Mehta
Sent: June 5, 2007 2:51 AM
To: Kenneth =D6lwing
Cc: activeperl [at] listserv.activestate.com
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 <evergreenudaipur [at] gmail.com> wrote:

Hi,



I have tried that :



#!perl --

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

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

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

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

if (-e $jrepath)
{
$jver =3D `$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=3D"color: =
#0066FF;">$FindBin::Bin</span></h3>
<h3>The script I'm executing is: <span style=3D"color: =
#0066FF;">$0</span></h3>
<h3>The output of 'java -version' is: </h3>
<span style=3D"color: #0066FF;">
<PRE>
$jver
</PRE>
</span>
<h3>The Perl binary I'm executing is at: <span style=3D"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 =D6lwing <kenneth [at] olwing.se =
<mailto:kenneth [at] olwing.se> > 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







------=_NextPart_000_0333_01C7A749.929F8ED0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" =
xmlns=3D"http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<meta name=3DGenerator content=3D"Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
[at] font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
[at] font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
[at] font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
[at] font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
h1
{mso-style-priority:9;
mso-style-link:"Heading 1 Char";
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:24.0pt;
font-family:"Times New Roman","serif";
font-weight:bold;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";}
span.Heading1Char
{mso-style-name:"Heading 1 Char";
mso-style-priority:9;
mso-style-link:"Heading 1";
font-family:"Cambria","serif";
color:#365F91;
font-weight:bold;}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:Consolas;}
span.gmailquote
{mso-style-name:gmail_quote;}
span.q
{mso-style-name:q;}
span.e
{mso-style-name:e;}
span.EmailStyle24
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
..MsoChpDefault
{mso-style-type:export-only;}
[at] page Section1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.Section1
{page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]-->
</head>

<body lang=3DEN-US link=3Dblue vlink=3Dpurple>

<div class=3DSection1>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>PerlApp needs to do some magic behind the scenes to keep =
FindBin
working, so modifying $0 doesn’t have any =
effect.<o:p></o:p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'><o:p> </o:p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>Please add the following BEGIN block to the top of your =
script
to work around this issue.<o:p></o:p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'><o:p> </o:p></span></p>

<p class=3DMsoNormal style=3D'margin-left:36.0pt'><span =
style=3D'font-size:11.0pt;
font-family:"Courier New";color:black'>BEGIN {<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'margin-left:36.0pt'><span =
style=3D'font-size:11.0pt;
font-family:"Courier New";color:black'>=A0=A0=A0 return unless defined
&PerlApp::exe;<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'margin-left:36.0pt'><span =
style=3D'font-size:11.0pt;
font-family:"Courier New";color:black'>=A0=A0=A0 my $exe =3D =
PerlApp::exe();<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'margin-left:36.0pt'><span =
style=3D'font-size:11.0pt;
font-family:"Courier New";color:black'>=A0=A0=A0 $exe =3D~ =
s#^\\\\\?\\##;<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'margin-left:36.0pt'><span =
style=3D'font-size:11.0pt;
font-family:"Courier New";color:black'>=A0=A0=A0 no warnings =
"redefine";<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'margin-left:36.0pt'><span =
style=3D'font-size:11.0pt;
font-family:"Courier New";color:black'>=A0=A0=A0 *PerlApp::exe =3D sub { =
$exe };<o:p></o:p></span></p>

<p class=3DMsoNormal style=3D'margin-left:36.0pt'><span =
style=3D'font-size:11.0pt;
font-family:"Courier New";color:black'>}<o:p></o:p></span></p>

<p class=3DMsoNormal><a name=3D"_MailEndCompose"><span =
style=3D'font-size:11.0pt;
font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span=
></a></p>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>I’ll fix PerlApp for PDK 7.1 to automatically strip =
the \\?\
prefix from $0 and PerlApp::exe() to make this workaround =
unnecessary.<o:p></o:p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'><o:p> </o:p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>Cheers,<o:p></o:p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>-Jan<o:p></o:p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'><o:p> </o:p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>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).<o:p></o:p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'><o:p> </o:p></span></p>

<div style=3D'border:none;border-left:solid blue 1.5pt;padding:0cm 0cm =
0cm 4.0pt'>

<div>

<div style=3D'border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt =
0cm 0cm 0cm'>

<p class=3DMsoNormal><b><span =
style=3D'font-size:10.0pt;font-family:"Tahoma","sans-serif"' >From:</span>=
</b><span
style=3D'font-size:10.0pt;font-family:"Tahoma","sans-serif"' >
activeperl-bounces [at] listserv.ActiveState.com
[mailto:activeperl-bounces [at] listserv.ActiveState.com] <b>On Behalf Of =
</b>Mothi
Mehta<br>
<b>Sent:</b> June 5, 2007 2:51 AM<br>
<b>To:</b> Kenneth =D6lwing<br>
<b>Cc:</b> activeperl [at] listserv.activestate.com<br>
<b>Subject:</b> Re: Absoulte path in Perl<o:p></o:p></span></p>

</div>

</div>

<p class=3DMsoNormal><o:p> </o:p></p>

<div>

<p class=3DMsoNormal>and When I have tried on other machine, that havn't =
perl
installed, this shows<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal> <o:p></o:p></p>

</div>

<div>

<h1>CGI Error<o:p></o:p></h1>

<p class=3DMsoNormal>The specified CGI application misbehaved by not =
returning a
complete set of HTTP headers. The headers it did return are: =
<o:p></o:p></p>

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

<p class=3DMsoNormal><br>
<br>
 <o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal><span class=3Dgmailquote>On 6/5/07, <b>Mothi =
Mehta</b> <<a
href=3D"mailto:evergreenudaipur [at] gmail.com">evergreenudaipur [at] gmail.com</a>=
>
wrote:</span> <o:p></o:p></p>

<div>

<p class=3DMsoNormal>Hi, <o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal> <o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal>I have tried that :<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal> <o:p></o:p></p>

</div>

<p>#!perl --<o:p></o:p></p>

<p><span class=3Dq>use strict;</span><br>
<span class=3Dq>use warnings;</span><br>
<span class=3Dq>use CGI;</span><br>
<span class=3Dq>BEGIN { $0 =3D~ s#^\\\\\?\\## };</span><br>
<span class=3Dq>use FindBin;</span><br>
<span class=3Dq>use CGI::Carp qw(warningsToBrowser =
fatalsToBrowser);</span><o:p></o:p></p>

<p>my $cgi =3D CGI->new;<br>
print $cgi->header;<br>
my $jver =3D 'unknown or jre6 not found';<o:p></o:p></p>

<p>my $spath =3D "$ENV{SystemRoot}\\SYSTEM32";<br>
$ENV{PATH} .=3D ";$spath";<o:p></o:p></p>

<p>my $osname =3D lc $^O;<br>
if ($osname eq 'linux') {<br>
       $jver =3D `./version.sh`;<br>
<span class=3Dq>} </span><br>
<span class=3Dq>else </span><br>
<span class=3Dq>{</span><br>
<span class=3Dq>       my $jrepath =3D
"$FindBin::Bin/jre6/bin/java.exe";</span><o:p></o:p></p>

<p>       if (-e $jrepath)<br>
       {<br>
            &=
nbsp; 
$jver =3D `$jrepath -version 2>&1`;<br>
       } <br>
}<o:p></o:p></p>

<p>print <<END_HTML;<br>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 =
Transitional//EN"><br>
<HTML><br>
<HEAD><br>
<TITLE>Absolute Path Sample Script Showing How To Get Absolute =
Path In
PERL And JavaVersion</TITLE> <br>
</HEAD><br>
<BODY><o:p></o:p></p>

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

<p></BODY><br>
</HTML><br>
END_HTML<o:p></o:p></p>

<p>exit;<o:p></o:p></p>

<p> <o:p></o:p></p>

<div>

<p class=3DMsoNormal>it works while running with <a
href=3D"http://localhost/mydemos/examples/perlscript/foo.pl' " =
target=3D"_blank">http://localhost/mydemos/examples/perlscri pt/foo.pl'
</a><o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal> but when I have created exe and tried the =
same <a
href=3D"http://localhost/mydemos/examples/perlscript/foo.exe " =
target=3D"_blank">http://localhost/mydemos/examples/perlscri pt/foo.exe
</a>then its show CGI error<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal> <o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal> <o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal><br>
<br>
 <o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal><span class=3Dgmailquote>On 6/5/07, <b>Kenneth =
=D6lwing</b> <<a
href=3D"mailto:kenneth [at] olwing.se" target=3D"_blank">kenneth [at] olwing.se =
</a>>
wrote:</span><span class=3Dq> </span><o:p></o:p></p>

<div>

<blockquote style=3D'border:none;border-left:solid #CCCCCC =
1.0pt;padding:0cm 0cm 0cm 6.0pt;
margin-left:4.8pt;margin-right:0cm'>

<div>

<p class=3DMsoNormal><br>
<br>
<o:p></o:p></p>

<div>

<p class=3DMsoNormal>I have tried the same , but after creating exe =
using pdk its
shows <o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal> <o:p></o:p></p>

</div>

<h1>CGI Error<o:p></o:p></h1>

<div>

<p class=3DMsoNormal>The specified CGI application misbehaved by not =
returning a
complete set of HTTP headers<o:p></o:p></p>

</div>

<p class=3DMsoNormal>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...<br>
<br>
ken1<br>
 <o:p></o:p></p>

</div>

</blockquote>

</div>

</div>

<p class=3DMsoNormal><o:p> </o:p></p>

</div>

<p class=3DMsoNormal><o:p> </o:p></p>

</div>

</div>

</body>

</html>

------=_NextPart_000_0333_01C7A749.929F8ED0--


--===============1392853872==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============1392853872==--
Jan Dubois [ Di, 05 Juni 2007 17:14 ] [ ID #1730909 ]

Re: Absoulte path in Perl

This is a multi-part message in MIME format.
--===============1103815627==
Content-Type: multipart/alternative;
boundary="------------030103000109060408090309"

This is a multi-part message in MIME format.
--------------030103000109060408090309
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Jan Dubois wrote:
>
> I'll fix PerlApp for PDK 7.1 to automatically strip the \\?\ prefix
> from $0 and PerlApp::exe() to make this workaround unnecessary.
>
Thanks Jan - what do you think about the issue at the heart of the
problem? I.e. the reason to mangle $0 in the first place is that '-f'
won't work with a \\?\ path - but shouldn't that be considered a bug? If
you agree can you file that as a bug (merely asking nicely since I
gather you might be knowledgeable about the actual code involved...) or
should the OP do that?


Thanks again for great work on ActivePerl, PDK et al!

ken1

--------------030103000109060408090309
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Jan Dubois wrote:
<blockquote cite="mid:033201c7a784$3efe66d0$bcfb3470$ [at] com" type="cite">
<meta http-equiv="Content-Type" content="text/html; ">
<meta name="Generator" content="Microsoft Word 12 (filtered medium)">
<style>
<!--
/* Font Definitions */
[at] font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
[at] font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
[at] font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
[at] font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
h1
{mso-style-priority:9;
mso-style-link:"Heading 1 Char";
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:24.0pt;
font-family:"Times New Roman","serif";
font-weight:bold;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";}
span.Heading1Char
{mso-style-name:"Heading 1 Char";
mso-style-priority:9;
mso-style-link:"Heading 1";
font-family:"Cambria","serif";
color:#365F91;
font-weight:bold;}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:Consolas;}
span.gmailquote
{mso-style-name:gmail_quote;}
span.q
{mso-style-name:q;}
span.e
{mso-style-name:e;}
span.EmailStyle24
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
..MsoChpDefault
{mso-style-type:export-only;}
[at] page Section1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.Section1
{page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="Section1">
<p class="MsoNormal"><span
style="font-size: 11pt; font-family: "Calibri","sans-serif"; color: rgb(31, 73, 125);">I’ll
fix PerlApp for PDK 7.1 to automatically strip the \\?\
prefix from $0 and PerlApp::exe() to make this workaround unnecessary.<o:p></o:p></span></p>
</div>
</blockquote>
Thanks Jan - what do you think about the issue at the heart of the
problem? I.e. the reason to mangle $0 in the first place is that '-f'
won't work with a \\?\ path - but shouldn't that be considered a bug?
If you agree can you file that as a bug (merely asking nicely since I
gather you might be knowledgeable about the actual code involved...) or
should the OP do that?<br>
<br>
<br>
Thanks again for great work on ActivePerl, PDK et al!<br>
<br>
ken1<br>
</body>
</html>

--------------030103000109060408090309--

--===============1103815627==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============1103815627==--
ken1 [ Di, 05 Juni 2007 21:52 ] [ ID #1730910 ]

RE: Absoulte path in Perl

Kenneth =D6lwing wrote:
> Jan Dubois wrote:
>> I=92ll fix PerlApp for PDK 7.1 to automatically strip the \\?\ prefix
>> from $0 and PerlApp::exe() to make this workaround >>unnecessary.
>
> Thanks Jan - what do you think about the issue at the heart of the
> problem? I.e. the reason to mangle $0 in the first place is that '-f'
> won't work with a \\?\ path - but shouldn't that be considered a bug?
> If you agree can you file that as a bug (merely asking nicely since I
> gather you might be knowledgeable about the actual code involved...)
> or should the OP do that?

No, Perl cannot support the \\?\ prefix right now. This prefix works
only with the "wide character" APIs, whereas Perl uses the ANSI APIs for
almost all file operations [*]. Perl also uses fixed width buffers
throughout the code that could not accommodate longer filenames. This
_may_ all be improved eventually, but not until Perl
5.12 at the earliest.

You'll see that I "fixed" this problem in core Perl almost 2 years ago:

http://groups.google.com/group/perl.perl5.porters/msg/d194a6 d4be42143f

I believe that change was also prompted by IIS6 using the prefix to load
additional libraries, which created a problem for Perl-ISAPI and PerlEx.

Cheers,
-Jan

[*] I've added some support to Perl and the Win32 module to allow
processing of files whose names cannot be represented in the system
codepage. I'll write something about it when it is being released
in ActivePerl 821 (it will be core Perl in 5.8.9 and 5.10 too).

The idea is essentially to automatically turn Unicode names into 8.3
short filenames whenever they cannot be encoded in the system codepage.
This will work for glob(), readdir(), etc.

_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Jan Dubois [ Di, 05 Juni 2007 22:25 ] [ ID #1730911 ]

Re: Absoulte path in Perl

--===============0448963005==
Content-Type: multipart/alternative;
boundary="----=_Part_14880_33113810.1181133034702"

------=_Part_14880_33113810.1181133034702
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Now its works..thanks a lot....

--Mohit




On 6/6/07, Jan Dubois <jand [at] activestate.com> wrote:
>
> Kenneth =D6lwing wrote:
> > Jan Dubois wrote:
> >> I'll fix PerlApp for PDK 7.1 to automatically strip the \\?\ prefix
> >> from $0 and PerlApp::exe() to make this workaround >>unnecessary.
> >
> > Thanks Jan - what do you think about the issue at the heart of the
> > problem? I.e. the reason to mangle $0 in the first place is that '-f'
> > won't work with a \\?\ path - but shouldn't that be considered a bug?
> > If you agree can you file that as a bug (merely asking nicely since I
> > gather you might be knowledgeable about the actual code involved...)
> > or should the OP do that?
>
> No, Perl cannot support the \\?\ prefix right now. This prefix works
> only with the "wide character" APIs, whereas Perl uses the ANSI APIs for
> almost all file operations [*]. Perl also uses fixed width buffers
> throughout the code that could not accommodate longer filenames. This
> _may_ all be improved eventually, but not until Perl
> 5.12 at the earliest.
>
> You'll see that I "fixed" this problem in core Perl almost 2 years ago:
>
> http://groups.google.com/group/perl.perl5.porters/msg/d194a6 d4be42143f
>
> I believe that change was also prompted by IIS6 using the prefix to load
> additional libraries, which created a problem for Perl-ISAPI and PerlEx.
>
> Cheers,
> -Jan
>
> [*] I've added some support to Perl and the Win32 module to allow
> processing of files whose names cannot be represented in the system
> codepage. I'll write something about it when it is being released
> in ActivePerl 821 (it will be core Perl in 5.8.9 and 5.10 too).
>
> The idea is essentially to automatically turn Unicode names into 8.3
> short filenames whenever they cannot be encoded in the system codepage.
> This will work for glob(), readdir(), etc.
>
>

------=_Part_14880_33113810.1181133034702
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

<div>Now its works..thanks a lot....</div>
<div> </div>
<div>--Mohit</div>
<div> </div>
<div><br><br> </div>
<div><span class=3D"gmail_quote">On 6/6/07, <b class=3D"gmail_sendername">J=
an Dubois</b> <<a href=3D"mailto:jand [at] activestate.com">jand [at] activestate.=
com</a>> wrote:</span>
<blockquote class=3D"gmail_quote" style=3D"PADDING-LEFT: 1ex; MARGIN: 0px 0=
px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Kenneth =D6lwing wrote:<br>> =
Jan Dubois wrote:<br>>> I'll fix PerlApp for PDK 7.1 to automatically=
strip the \\?\ prefix
<br>>> from $0 and PerlApp::exe() to make this workaround >>unn=
ecessary.<br>><br>> Thanks Jan - what do you think about the issue at=
the heart of the<br>> problem? I.e. the reason to mangle $0 in the firs=
t place is that '-f'
<br>> won't work with a \\?\ path - but shouldn't that be consid=
ered a bug?<br>> If you agree can you file that as a bug (merely asking =
nicely since I<br>> gather you might be knowledgeable about the actual c=
ode involved...)
<br>> or should the OP do that?<br><br>No, Perl cannot support the \\?\ =
prefix right now. This prefix works<br>only with the "wide character&q=
uot; APIs, whereas Perl uses the ANSI APIs for<br>almost all file operation=
s [*]. Perl also uses fixed width buffers
<br>throughout the code that could not accommodate longer filenames. This<b=
r>_may_ all be improved eventually, but not until Perl<br>5.12 at the earli=
est.<br><br>You'll see that I "fixed" this problem in core Pe=
rl almost 2 years ago:
<br><br><a href=3D"http://groups.google.com/group/perl.perl5.porters/msg/d1=
94a6d4be42143f">http://groups.google.com/group/perl.perl5.po rters/msg/d194a=
6d4be42143f</a><br><br>I believe that change was also prompted by IIS6 usin=
g the prefix to load
<br>additional libraries, which created a problem for Perl-ISAPI and PerlEx=
..<br><br>Cheers,<br>-Jan<br><br>[*] I've added some support to Perl and=
the Win32 module to allow<br>processing of files whose names cannot be rep=
resented in the system
<br>codepage.  I'll write something about it when it is being=
released<br>in ActivePerl 821 (it will be core Perl in 5.8.9 and 5.10 too)=
..<br><br>The idea is essentially to automatically turn Unicode names into 8=
..3<br>
short filenames whenever they cannot be encoded in the system codepage.<br>=
This will work for glob(), readdir(), etc.<br><br></blockquote></div><br>

------=_Part_14880_33113810.1181133034702--

--===============0448963005==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ActivePerl mailing list
ActivePerl [at] listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============0448963005==--
Mothi Mehta [ Mi, 06 Juni 2007 14:30 ] [ ID #1731836 ]
Perl » gmane.comp.lang.perl.active-perl » Absoulte path in Perl

Vorheriges Thema: Win32::Clipboard Vista bug?
Nächstes Thema: uml::class::simple query