$Bill wrote:
>
> Create a small complete snippet that reproduces your problem so we have an
> easy way to reproduce it.
>
Ok... I have tried to remove as much excess stuff from the main program so
that it still produces the same error.
I end up with:
##########################
#!/usr/bin/perl -w -I.
use WURFLLite;
use vars qw($dbm $file_date $file_exists $ua %ua_found $WURFL $WURFLdb);
eval {
BEGIN { @AnyDBM_File::ISA = qw(DB_File GDBM_File SDBM_File) }; # look at
www.cpan.org for the latest versions
use AnyDBM_File;
# use MLDBM qw(AnyDBM_File); # look at www.cpan.org for the latest version
use MLDBM qw(AnyDBM_File Storable); # Storable is much faster than
Data::Dumper
# It takes about 70 seconds on my 1 GHz to store the WURFL XML file in a
DB_File
# database using Data::Dumper.
use Fcntl qw(:DEFAULT :flock);
};
if ($@){
$dbm = 0;
}
else {
$dbm = 1;
}
$WURFL = './wurfl.xml'; # location of the WURFL XML file
$WURFLdb = './my-wurfl.db'; # location of the local WURFL database
my %wurfl_parsed;
if ($dbm) {
my (%WURFLdb);
unless (tie(%WURFLdb, 'MLDBM', $WURFLdb, O_RDWR|O_CREAT, 0666)){
print("Cannot open or create the local WURFL database!\n");
}
open(IN, "<$WURFL") || die("Can't open WURFL XML file $WURFL: $!.");
my $content;
while (<IN>) {
$content .= $_;
}
parseXML(\%wurfl_parsed, \$content);
my $time = time();
%WURFLdb = %wurfl_parsed;
print "It took ", time() - $time, " seconds to store the hash in the
database.\n";
$WURFLdb{'file_date'} = $file_date;
}
untie %WURFLdb;
############################
Without WURFLite.pm or the wurfl.xml is this enough at least to see what
might be happening even if it can't be run?
Taking on board and looking into the input by yourself and Dr Ruud
especially regarding the problems with SDBM I am wondering if I can fix it
quickly by changing the type of DBM it uses.
Am I right in thinking it chooses out of DB_File or GDBM_File or SDBM_File
options depending on what is available?
If so is it that the preferred DB_File isn't available on my windows box and
so ends up using the SDBM_File which has the truncation problem?
If I am not barking up entirely the wrong tree then a pointer on how to get
DB_File working would be a help. If I am talking nonsense then if someone
could put me on the right track that would be great. I would appreciate it
if someone could help me understand what is happening with the BEGIN and use
statements in the eval:
eval {
BEGIN { @AnyDBM_File::ISA = qw(DB_File GDBM_File SDBM_File) }; # look at
www.cpan.org for the latest versions
use AnyDBM_File;
# use MLDBM qw(AnyDBM_File); # look at www.cpan.org for the latest version
use MLDBM qw(AnyDBM_File Storable); # Storable is much faster than
Data::Dumper
# It takes about 70 seconds on my 1 GHz to store the WURFL XML file in a
DB_File
# database using Data::Dumper.
use Fcntl qw(:DEFAULT :flock);
};
Thanks
Mark
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs