Schrift
Wiki:Tipp zum Debugging: use Data::Dumper; local $Data::Dumper::Useqq = 1; print Dumper \@var;
[thread]5282[/thread]

Was ist hier falsch?: Skript funktioniert nicht



<< >> 6 Einträge, 1 Seite
Gast Gast
 2007-01-19 11:06
#46136 #46136
Hallo,
ich habe ein Skript geschrieben. Dieses funktioniert aber nicht, aber ich konnte bei fünfmaligem Lesen keinen Fehler entdecken:
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/perl

use Tk;

@namen = ( "Allgemein", "Zeitung" );
@orte = ( "E:\\Eigene Dateien\\Programme\\Scrutator\\img\\minilupe.gif", "E:\\Eigene Dateien\\Programme\\Scrutator\\img\\zeitung.gif" );

my $top = MainWindow -> new(-background => 'black', -height => '768', -width => '1024');
$top -> title('Scrutator');

# Navigationsframe
my $navi = $top -> Frame (-background => 'black');
$navi -> place(-x=>'3p', -y => '3p');

# Erster Button - Lupe
my $lupe = $navi->Photo(-file => 'E:\\Eigene Dateien\\Programme\\Scrutator\\img\\lupe.gif');
$navi->Button(-image => $lupe, -relief=>'flat', -background => 'black', -activebackground => 'red')->grid(-row=>'0', -column=>'0');

# Zweiter Button - Ordner
my $ordner = $navi->Photo(-file => 'E:\\Eigene Dateien\\Programme\\Scrutator\\img\\ordner.gif');
$navi->Button(-image => $ordner, -relief=>'flat', -background => 'black', -activebackground => 'red')->grid(-row=>'1', -column=>'0');

# Profilframe
my $profilframe = $top -> Frame (-background => 'sky blue', -height => '249p', -width => '250p');
$profilframe -> place(-x=>'3p', -y => '140p');

# Profilframe
my $profilframe = $top -> Frame (-background => 'sky blue', -height => '249p', -width => '250p');
$profilframe -> place(-x=>'3p', -y => '140p');

# Profiltext

# Bilder definieren
my $allgemein = $profilframe->Photo(-file => $orte[0]);
my $zeitung = $profilframe->Photo(-file => $orte[1]);

# Überschrift
$profilframe->Label( -text=>"Meine Profile", -background => 'sky blue', -font=>'{Bimini} 14 {bold}' )->place(-x=>'5');

# Allgemein
$profilframe->Label( -image => $allgemein, -background => 'sky blue' )->place(-x=>'5', -y => '50');
$profilframe->Button( -text=>$namen[0], -background => 'sky blue', -font=>'{Bimini} 12 {bold}', -relief=>'flat', -activebackground => 'yellow' )->place(-x=>'28p', -y => '50');

# Zeitung
$profilframe->Label( -image => $zeitung, -background => 'sky blue' )->place(-x=>'5', -y => '85');
$profilframe->Button(-text=>$namen[1], -background => 'sky blue', -font=>'{Bimini} 12 {bold}', -relief=>'flat', -activebackground => 'yellow' )->place(-x=>'28p', -y => '85');

MainLoop;


Gruß

DHK
GoodFella
 2007-01-19 11:25
#46137 #46137
User since
2007-01-09
192 Artikel
BenutzerIn
[default_avatar]
Fürs nächste Mal: Fehlermeldung dazuschreiben.

Habe ein paar Zeilen auskommentiert / gestestet, bis ich die Fehlermeldung eleminiert hatte;
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
#!/usr/bin/perl -w
use strict;

use Tk;

my @namen = ( "Allgemein", "Zeitung" );
#my @orte = ( "E:\\Eigene Dateien\\Programme\\Scrutator\\img\\minilupe.gif", "E:\\Eigene Dateien\\Programme\\Scrutator\\img\\zeitung.gif" );

my $top = MainWindow -> new(-background => 'black', -height => '768', -width => '1024');
$top -> title('Scrutator');

# Navigationsframe
my $navi = $top -> Frame (-background => 'black');
$navi -> place(-x=>'3p', -y => '3p');

# Erster Button - Lupe
my $lupe = $navi->Photo(-file => 'c:\test.gif');
#my $lupe = $navi->Photo(-file => 'E:\\Eigene Dateien\\Programme\\Scrutator\\img\\lupe.gif');
$navi->Button(-image => $lupe, -relief=>'flat', -background => 'black', -activebackground => 'red')->grid(-row=>'0', -column=>'0');

