error of "use lib qw(...) ;"?

error of "use lib qw(...) ;"?

am 07.08.2003 04:30:51 von Xu.Qiang

Hi, all:

My perl script is as follows (I name it as "intro4.pl"):

#!d:/perl/bin/perl -w
# select-user.pl - use current user's option file to connect
use strict;
use CGI qw(:standard);
use lib qw(/apachee-lib/perl);
use WebDB;
my($dbh, $user);
#$dbh = WebDB::connect();
$dbh = WebDB::connect_with_option_file();
$user = $dbh->selectrow_array ("SELECT USER()");
print header(), start_html("Select User");
print p("You connected as $user\n");
print end_html();
$dbh->disconnect();
exit(0);


I have put the package WebDB.pm into the folder D:\Apache
Group\Apache\htdocs\apachee-lib\perl\, where my Apache server root is
D:\Apache Group\Apache\htdocs\.


But I always get the following error when running this script through web:

[Wed Aug 06 18:41:11 2003] [error] [client 12.345.67.890] Premature end of
script headers: d:/apache group/apache/cgi-bin/mysql/intro4.pl
[Wed Aug 06 18:41:11 2003] [error] [client 12.345.67.890] Can't locate
WebDB.pm in @INC (@INC contains: /apachee-lib/perl/ d:/Perl/lib
d:/Perl/site/lib .) at d:\APACHE~1\apache\cgi-bin\mysql\intro4.pl line 7.

[Wed Aug 06 18:41:11 2003] [error] [client 12.345.67.890] BEGIN
failed--compilation aborted at d:\APACHE~1\apache\cgi-bin\mysql\intro4.pl
line 7.

Why it still can't find the package WebDB.pm, although I have set the
searching path for that package?


any suggestion is welcome,

thanks,

Regards,
Xu Qiang

--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: error of "use lib qw(...) ;"?

am 07.08.2003 18:51:48 von Jim Cromie

Xu, Qiang (XSSC SGP) wrote:

>Hi, all:
>
>My perl script is as follows (I name it as "intro4.pl"):
>
>#!d:/perl/bin/perl -w
># select-user.pl - use current user's option file to connect
>use strict;
>use CGI qw(:standard);
>use lib qw(/apachee-lib/perl);
>

could the problem be apachee-lib vs apache-lib ???



--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: error of "use lib qw(...) ;"?

am 07.08.2003 18:51:48 von Jim Cromie

Xu, Qiang (XSSC SGP) wrote:

>Hi, all:
>
>My perl script is as follows (I name it as "intro4.pl"):
>
>#!d:/perl/bin/perl -w
># select-user.pl - use current user's option file to connect
>use strict;
>use CGI qw(:standard);
>use lib qw(/apachee-lib/perl);
>

could the problem be apachee-lib vs apache-lib ???



--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

RE: error of "use lib qw(...) ;"?

am 08.08.2003 04:34:47 von Xu.Qiang

Jim Cromie wrote:
> Xu, Qiang (XSSC SGP) wrote:
>
>> Hi, all:
>>
>> My perl script is as follows (I name it as "intro4.pl"):
>>
>> #!d:/perl/bin/perl -w
>> # select-user.pl - use current user's option file to connect use
>> strict; use CGI qw(:standard);
>> use lib qw(/apachee-lib/perl);
>>
>
> could the problem be apachee-lib vs apache-lib ???

No, it is not the reason. thank,

Regards,
Xu Qiang

--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

RE: error of "use lib qw(...) ;"?

am 08.08.2003 04:34:47 von Xu.Qiang

Jim Cromie wrote:
> Xu, Qiang (XSSC SGP) wrote:
>
>> Hi, all:
>>
>> My perl script is as follows (I name it as "intro4.pl"):
>>
>> #!d:/perl/bin/perl -w
>> # select-user.pl - use current user's option file to connect use
>> strict; use CGI qw(:standard);
>> use lib qw(/apachee-lib/perl);
>>
>
> could the problem be apachee-lib vs apache-lib ???

No, it is not the reason. thank,

