Schrift
[thread]3221[/thread]

do-anweisungen werden nicht ausgeführt (Seite 2)

Leser: 1


<< |< 1 2 >| >> 14 Einträge, 2 Seiten
pq
 2006-12-06 10:35
#30252 #30252
User since
2003-08-04
12209 Artikel
Admin1
[Homepage]
user image
[quote=ptk,05.12.2006, 23:03]Der Beispielcode sieht eigentlich auch nicht aus wie mod_perl, eher wie ein normales cgi.[/quote]
naja, der OP sagte ja, mod_perl. also vermutlich Apache::Registry.
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. -- Damian Conway in "Perl Best Practices"
lesen: Wiki:Wie frage ich & perlintro Wiki:brian's Leitfaden für jedes Perl-Problem
.mike.
 2006-12-08 22:55
#30253 #30253
User since
2006-04-07
26 Artikel
BenutzerIn
[default_avatar]
ok
danke für die hilfe es geht jetzt
aber ich muss FindBin benutzen und ein FindBin->again(); machen

wens intressiert:
Code: (dl )
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
GwenDragon
 2006-12-09 13:04
#30254 #30254
User since
2005-01-17
14848 Artikel
Admin1
[Homepage]
user image
Unter http://search.cpan.org/~nwclark/perl-5.8.8/lib/FindBin.pm#KNOWN_ISSUES steht explizit, das FindBin nicht richtig unter mod_perl läuft:
Quote
KNOWN 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;
ptk
 2006-12-09 14:44
#30255 #30255
User since
2003-11-28
3645 Artikel
ModeratorIn
[default_avatar]
Wenn $0 richtig gesetzt wird (das macht beispielsweise Apache::Registry) und FindBin->again aufgerufen wird, dann funktioniert es auch unter mod_perl.
<< |< 1 2 >| >> 14 Einträge, 2 Seiten



View all threads created 2006-12-04 16:40.