# Zweiter Button - Ordner
#my $ordner = $navi->Photo(-file => 'E:\\Eigene Dateien\\Programme\\Scrutator\\img\\ordner.gif');
#$navi->Button(-image => $ordner, -relief=>'flat', -background => 'black', -activebackground => 'red')->grid(-row=>'1', -column=>'0');

# Profilframe
my $profilframe = $top -> Frame (-background => 'sky blue', -height => '249p', -width => '250p');
$profilframe -> place(-x=>'3p', -y => '140p');

# Profilframe
my $profilframe = $top -> Frame (-background => 'sky blue', -height => '249p', -width => '250p');
$profilframe -> place(-x=>'3p', -y => '140p');

# Profiltext

# Bilder definieren
#my $allgemein = $profilframe->Photo(-file => $orte[0]);
#my $zeitung = $profilframe->Photo(-file => $orte[1]);

# Überschrift
$profilframe->Label( -text=>"Meine Profile", -background => 'sky blue', -font=>'{Bimini} 14 {bold}' )->place(-x=>'5');

# Allgemein
#$profilframe->Label( -image => $allgemein, -background => 'sky blue' )->place(-x=>'5', -y => '50');
#$profilframe->Button( -text=>$namen[0], -background => 'sky blue', -font=>'{Bimini} 12 {bold}', -relief=>'flat', -activebackground => 'yellow' )->place(-x=>'28p', -y => '50');

# Zeitung
#$profilframe->Label( -image => $zeitung, -background => 'sky blue' )->place(-x=>'5', -y => '85');
$profilframe->Button(-text=>$namen[1], -background => 'sky blue', -font=>'{Bimini} 12 {bold}', -relief=>'flat', -activebackground => 'yellow' )->place(-x=>'28p', -y => '85');

MainLoop;


So funktioniert das bei mir. Liegt wohl an deiner Bilddatei.
[edit] sehe gerade, dass du innerhalb einfacher Anführungszeichen escapst, das wird wohl der Fehler gewesen sein.\n\n

<!--EDIT|GoodFella|1169198817-->
renee
 2007-01-19 11:46
#46138 #46138
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Und vor allen Wiki:[tt]use strict[/tt] und use warnings verwenden...
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/
TheDHK
 2007-01-19 15:14
#46139 #46139
User since
2007-01-19
37 Artikel
BenutzerIn
[default_avatar]
[quote=GoodFella,19.01.2007, 10:25]So funktioniert das bei mir. Liegt wohl an deiner Bilddatei.
[edit] sehe gerade, dass du innerhalb einfacher Anführungszeichen escapst, das wird wohl der Fehler gewesen sein.[/quote]
Ich habe jetzt die Backslashes innerhalb der einfachen Anführungszeichen entfernt, es funktioniert immer noch nicht. Wie kann ich mir denn eine Fehlermeldung anzeigen lassen (wie starte ich das Programm von der Shell aus?).

Gruß

TheDHK

PS: Ich hab mal dein Skript kopiert, GoodFella, und den Pfad 'c:\test.gif' angepasst. Funktioniert trotzdem nicht. Achja, wie kann ich Perl-Code einfügen, sodass er so formatiert angezeigt wird wie bei dir, GoodFella?
GoodFella
 2007-01-19 17:07
#46140 #46140
User since
2007-01-09
192 Artikel
BenutzerIn
[default_avatar]
Ähh.. wie startest du dein Programm denn momentan? O_o
Wenn du auf Win bist, dann start->ausführen-> cmd eingeben .. ins gewüschte Vrz wechseln und perl script.pl eingeben.

PerlCode formatieren geht mit [ perl ] .. [ /perl ] (ohne die Spaces)


Ich habe zum testen in google bildersuche "test.gif" eingegeben, irgendeins ausgewählt und in C:\ kopiert, vielleicht solltest du das auch machen.\n\n

<!--EDIT|GoodFella|1169219354-->
TheDHK
 2007-01-19 17:14
#46141 #46141
User since
2007-01-19
37 Artikel
BenutzerIn
[default_avatar]
Hi,
es funktioniert jetzt. Ich musste das Programm nur umbennen (ka warum). Jedenfalls geht es jetzt. Vielen Dank für eure schnelle und kompetente Hilfe.

Gruß

TheDHK
<< >> 6 Einträge, 1 Seite



View all threads created 2007-01-19 11:06.