Regards,
Xu Qiang

--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: error of "use lib qw(...) ;"?

am 08.08.2003 11:03:27 von Hans van Harten

Xu, Qiang (XSSC SGP) wrote:
> #!d:/perl/bin/perl -w
> # select-user.pl - use current user's option file to connect
> use strict;
> use CGI qw(:standard);
> use lib qw(/apachee-lib/perl);
As Perl runs without knowledge of Apache's configuaration you must specify
full path:
use lib "D:/Apache Group/Apache/htdocs/apachee-lib/perl/";
.... qw-style is bound to fail on the space, so it's manually quoted...

or silently adapt cross-server|OS to the point of installation:

eval{$ENV{'DOCUMENT_ROOT'}=substr($ENV{'SCRIPT_FILENAME'},0, length($ENV{'SCR
IPT_FILENAME'})-length($ENV{'SCRIPT_NAME'}))}; #only needed using vhosts
use lib "$ENV{'DOCUMENT_ROOT'}/apachee-lib/perl/";


HansH


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: error of "use lib qw(...) ;"?

am 08.08.2003 11:03:27 von Hans van Harten

Xu, Qiang (XSSC SGP) wrote:
> #!d:/perl/bin/perl -w
> # select-user.pl - use current user's option file to connect
> use strict;
> use CGI qw(:standard);
> use lib qw(/apachee-lib/perl);
As Perl runs without knowledge of Apache's configuaration you must specify
full path:
use lib "D:/Apache Group/Apache/htdocs/apachee-lib/perl/";
.... qw-style is bound to fail on the space, so it's manually quoted...

or silently adapt cross-server|OS to the point of installation:

eval{$ENV{'DOCUMENT_ROOT'}=substr($ENV{'SCRIPT_FILENAME'},0, length($ENV{'SCR
IPT_FILENAME'})-length($ENV{'SCRIPT_NAME'}))}; #only needed using vhosts
use lib "$ENV{'DOCUMENT_ROOT'}/apachee-lib/perl/";


HansH


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

RE: error of "use lib qw(...) ;"?

am 08.08.2003 11:08:44 von Xu.Qiang

Hans van Harten wrote:
> Xu, Qiang (XSSC SGP) wrote:
>> #!d:/perl/bin/perl -w
>> # select-user.pl - use current user's option file to connect use
>> strict; use CGI qw(:standard);
>> use lib qw(/apachee-lib/perl);
> As Perl runs without knowledge of Apache's configuaration you must
> specify full path:
> use lib "D:/Apache Group/Apache/htdocs/apachee-lib/perl/";
> ... qw-style is bound to fail on the space, so it's manually quoted...
>
> or silently adapt cross-server|OS to the point of installation:
>
>
eval{$ENV{'DOCUMENT_ROOT'}=substr($ENV{'SCRIPT_FILENAME'},0, length($ENV{'SCR
> IPT_FILENAME'})-length($ENV{'SCRIPT_NAME'}))}; #only needed using
> vhosts use lib "$ENV{'DOCUMENT_ROOT'}/apachee-lib/perl/";

Thanks for your pointing out this space character's effect in qw().
But I wonder why it can't go to the folder according to the alias in
http.conf, while the alias can be recognized in the mainbody of the script?

Regards,
Xu Qiang

--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

RE: error of "use lib qw(...) ;"?

am 08.08.2003 11:08:44 von Xu.Qiang

Hans van Harten wrote:
> Xu, Qiang (XSSC SGP) wrote:
>> #!d:/perl/bin/perl -w
>> # select-user.pl - use current user's option file to connect use
>> strict; use CGI qw(:standard);
>> use lib qw(/apachee-lib/perl);
> As Perl runs without knowledge of Apache's configuaration you must
> specify full path:
> use lib "D:/Apache Group/Apache/htdocs/apachee-lib/perl/";
> ... qw-style is bound to fail on the space, so it's manually quoted...
>
> or silently adapt cross-server|OS to the point of installation:
>
>
eval{$ENV{'DOCUMENT_ROOT'}=substr($ENV{'SCRIPT_FILENAME'},0, length($ENV{'SCR
> IPT_FILENAME'})-length($ENV{'SCRIPT_NAME'}))}; #only needed using
> vhosts use lib "$ENV{'DOCUMENT_ROOT'}/apachee-lib/perl/";

Thanks for your pointing out this space character's effect in qw().
But I wonder why it can't go to the folder according to the alias in
http.conf, while the alias can be recognized in the mainbody of the script?

Regards,
Xu Qiang

--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: error of "use lib qw(...) ;"?

am 08.08.2003 11:50:18 von Hans van Harten

Xu, Qiang (XSSC SGP) wrote:
> Hans van Harten wrote:
>> Xu, Qiang (XSSC SGP) wrote:
>>> #!d:/perl/bin/perl -w
>>> # select-user.pl - use current user's option file to connect use
>>> strict; use CGI qw(:standard);
>>> use lib qw(/apachee-lib/perl);
>> As Perl runs without knowledge of Apache's configuaration you must
>> specify full path:
>> use lib "D:/Apache Group/Apache/htdocs/apachee-lib/perl/";
>> ... qw-style is bound to fail on the space, so it's manually
>> quoted...
>> or silently adapt cross-server|OS to the point of installation:
>> eval{$ENV{'DOCUMENT_ROOT'}=substr($ENV{'SCRIPT_FILENAME'},0,
>> length($ENV{'SCRIPT_FILENAME'})-length($ENV{'SCRIPT_NAME'})) };
>> #only needed using vhosts
>>use lib "$ENV{'DOCUMENT_ROOT'}/apachee-lib/perl/";
>
> Thanks for your pointing out this space character's effect in qw().
> But I wonder why it can't go to the folder according to the alias in
> http.conf,
Perl.exe does not know about httpd.conf and thus will not read it.

> while the alias can be recognized in the mainbody of the script?
Assuming you refer to $ENV{'DOCUMENT_ROOT'}, that's just an enviroment
variable, alike among others PATH and USERNAME. Try 'set' within a
CMD-window to view them all; from within a Perl script these and more are
available through a single hash %ENV.
As it is Apache starting Perl for you, Apache just parses some information
to Perl, it's for you to let your script pick it up.

HansH


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org

Re: error of "use lib qw(...) ;"?

am 08.08.2003 11:50:18 von Hans van Harten

Xu, Qiang (XSSC SGP) wrote:
> Hans van Harten wrote:
>> Xu, Qiang (XSSC SGP) wrote:
>>> #!d:/perl/bin/perl -w
>>> # select-user.pl - use current user's option file to connect use
>>> strict; use CGI qw(:standard);
>>> use lib qw(/apachee-lib/perl);
>> As Perl runs without knowledge of Apache's configuaration you must
>> specify full path:
>> use lib "D:/Apache Group/Apache/htdocs/apachee-lib/perl/";
>> ... qw-style is bound to fail on the space, so it's manually
>> quoted...
>> or silently adapt cross-server|OS to the point of installation:
>> eval{$ENV{'DOCUMENT_ROOT'}=substr($ENV{'SCRIPT_FILENAME'},0,
>> length($ENV{'SCRIPT_FILENAME'})-length($ENV{'SCRIPT_NAME'})) };
>> #only needed using vhosts
>>use lib "$ENV{'DOCUMENT_ROOT'}/apachee-lib/perl/";
>
> Thanks for your pointing out this space character's effect in qw().
> But I wonder why it can't go to the folder according to the alias in
> http.conf,
Perl.exe does not know about httpd.conf and thus will not read it.

> while the alias can be recognized in the mainbody of the script?
Assuming you refer to $ENV{'DOCUMENT_ROOT'}, that's just an enviroment
variable, alike among others PATH and USERNAME. Try 'set' within a
CMD-window to view them all; from within a Perl script these and more are
available through a single hash %ENV.
As it is Apache starting Perl for you, Apache just parses some information
to Perl, it's for you to let your script pick it up.

HansH


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=gcdmp-msql-mysql-modules@m .gmane.org