FAQ
hi all,

i want to use MLDBM to store some data(name with
multiple values), but error occurs. i have installed
these modules, but i'm not sure what i'm missing.
MLDBM
DB_file
Data::Dumper

the codes:
use MLDBM 'DB_File';

tie %data, "MLDBM", "database", O_CREAT|O_RDWR, 0644
or die "can't open/create files:$!\n";

the error:
MLDBM error: Second level tie failed, "No such file or
directory"

how could there be this error when i want to create
the file? so i delibrately created the file(with 0
bytes) but it still gives the same error.

any pointers? thks!

Conan

=====
It Will Come To Us !!!
[email protected]

__________________________________________________
Do You Yahoo!?
Yahoo! Kickin' Party - Win a 5-star getaway to exotic Bali!<br>http://kickin.yahoo.com.sg

Search Discussions

  • Drieux at May 3, 2002 at 1:29 pm
    On Friday, May 3, 2002, at 03:58 , Conan Chai wrote:
    [..]
    tie %data, "MLDBM", "database", O_CREAT|O_RDWR, 0644
    or die "can't open/create files:$!\n";

    the error:
    MLDBM error: Second level tie failed, "No such file or
    directory"
    [..]

    p0: try one or the other mailing lists.

    p1: if you go back and look at

    perldoc -f tie

    you will notice the illustration code:

    tie(%HIST, 'NDBM_File', '/usr/lib/news/history', 1, 0);

    and in your case all you have is "database" - which may
    or may not be in the same directory as the code that you
    are executing..... when it is, then it is findable, when
    your code runs by other means - then the file "database" -
    should actually be 'fully qualified' as to where it will
    reside on the machine....



    ciao
    drieux

    ---
  • Michael Fowler at May 3, 2002 at 6:37 pm
    I removed beginners-cgi from the Cc: list. Your question has nothing
    specifically to do with CGI, and is thus not appropriate on that list.
    Please don't cross-post.

    On Fri, May 03, 2002 at 06:58:34PM +0800, Conan Chai wrote:
    use MLDBM 'DB_File';

    tie %data, "MLDBM", "database", O_CREAT|O_RDWR, 0644
    or die "can't open/create files:$!\n";

    the error:
    MLDBM error: Second level tie failed, "No such file or
    directory"
    Are you certain that's the only error you got? Did you, by chance, also see
    something like:

    Argument "O_SVWST" isn't numeric in subroutine entry at
    /usr/lib/perl/5.6.1/DB_File.pm line 263.

    What I'm getting at is that you may not have imported the O_CREAT and O_RDWR
    constants, so they're being evaluated as strings. Assuming the code you
    showed us is all of the code you're using, this is the case, and you need to
    add something like:

    use Fcntl qw(O_RDWR O_CREAT);

    or

    use DB_File qw(O_RDWR O_CREAT);

    Depending on whether or not you want to load an extra module for these
    constants.


    Michael
    --
    Administrator www.shoebox.net
    Programmer, System Administrator www.gallanttech.com
    --

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupbeginners @
categoriesperl
postedMay 3, '02 at 10:58a
activeMay 3, '02 at 6:37p
posts3
users3
websiteperl.org

People

Translate

site design / logo © 2023 Grokbase