Leser: 1
![]() |
|< 1 2 >| | ![]() |
14 Einträge, 2 Seiten |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/perl -w
use strict;
BEGIN {
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
warningsToBrowser(1);
}
use FindBin qw($Bin);
FindBin->again();
print "Content-type: text/html\n\n";
print <<HTML;
<html>
<head>
<title>Home</title>
<link rel="StyleSheet" type="text/css" href="../style.css">
</head>
<body>
HTML
do "$Bin/time.cgi";
# htmlcode
do "$Bin/menu.cgi";
print <<HTML;
# htmlcode
</body>
</html>
HTML
QuoteKNOWN ISSUES
If there are two modules using FindBin from different directories under the same interpreter, this won't work. Since FindBin uses a BEGIN block, it'll be executed only once, and only the first caller will get it right. This is a problem under mod_perl and other persistent Perl environments, where you shouldn't use this module. Which also means that you should avoid using FindBin in modules that you plan to put on CPAN. To make sure that FindBin will work is to call the again function:
use FindBin;
FindBin::again(); # or FindBin->again;
In former versions of FindBin there was no again function. The workaround was to force the BEGIN block to be executed again:
delete $INC{'FindBin.pm'};
require FindBin;
![]() |
|< 1 2 >| | ![]() |
14 Einträge, 2 Seiten |