Schrift
[thread]5660[/thread]

Syntax-Error

Leser: 1


<< |< 1 2 3 4 >| >> 31 Einträge, 4 Seiten
SirLant
 2003-08-26 20:34
#80399 #80399
User since
2003-08-04
516 Artikel
BenutzerIn
[default_avatar]
Habe hier zwei Fehler in meiner Syntax, finde die aber beim besten willen nicht, vllt. könnt ihr mal nen Blick drauf werfen.
Ist in der nähe von Zeile 41 und 64

Code (perl): (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!e:/programme/perl/bin/perl.exe -w
#gb.cgi - Gästebuch

use strict;
use warnings;
use CGI qw %:standard escape escapeHTML%;
use CGI::Carp qw %fatalsToBrowser%;

my $datei = "gb.txt";
my @seite;
my $aktion = param ("aktion");

print "<html><head><title>Gästebuch</title></head><body>
"; 

if ($aktion eq "") {

        open(FH, "$datei") or die "Fehler beim oeffnen von $datei: $!";
        
        print "<table>";

        if (@seite) {
                for (@seite) {

                        next if $_ eq "####
";
        
                        print "<tr>$_</tr>";

                }
                print "</table><br>";
        }
        else {
        
                print "<h3>Noch keine Einträge vorhanden</h3>";
        
        
        close FH;
        
        print "<div align = \"center\"><a href = \"gb.cgi?aktion=eintrag\">Schreib mir!</a></div>";
        
}
elsif ($aktion eq "eintrag") {

        print "<table><form aktion = \"gb.cgi?aktion=new\" method = \"GET\">";
        print "<tr>";
        print "<td>Name</td>";
        print "<td><input type = \"text\" name = \"name\"></td></tr>";
        print "<tr>";
        print "<td>E-mail</td>";
        print "<td><input type = \"text\" name = \"email\"></td></tr>";
        print "<tr>";
        print "<td>Homepage</td>";
        print "<td><input type = \"text\" name = \"hompage\"></td></tr>";
        print "<tr>";
        print "<td>Wohnort</td>";
        print "<td><input type = \"text\" name = \"wohnort\"></td></tr>";
        print "<tr>";
        print "<td>Nachricht</td>";
        print "<td><textarea name = \"nachricht\"></textarea></td></tr>";
        print "<tr>";
        print "<td><input type = \"submit\" name = \"button\" value = \"eintragen\"></td></tr>";
        print "</table><br>";
        print "<a href = \"gb.cgi\">zurück</a>";

}
elsif ($aktion eq "new") {

        open(FH, "> $datei") or die "Fehler beim oeffnen von $datei: $!";
        
        print <FH> "<td>Name:</td><td>" . param ("name") . "</td>
":
        print <FH> "<td>E-Mail:</td><td>" . param ("email") . "</td>
";
        print <FH> "<td>Homepage:</td><td>" . param ("homepage") . "</td>
";
        print <FH> "<td>Wohnort:</td><td>" . param ("Wohnort") . "</td>
";
        print <FH> "<td>Nachricht:</td><td>" . param ("nachricht") . "</td>
";
        print <Fh> "<td rowspan = \"2\"><hr></td>";
        print <FH> "####
";
        
        close FH;
        
        open(FH, "$datei") or die "Fehler beim oeffnen von $datei: $!";
        
        print "<table>";

        while (<FH>) {

                next if $_ eq "####
";
        
                print "<tr>$_</tr>";

        }
        
        close FH;
        
        print "</table><br>";
        print "<a href = \"gb.cgi?aktion=new\">Schreib mir!</a>";
        
}
        
print "</body></html>";

exit 0;

Zeile 41 ist das elsif ($aktion eq "eintrag") {

und zeile 64 das } über elsif ($aktion eq "new") {


Das GB ist nur ne kleine Aktion aus langeweile, deshalb ist es so simpel :)\n\n

<!--EDIT|SirLant|1061915777-->
--Programming today is a race between Software Enginers striving to build bigger and better idiot-proof Programs,
and the Universe trying to produce bigger and better idiots.
So far, the Universe is winning!
format_c
 2003-08-26 20:39
#80400 #80400
User since
2003-08-04
1706 Artikel
HausmeisterIn
[Homepage] [default_avatar]
Fehlermeldung?

gruß Alex
renee
 2003-08-26 20:40
#80401 #80401
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
[quote=SirLant,26.08.2003, 18:34]
Code: (dl )
1
2
3
	
print <FH> "<td>Name:</td><td>" . param ("name") . "</td>
": # musss ein Semikolon hin!
[/quote]
Einen Fehler habe ich gefunden:\n\n

<!--EDIT|renee|1061916066-->
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/
esskar
 2003-08-26 20:41
#80402 #80402
User since
2003-08-04
7321 Artikel
ModeratorIn

user image
[edit]Mist war Käse[/edit]\n\n

<!--EDIT|esskar|1061916192-->
format_c
 2003-08-26 20:47
#80403 #80403
User since
2003-08-04
1706 Artikel
HausmeisterIn
[Homepage] [default_avatar]
Das letzte Zeiche einer Anweisung sollte wenn diese nicht zu lang ist, das ";" sein.
perldoc perlstyle

gruß Alex
SirLant
 2003-08-26 20:54
#80404 #80404
User since
2003-08-04
516 Artikel
BenutzerIn
[default_avatar]
Die Fehlermeldungen sind immernoch da.

syntax error at E:/WWW/cgi-bin/gb.cgi line 41, near "elsif"
syntax error at E:/WWW/cgi-bin/gb.cgi line 64, near "}"
--Programming today is a race between Software Enginers striving to build bigger and better idiot-proof Programs,
and the Universe trying to produce bigger and better idiots.
So far, the Universe is winning!
BrownWolf
 2003-08-26 21:21
#80405 #80405
User since
2003-08-15
308 Artikel
BenutzerIn
[default_avatar]
Warum nimmst du immer:

Code (perl): (dl )
print " ";


und nicht:

Code (perl): (dl )
1
2
3
4
5
6
7
8
print<<"EOT";
<html>
<head>
</head>
<body>
</body>
</html>
EOT


Ich find das so übersichtlicher...
Code (perl): ()
1
2
3
sub _{s;;xrqIpiql\\{}p{pl{R>rl{N{}gjwpkssq]>rl{N;;;*{{}=*{_};;
&#36{{}={q{{{}}}=>[reverse+split+reverse+q;}{;]};&#36{{}->{q{{{}}}}->[@{{}];}
&#36{{}=reverse+_(q{{}}=>q{{}})^chr(30)x+length&_(q{{}}=>,q{{}})and+print;
pq
 2003-08-26 21:25
#80406 #80406
User since
2003-08-04
12208 Artikel
Admin1
[Homepage]
user image
nach else darf kein elsif kommen.
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
BrownWolf
 2003-08-26 21:27
#80407 #80407
User since
2003-08-15
308 Artikel
BenutzerIn
[default_avatar]
Code (perl): (dl )
1
2
print <FH> "<td>Name:</td><td>" . param ("name") . "</td>
":


Nach print normal kein Doppelpunkt :)
Code (perl): ()
1
2
3
sub _{s;;xrqIpiql\\{}p{pl{R>rl{N{}gjwpkssq]>rl{N;;;*{{}=*{_};;
&#36{{}={q{{{}}}=>[reverse+split+reverse+q;}{;]};&#36{{}->{q{{{}}}}->[@{{}];}
&#36{{}=reverse+_(q{{}}=>q{{}})^chr(30)x+length&_(q{{}}=>,q{{}})and+print;
SirLant
 2003-08-26 21:36
#80408 #80408
User since
2003-08-04
516 Artikel
BenutzerIn
[default_avatar]
*hand an stirn*
Danke :)

Und den Doppelpunkt haben wir schon entdeckt und behoben :9
--Programming today is a race between Software Enginers striving to build bigger and better idiot-proof Programs,
and the Universe trying to produce bigger and better idiots.
So far, the Universe is winning!
<< |< 1 2 3 4 >| >> 31 Einträge, 4 Seiten



View all threads created 2003-08-26 20:34.