Supportnet / Forum / Skripte(PHP,ASP,Perl...)
Variable aus Script auslagern in Bibliothek
Frage
Ich möchte gerne Variablen, die unterschiedlich sind in der lokalen Testversion und der Internet-Version
auslagern.
1. Geht dies in HTML ?
2. In Perl habe ich es folgendermaßen versucht.
1. Script läuft korrekt:
#!c:apachefriendsxamppperlinperl.exe
##
use strict;
print "Content-type: text/html
";
my ($myurl);
$myurl = ´http://localhost/test´;
print(´<html><head></head><body><h1>Test js-Bibliothek</h1>´);
print(´<a href=´);
print("$myurl");
print(´/index.htm>Kontakt</a>´);
print(´</body></html>´);
2. Script (Auslagerung der beiden Statements
my ($myurl);
$myurl = ´http://localhost/test´;
in die Datei myurladr.js)
bringt Fehler:
#!c:apachefriendsxamppperlinperl.exe
##
use strict;
print "Content-type: text/html
";
<script language="JavaScript1.2" SRC="myurladr.js"></script>
print(´<html><head></head><body><h1>Test js-Bibliothek</h1>´);
print(´<a href=´);
print("$myurl");
print(´/index.htm>Kontakt</a>´);
print(´</body></html>´);
Inhalt von myurladr.js:
my ($myurl);
$myurl = ´http://localhost/test´;
Fehlermeldung im Log (die mir leider überhaupt nichts sagt):
Unmatched ( in regex; marked by <-- HERE in m/script>
print( <-- HERE ´<html><head></ at C:/apachefriends/xampp/htdocs/mycgi-bin/jslib2.pl line 8.

