Absoulte path in Perl

Absoulte path in Perl

am 31.05.2007 08:36:47 von Mothi Mehta

--===============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";



Absolute Path Sample Script Showing How To Get Absolute Path In PERL<br />


Sample Script Showing Absolute Path

The Absolute Path is: $abs_path





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,



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

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

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

Re: Absoulte path in Perl

am 31.05.2007 09:21:23 von ken1

> 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

RE: Absoulte path in Perl

am 31.05.2007 15:29:16 von matt.pettis

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@listserv.ActiveState.com
[mailto:activeperl-bounces@listserv.ActiveState.com] On Behalf Of Mothi
Mehta
Sent: Thursday, May 31, 2007 1:37 AM
To: activeperl@listserv.ActiveState.com
Subject: Absoulte path in Perl


Hello everyone,=20

I am getting problems in Perl to get Absolute path,=20

My Directory structure is : =20

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

scripts details:=20

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

=20
print <<"END_HTML";=20
=20
=20
=20
Absolute Path Sample Script Showing How To Get Absolute Path In<br /> PERL =20
=20
=20
Sample Script Showing Absolute Path =20

The Absolute Path is: $abs_path

=20

=20
=20
END_HTML=20




But when I run this its shows :=20

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

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

is anything wrong ?=20

Please suggest me asap..=20

Thanks in advance..=20
Mohit Mehta=20

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



charset=3Dus-ascii">


face=3D"Courier New"=20
color=3D#0000ff>what do you get when you print out the result of =
'getcwd'? =20
does that give you what you expect?





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


Hello everyone,

I am getting problems in Perl to get =
Absolute=20
path,

My Directory structure is :  =20


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

scripts =
details:=20


#!/usr/bin/perl -w
use strict;
use CGI;
use Cwd =
'abs_path';=20

use Cwd;
my $cgi           =3D =
CGI->new;=20

$cgi->header;
print $cgi->header;
my $file =3D getcwd; =

my=20
$abs_path =3D abs_path($file);
my $output=3D'';
use CGI::Carp=20
qw(warningsToBrowser fatalsToBrowser); # uncommenting this during =
debugging=20
phase may be helpful

 
print <<"END_HTML";=20

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 =
Transitional//EN">=20

<HTML>
<HEAD>
<TITLE>Absolute Path Sample =
Script=20
Showing How To Get Absolute Path In PERL </TITLE> =

</HEAD>=20

<BODY>
<strong>Sample Script Showing Absolute Path=20
</strong>
<h3>The Absolute Path is: style=3D"COLOR: rgb(0,102,255)"> $abs_path </h3>=20


</BODY>
</HTML>
END_HTML =





But=20
when I run this its shows :

Sample Script Showing Absolute Path =

The=20
Absolute Path is: c:/inetpub/wwwroot

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


is anything wrong ?

Please suggest me asap.. =


Thanks in=20
advance..
Mohit Mehta

------_=_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@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============0487222854==--

Re: Absoulte path in Perl

am 04.06.2007 15:31:29 von Mothi Mehta

--===============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 Ölwing 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


On 5/31/07, gmail_sendername">Kenneth Ölwing < ..se">kenneth@olwing.se> wrote:
e" style=3D"border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt =
0.8ex; padding-left: 1ex;">

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


There is nothing that says that your web server has to change to th=
e
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 web=
server 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 forc=
e

your cwd to the script dir? Then one way is to use FindBin and cd to th=
e
script dir that it will provide for you.

As an aside I see no r=
eason to do abs_path on the return from getcwd -
it already is in abs fo=
rmat. Basically you could replace a call to cwd

with a call to abs_path('.') - this would perhaps better illust=
rate what
abs_path does.

HTH,

ken1
<=
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@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============2138195819==--

Re: Absoulte path in Perl

am 05.06.2007 08:20:27 von Mothi Mehta

--===============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";



