dbTalk Databases Forums  

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

mailing.database.msql-mysql-modules mailing.database.msql-mysql-modules


Discuss error of "use lib qw(...) ;"? in the mailing.database.msql-mysql-modules forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Xu, Qiang
 
Posts: n/a

Default error of "use lib qw(...) ;"? - 08-06-2003 , 09:38 PM






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=ms...ie.nctu.edu.tw


Reply With Quote
  #2  
Old   
Jim Cromie
 
Posts: n/a

Default Re: error of "use lib qw(...) ;"? - 08-07-2003 , 11:50 AM






Xu, Qiang (XSSC SGP) wrote:

Quote:
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=ms...ie.nctu.edu.tw



Reply With Quote
  #3  
Old   
Xu, Qiang
 
Posts: n/a

Default RE: error of "use lib qw(...) ;"? - 08-08-2003 , 04:15 AM



Hans van Harten wrote:
Quote:
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_FIL ENAME'},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=ms...ie.nctu.edu.tw



Reply With Quote
  #4  
Old   
Hans van Harten
 
Posts: n/a

Default Re: error of "use lib qw(...) ;"? - 08-08-2003 , 04:51 AM



Xu, Qiang (XSSC SGP) wrote:
Quote:
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_FIL ENAME'},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.

Quote:
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=ms...ie.nctu.edu.tw



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.