Author |
|
Apalog
Joined: 19 Dec 2010 Posts: 4
|
Posted: Sun 19 Dec '10 14:35 Post subject: Apache under windows vista |
|
|
Please excuse my english - my german is much better.
I had installed xammp/apache on XP and now I installed in Vista with the following problem:
When I test my homepages (contact form) I get the message in the log:
Can't locate xxxx.pm in @inc (@inc contains: C:/xampp/perl.....).
I remember that in XP there was a Registry-Entry perl5lib.
So I added in Vista 7
perl5lib ....
to the Environment variables.
But it doesn't still work.
Do you have an idea how to get my private Perl-Library into the @inc?
(not dynamicly by push or other statements in the programs) |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Mon 20 Dec '10 11:31 Post subject: |
|
|
the solution that searches relative to the module directory:
Code: |
use FindBin; # locate this script
use lib "$FindBin::Bin/.."; # use the parent directory
use yourlib;
|
There's many other ways that search for libraries relative to the current directory. You can invoke perl with the -I argument, passing the directory of the other module:
Code: |
perl -I.. yourscript.pl
|
You can include a line near the top of your perl script:
You can modify the environment variable PERL5LIB before you run the script:
Code: |
export PERL5LIB=$PERL5LIB:..
|
The push(@INC) strategy can also work, but it has to be wrapped in BEGIN{} to make sure that the push is run before the module search:
Code: |
BEGIN {push @INC, '..'}
use yourlib;
|
Found within 30 seconds of googling |
|
Back to top |
|
Apalog
Joined: 19 Dec 2010 Posts: 4
|
Posted: Mon 20 Dec '10 13:13 Post subject: |
|
|
Hi,
I meant "not dynamicly by push or other statements in the programs" (and not in the call of the perl-program).
My module library should be allocated when Apache ist started, because I don't want to have different Versions of my cgi-programs (on my local PC and in the Internet).
I know that it worked in Windows XP with the perl5lib-statement. |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Mon 20 Dec '10 21:26 Post subject: |
|
|
Since when have you not had to at least use "use"?
use Foo::Bar
C:\Perl\site\lib\Foo
C:\Perl\site\lib\Foo\Bar.pm |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Mon 20 Dec '10 22:18 Post subject: |
|
|
The XAMPP standard config includes many uses in a startup script. That's why there is "no need for use" :p
e.g.
Code: |
PerlSwitches -T
PerlPostConfigRequire "/xampp/apache/conf/extra/startup.pl"
<IfModule mime_module>
AddType text/html .pl
</IfModule>
<FilesMatch "\.pl$">
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
PerlOptions +ParseHeaders
</FilesMatch>
<Directory "/xampp/cgi-bin">
<FilesMatch "\.pl$">
SetHandler cgi-script
</FilesMatch>
</Directory>
# ASP settings
Include "conf/extra/asp.conf"
|
startup.pl
Code: |
use ModPerl::Util ();
use Apache2::RequestRec ();
use Apache2::RequestIO ();
use Apache2::RequestUtil ();
use Apache2::ServerRec ();
use Apache2::ServerUtil ();
use Apache2::Connection ();
use Apache2::Log ();
use Apache2::Const -compile => ':common';
use APR::Const -compile => ':common';
use APR::Table ();
use Apache2::compat ();
use ModPerl::Registry ();
use CGI ();
use Apache::ASP ();
1;
|
asp.conf
Code: |
<IfModule perl_module>
<IfModule mime_module>
AddType text/html .asp
</IfModule>
<FilesMatch "\.asp$">
SetHandler perl-script
PerlResponseHandler Apache::ASP
PerlSetVar Global .
PerlSetVar StateDir "/xampp/tmp"
</FilesMatch>
<Directory "/xampp/cgi-bin">
<FilesMatch "\.asp$">
SetHandler cgi-script
</FilesMatch>
</Directory>
</IfModule>
|
|
|
Back to top |
|
Apalog
Joined: 19 Dec 2010 Posts: 4
|
Posted: Tue 21 Dec '10 10:49 Post subject: |
|
|
glsmith wrote: | Since when have you not had to at least use "use"?
use Foo::Bar
C:\Perl\site\lib\Foo
C:\Perl\site\lib\Foo\Bar.pm |
I use "use".
And in XP the modules where found. The lib was includesd in @INC. |
|
Back to top |
|
Apalog
Joined: 19 Dec 2010 Posts: 4
|
Posted: Tue 21 Dec '10 10:54 Post subject: |
|
|
James Blond wrote: | The XAMPP standard config includes many uses in a startup script. That's why there is "no need for use" :p
e.g.
Code: |
PerlSwitches -T
PerlPostConfigRequire "/xampp/apache/conf/extra/startup.pl"
<IfModule mime_module>
AddType text/html .pl
</IfModule>
.....
.....
|
|
Sorry but I don't understand the code you posted.
And I can't see any reference to PERL5LIB |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Wed 22 Dec '10 15:02 Post subject: |
|
|
Well you can put that export PERL5LIB=$PERL5LIB:.. into that startup.pl ...
I recommend to delcared all needed stuff in an include file for all your scripts. |
|
Back to top |
|