Absolute Path Sample Script Showing How To Get Absolute Path In PERL<br /> And JavaVersion


Sample Script Showing Absolute Path

The Absolute Path is: $FindBin::Bin





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 Ölwing 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

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  &nbs=
p;        =3D CGI->new;
$cgi->h=
eader;
print $cgi->header;
my $output=3D'';
use CGI::C=
arp qw(warningsToBrowser fatalsToBrowser); # uncommenting this during debug=
ging phase may be helpful

use FindBin;
 
print <<"END_HTML";
<!D=
OCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> r><HTML>
<HEAD>
<TITLE>Absolute Path Sample Script =
Showing How To Get Absolute Path In PERL And JavaVersion</TITLE>

</HEAD>
<BODY>
<strong>Sample Script Showing Ab=
solute Path </strong>
<h3>The Absolute Path is: <span sty=
le=3D"color: #0066FF;"> $FindBin::Bin </span></h3>


</BODY>
</HTML>
END_HTML
my $osname=3D$^O;
if($=
osname eq "linux")
{
 $output=3D`./version.sh`;
} r>else
{
 my $jrepath=3D"$FindBin::Bin/"."jre6/bi=
n/java.exe";

 if(-e "$jrepath")
 {
  $output =3D=
`$jrepath -version`;
 }
 else
 {
  p=
rint "JRE6 not found at ". $FindBin::Bin ;
   =
     }
}


exit(0);


 

this works with  " es/testscript/path.pl">http://localhost/mydemos/examples/tes tscript/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 l=
ine 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 err=
or message and the time and date of the error.



 

On 5/31/07, =
Kenneth Ölwing
<kenneth@olwin=
g.se
> wrote:

px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
> why its showing "c=
:/inetpub/wwwroot" instead of
> "c:/inetpub/wwwroot/mytests=
cripts/perl"

>
> is anything wrong ?
>
> Please suggest me asap=
...
There is nothing wrong as far as I can see.

There is nothing t=
hat 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 webse=
rver to
consistently *always* kick off scripts with the wwwroot as the c=
wd;
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 forc=
e
your cwd to the script dir? Then one way is to use FindBin and cd to t=
he
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<=
br>with a call to abs_path('.') - this would perhaps better illustr=
ate what
abs_path does.

HTH,

ken1




------=_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@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============1624568677==--

Re: Absoulte path in Perl

am 05.06.2007 10:14:27 von ken1

> 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@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Re: Absoulte path in Perl

am 05.06.2007 11:16:14 von Mothi Mehta

--===============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 Ölwing 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

Thanks,

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

CGI Error


The specified CGI application misbehaved by not returning a complete s=
et of HTTP headers

 

--LM

 

On 6/5/07, K=
enneth Ölwing
<kenneth@olwing=
..se
> wrote:

px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
> Cannot find current scr=
ipt '\\?\c:\inetpub\wwwroot\mydemos\examples\testscript\path.exe ' a=
t /PerlApp/FindBin.pm line 201

> BEGIN failed--compilation aborted at /PerlApp/FindBin.pm line 201.=

