Re: file.db VS filedb
- From: Jenda@xxxxxxxxxxx (Jenda Krynicky)
- Date: Tue, 29 Jan 2008 01:56:25 +0100
From: MK <halfcountplus@xxxxxxxxxxxxx>
when i "use DB_File" the files produced lack a dot in their title, eg.
dbmopen %email, email.db, 0666;
manipulates a file who's directory entry is actually emaildb
If you do
use strict;
use warnings;
as you should it does not. It reports an error. And apparently
rightly so.
MORE IMPORTANTLY, perl will not access a database outside of the same
directory as the script -- it pulls a blank hash. without being able
to include any functional path in the filenames, i can't even call the
script with a soft link...i have to use a shell script to cd first
that is ridiculous and i presume a bug that may have been fixed
somewhere?
If you want to include a string literal in your script enclose it in
quotes. In this case it doesn't matter whether you use single or
double quotes:
dbmopen %email, 'email.db', 0666;
or
dbmopen %email, "email.db", 0666;
What happened was that Perl assumed that you want to join (the dot
operator) two unquoted words ... without 'use strict' you are allowed
to omit quotes around words like this:
$variable = Hello;
but you should NEVER EVER do that. The catch is that there is no
telling whether that should assign to the $variable the string
"Hello" or the results of calling the Hello subroutine. What it does
depends on the existence of such subroutine.
The next problem is that
use DB_File;
and
dbmopen ...
are not related at all. There is an old interface to one (hard to say
which) DBM file format via the builtin dbmopen function and there are
several different modules for different formats of on-disk-hashes
with their own interfaces. If you read the documentation of DB_File,
you could see that the way to tie a hash to a DB_File compatible file
is definitely not dbmopen().
Jenda
===== Jenda@xxxxxxxxxxx === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery
.
- Follow-Ups:
- Re: file.db VS filedb
- From: Gunnar Hjalmarsson
- Re: file.db VS filedb
- From: Gunnar Hjalmarsson
- Re: file.db VS filedb
- References:
- file.db VS filedb
- From: Mk
- file.db VS filedb
- Prev by Date: Re: file.db VS filedb
- Next by Date: Re: file.db VS filedb
- Previous by thread: Re: file.db VS filedb
- Next by thread: Re: file.db VS filedb
- Index(es):
Relevant Pages
|