Hallo Leute,
folgendes Problem drückt meinen Schuh. XAMPP frisch und aktuell unter WinXP installiert. Ich muss an GDBM Dateien rankommen und diese am besten in SQL Dateien parsen. Ich habe allerdings massive Probleme erstmal überhaupt an diese GDBM Dateien ranzukommen. Hier mal mein Quellcode (diese Beispiel soll nur mal GDBM Dateien schreiben, damit ich sehe das das GDBM Modul überhaupt tut):
#!C:/apachefriends/xampp/perl/bin/perl.exe -w
#Libs
use strict;
use GDBM_File;
#Variables
my $dbfile = "c:/test/file.db";
#User Printout
print "Content-Type: text/html\n\n";
print "<html><body>";
print "Perl OK<br>";
print "DB File: $dbfile";
#Write a GDBM File
my %h;
tie %h, 'GDBM_File', $dbfile, &GDBM_WRCREAT, 0640;
$h{'Key1'} = "value1";
$h{'Key2'} = "value2";
$h{'Key3'} = "value3";
untie %h;
#User Printout
print "<br>GDBM File done";
print "</body></html>";
Wie man sieht verwende ich den XAMPP unter Windows. Soweit alles okay. Doch wenn ich das Script ausführen will, bricht die Leistung weg und nix passiert??! Wo mach ich denn bitte was falsch??? Bin echt am verzweifeln!
Im Apache Error Log steht folgender Fehler, was wiederum daruf schließen lässt, daß das GDBM Modul doch nicht richtig eingebunden ist:
Premature end of script headers: gdbm.pl
[Mon Jan 24 18:41:21 2005] [error] [client 127.0.0.1] Can't locate loadable object for module GDBM_File in @INC (@INC contains: C:/apachefriends/xampp/perl/lib C:/apachefriends/xampp/perl/site/lib .) at C:/apachefriends/xampp/cgi-bin/gdbm.pl line 5\r
[Mon Jan 24 18:41:21 2005] [error] [client 127.0.0.1] Compilation failed in require at C:/apachefriends/xampp/cgi-bin/gdbm.pl line 5.\r
[Mon Jan 24 18:41:21 2005] [error] [client 127.0.0.1] BEGIN failed--compilation aborted at C:/apachefriends/xampp/cgi-bin/gdbm.pl line 5.\r
[Mon Jan 24 18:41:21 2005] [error] [client 127.0.0.1] File does not exist: C:/apachefriends/xampp/htdocs/favicon.ico
Wenn ich jetzt noch das Perlscript auf der Konsole ausführe so meldet mir der Interpreter folgendes:
syntax error in file gdbm.pl at line 4, next 2 tokens "use strict"
Illegal modulus of constant zero in file gdbm.pl at line 17, next 2 tokens "h;"
Illegal modulus of constant zero in file gdbm.pl at line 18, next 2 tokens "h,"
Illegal modulus of constant zero in file gdbm.pl at line 24, next 2 tokens "h;"
Execution of gdbm.pl aborted due to compilation errors.
Okay, anscheinend vermisst er doch das GDBM Modul, aber warum stört er sich denn bitte an dem use strict??? Ist ja wohl eine sehr elementare Anweisung!
Ach ja, habe das Package, also gdbm_file.pm in das LIB Verzeichniss von Perl, bei mir also C:\apachefriends\xampp\perl\lib\, und im Auto Verzeichniss innerhalb des Perl Interpreters noch ein Verzeichniss C:\apachefriends\xampp\perl\lib\auto\gdbm_file\ mit den drei Dateien autosplit.ix - gdbm_file.bs -gdbm_file.so
Hier noch ein Link zum CPAN GDBM Package