> BEGIN failed--compilation aborted at path.pl line 9.
>
Fo=
r some reason IIS (?) is using the unicode form of the path (i.e.
prefix=
ing 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=
9; check that fails, and indeed,
trying it specifically shows this. Assu=
ming c:\tmp\foo.pl exists as a file:

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


will print '1', while

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

will print '' (i.e. a b=
lank 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 fi=
le this as a bug with the '-f' operator...?

For your particu=
lar 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;
...
<=
br>Ugh...not very nice and I don't know if it might cause problems
e=
lsewhere, or if it'll work when perlapped...

ken1

quote>



------=_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@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============0679160307==--

Re: Absoulte path in Perl

am 05.06.2007 11:17:34 von Mothi Mehta

--===============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 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 Ölwing 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..


On 6/5/07, M=
othi Mehta
<evergreenu=
daipur@gmail.com
> wrote:

px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
Thanks,

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

CGI Error


The specified CGI application misbehaved by not returning a complete s=
et of HTTP headers

 

--LM

 


On 6/5/07, K=
enneth Ölwing
< t,this)" href=3D"mailto:kenneth@olwing.se" target=3D"_blank">kenneth@olwing=
..se

> wrote:
=20
px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
> Cannot find current scr=
ipt '\\?\c:\inetpub\wwwroot\mydemos\examples\testscript\path.exe ' a=
t /PerlApp/FindBin.pm line 201=20

> BEGIN failed--compilation aborted at /PerlApp/FindBin.pm line 201.=

> BEGIN failed--compilation aborted at path.pl line 9.
>
Fo=
r some reason IIS (?) is using the unicode form of the path (i.e.
prefix=
ing with \\?) and this causes FindBin to fail. Actually, just=20

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=20

is thus legal).

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

   perl -e "prin=
t -f $ARGV[0]" c:\tmp\foo.pl=20


will print '1', while

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

