Re: file.db VS filedb



MK wrote:
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

Please enable strictures and warnings!!

$ cat test.pl
#!/usr/bin/perl
use strict;
use warnings;
use DB_File;
dbmopen my %email, email.db, 0666;

$ ./test.pl
Bareword "email" not allowed while "strict subs" in use at ./test.pl line 5.
Bareword "db" not allowed while "strict subs" in use at ./test.pl line 5.
Execution of ./test.pl aborted due to compilation errors.
$

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?

Talking about a "bug", based on that reasoning, _that_ is ridiculous.

Of course Perl will access a database in some other directory, if you state the correct path to that directory.

dbmopen my %email, '/path/to/email.db', 0644
or die $!;

As a side note, there is a chdir() function in Perl.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
.



Relevant Pages

  • Re: A script to flag commonly misused words
    ... is preferable in general as it allows you to scope warnings. ... use strict; ... I first wrote a script to extract the words to flag from your ... I discovered that at least one of the expressions you ...
    (comp.lang.perl.misc)
  • Re: [PATCH] Speed up "make headers_*"
    ... 'use strict' and 'use warnings' is recommended. ... The parentheses are not needed for most of the built-in functions. ... More or less the same comments would apply to the next script as well. ...
    (Linux-Kernel)
  • Re: crisis Perl
    ... As to writing good code to begin with, ... the top of the script. ... the "use warnings;" line won't actually change ... recommended declaring variables IN AS SMALL AS SCOPE AS POSSIBLE. ...
    (comp.lang.perl.misc)
  • Re: Regular Expression and file editing.
    ... Goksie wrote: ... If i run the script, the changes could not be effected bcos the files is ... use warnings; ... use strict; ...
    (perl.beginners)
  • Re: Passing vars to a "require"d script
    ... > require'd script didn't seem to pull in the form data, ... >> use strict; ... >> use warnings; # main program ...
    (comp.lang.perl.misc)