will print '' (i.e. a b=
lank value, indicating false). Still, it's
generally ok to use the \=
\? form (since the example above, running 'perl=20

\\?\c:\tmp\foo.pl' nicely runs the script).

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

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


...
BEGIN { $0 =3D~ s#^\\\\\?\\## };
use FindBin;
...
<=
br>Ugh...not very nice and I don't know if it might cause problems
e=
lsewhere, or if it'll work when perlapped...

ken1

quote>




------=_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@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============1354752981==--

Re: Absoulte path in Perl

am 05.06.2007 11:30:10 von ken1

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









cite="mid:68ab69220706050216q6fc413e7h1f1434189a403af2@mail. gmail.com"
type="cite">

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

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

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

Re: Absoulte path in Perl

am 05.06.2007 11:48:40 von Mothi Mehta

--===============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 <


Absolute Path Sample Script Showing How To Get Absolute Path In PERL<br /> And JavaVersion



The Absolute Path to this script is: #0066FF;">$FindBin::Bin


The script I'm executing is: #0066FF;">$0


The output of 'java -version' is:




$jver


The Perl binary I'm executing is at: #0066FF;">$^X





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 Ölwing 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

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') {
 &nb=
sp;     $jver =3D `./version.sh`;
}
else
{ r>       my $jrepath =3D "$FindBin::Bin/=
jre6/bin/java.exe";


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


print <<END_HTML;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HT=
ML 4.01 Transitional//EN">
<HTML>
<HEAD>
<T=
ITLE>Absolute Path Sample Script Showing How To Get Absolute Path In PER=
L And JavaVersion</TITLE>

</HEAD>
<BODY>


<h3>The Absolute Path to this script is: <span style=3D"co=
lor: #0066FF;">$FindBin::Bin</span></h3>
<h3>T=
he 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 i=
s at: <span style=3D"color: #0066FF;">$^X</span></=
h3>


</BODY>
</HTML>
END_HTML


exit;


 


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

 but when I have created exe and tried the same /localhost/mydemos/examples/perlscript/foo.exe">http://local host/mydemos/ex=
amples/perlscript/foo.exe
then its show CGI error

 

 



 

On 6/5/07, K=
enneth Ölwing
<kenneth@olwing=
..se
> wrote:

px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">



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

CGI Error


The specified CGI application misbehaved by not returning a complete s=
et of HTTP headers
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,=20
e.g. the BEGIN is just a snippet of course, insert it into your original co=
de. Perhaps I misunderstand you completely...

ken1
 
blockquote>



------=_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@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============1796209139==--

Re: Absoulte path in Perl

am 05.06.2007 11:50:36 von Mothi Mehta

--===============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 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 < >
>
>
> Absolute Path Sample Script Showing How To Get Absolute Path In<br /> > PERL And JavaVersion
>
>
>
>

The Absolute Path to this script is: > #0066FF;">$FindBin::Bin


>

The script I'm executing is: > #0066FF;">$0


>

The output of 'java -version' is:


>
>

> $jver
>

>

>

The Perl binary I'm executing is at: > #0066FF;">$^X


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

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:=20


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.


 


On 6/5/07, M=
othi Mehta
<evergreenu=
daipur@gmail.com
> wrote:

px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
Hi,

 

I have tried that :

 

#!perl --


use strict;
use warnings;
use CGI;
an class=3D"q">BEGIN { $0 =3D~ s#^\\\\\?\\## };
use FindBin;
<=
span class=3D"q">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') {
 &nb=
sp;     $jver =3D `./version.sh`;
=
}
else
{
       my $jrepath =3D &q=
uot;$FindBin::Bin/jre6/bin/java.exe";


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


print <<END_HTML;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HT=
ML 4.01 Transitional//EN">
<HTML>
<HEAD>
<T=
ITLE>Absolute Path Sample Script Showing How To Get Absolute Path In PER=
L And JavaVersion</TITLE>=20

</HEAD>
<BODY>


<h3>The Absolute Path to this script is: <spa=
n style=3D"color: #0066FF;">$FindBin::Bin</span></h3&=
gt;
<h3>The script I'm executing is: <span style=3D"co=
lor: #0066FF;">$0</span></h3>=20

<h3>The output of 'java -version' is: </h3>
<=
span style=3D"color: #0066FF;">
<PRE>
$jver
<=
;/PRE>
</span>
<h3>The Perl binary I'm exec=
uting is at: <span style=3D"color: #0066FF;">$^X</span&g=
t;</h3>=20


</BODY>
</HTML>
END_HTML


exit;


 




 

 



 

On 6/5/07, mail_sendername">Kenneth Ölwing < xtLink(window,event,this)" href=3D"mailto:kenneth@olwing.se" target=3D"_bla=
nk">kenneth@olwing.se
> wrote:


px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">



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

CGI Error


The specified CGI application misbehaved by not returning a complete s=
et of HTTP headers
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,=20
e.g. the BEGIN is just a snippet of course, insert it into your original co=
de. Perhaps I misunderstand you completely...

ken1
 
blockquote>




------=_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@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--===============1170227680==--

Re: Absoulte path in Perl

am 05.06.2007 15:19:55 von ken1

This is a multi-part message in MIME format.
--===============2074852544==
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









cite="mid:68ab69220706050250k340f428h13cddbc51df9c479@mail.g mail.com"
type="cite">


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

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

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

RE: Absoulte path in Perl

am 05.06.2007 17:14:43 von Jan Dubois

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.

=20

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

=20

BEGIN {

return unless defined &PerlApp::exe;

my $exe =3D PerlApp::exe();

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

no warnings "redefine";

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

}

=20

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

=20

Cheers,

-Jan

=20

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).

=20

From: activeperl-bounces@listserv.ActiveState.com =
[mailto:activeperl-bounces@listserv.ActiveState.com] On Behalf Of Mothi =
Mehta
Sent: June 5, 2007 2:51 AM
To: Kenneth Ölwing
Cc: activeperl@listserv.activestate.com
Subject: Re: Absoulte path in Perl

=20

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

=20


CGI Error


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

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.



=20

On 6/5/07, Mothi Mehta wrote:=20

Hi,=20

=20

I have tried that :

=20

#!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`;
}=20
else=20
{
my $jrepath =3D "$FindBin::Bin/jre6/bin/java.exe";

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

print <


Absolute Path Sample Script Showing How To Get Absolute Path In =<br /> PERL And JavaVersion=20



The Absolute Path to this script is: #0066FF;">$FindBin::Bin


The script I'm executing is: #0066FF;">$0

=20

The output of 'java -version' is:




$jver


The Perl binary I'm executing is at: #0066FF;">$^X

=20



END_HTML

exit;

=20

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

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

=20

=20



=20

On 6/5/07, Kenneth Ölwing > wrote:=20





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

=20


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
=20

=20

=20


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

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">


charset=3Diso-8859-1">









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.



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'> 



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.



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'> 



style=3D'font-size:11.0pt;
font-family:"Courier New";color:black'>BEGIN {



style=3D'font-size:11.0pt;
font-family:"Courier New";color:black'>  =A0 return unless defined
&PerlApp::exe;



style=3D'font-size:11.0pt;
font-family:"Courier New";color:black'>  =A0 my $exe =3D =
PerlApp::exe();



style=3D'font-size:11.0pt;
font-family:"Courier New";color:black'>  =A0 $exe =3D~ =
s#^\\\\\?\\##;



style=3D'font-size:11.0pt;
font-family:"Courier New";color:black'>  =A0 no warnings =
"redefine";



style=3D'font-size:11.0pt;
font-family:"Courier New";color:black'>  =A0 *PerlApp::exe =3D sub { =
$exe };



style=3D'font-size:11.0pt;
font-family:"Courier New";color:black'>}



style=3D'font-size:11.0pt;
font-family:"Calibri","sans-serif";color:#1F497D'>  >



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.



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'> 



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>Cheers,



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'>-Jan



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'> 



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).



style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif" ;
color:#1F497D'> 



0cm 4.0pt'>



0cm 0cm 0cm'>

style=3D'font-size:10.0pt;font-family:"Tahoma","sans-serif"' >From:=
style=3D'font-size:10.0pt;font-family:"Tahoma","sans-serif"' >
activeperl-bounces@listserv.ActiveState.com
[mailto:activeperl-bounces@listserv.ActiveState.com] On Behalf Of =
Mothi
Mehta

Sent: June 5, 2007 2:51 AM

To: Kenneth Ölwing

Cc: activeperl@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
< href=3D"mailto:evergreenudaipur@gmail.com">evergreenudaipur@ 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)

       {

            &=
nbsp; 
$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 href=3D"http://localhost/mydemos/examples/perlscript/foo.pl' " =
target=3D"_blank">http://localhost/mydemos/examples/perlscri pt/foo.pl'







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







 







 











 







On 6/5/07, Kenneth =
Ölwing
< href=3D"mailto:kenneth@olwing.se" target=3D"_blank">kenneth@olwing.se =
>
wrote:





1.0pt;padding:0cm 0cm 0cm 6.0pt;
margin-left:4.8pt;margin-right:0cm'>











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


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

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

Re: Absoulte path in Perl

am 05.06.2007 21:52:38 von ken1

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







Jan Dubois wrote:







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.




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

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

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

RE: Absoulte path in Perl

am 05.06.2007 22:25:12 von Jan Dubois

Kenneth Ölwing 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@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Re: Absoulte path in Perl

am 06.06.2007 14:30:34 von Mothi Mehta

--===============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 wrote:
>
> Kenneth Ölwing 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

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

 

--Mohit

 



 

On 6/6/07, J=
an Dubois
<jand@activestate.=
com
> wrote:

px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Kenneth Ölwing 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 >>unn=
ecessary.
>
> Thanks Jan - what do you think about the issue at=
the heart of the
> problem? I.e. the reason to mangle $0 in the firs=
t place is that '-f'

> won't work with a \\?\ path - but shouldn't that be consid=
ered 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 c=
ode involved...)

> or should the OP do that?

No, Perl cannot support the \\?\ =
prefix right now. This prefix works
only with the "wide character&q=
uot; APIs, whereas Perl uses the ANSI APIs for
almost all file operation=
s [*]. Perl also uses fixed width buffers

throughout the code that could not accommodate longer filenames. This r>_may_ all be improved eventually, but not until Perl
5.12 at the earli=
est.

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


94a6d4be42143f">http://groups.google.com/group/perl.perl5.po rters/msg/d194a=
6d4be42143f


I believe that change was also prompted by IIS6 usin=
g 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 rep=
resented 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--

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

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