[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] tie



At 17.43 -0500 1999.01.22, jason white wrote:
>had a message or two pointing to 'tie' having a problem with large drives.

It is not tie(), it is the DB_File module itself that has problems sometimes.


>#!perl
        -w

This would have told you some of your problems.

>use db_file;
     DB_File

Case matters.  On a Mac, it won't give you a failure for module not found,
but symbols will not be properly exported.  In this case, O_RDWR and
O_CREAT will not be available without.


>tie (%admin, 'DB_File', 'some.file', O_RDWR, 0644) | die "couldn't tie it";
                                      O_RDWR|O_CREAT ||                   :
$!";

First, | and || are not the same thing.  You want || or or.  Then, if you
add the $!, you see:

# couldn't tie it: No such file or directory.

Use $! in your die messages.  Then you need to add O_CREAT to your flags so
the file will be created if it does not exist.  So you now have:

#!perl -w
use DB_File;
tie(%admin, 'DB_File', 'some.file',
    O_RDWR|O_CREAT, 0644) or die "couldn't tie it: $!";


The rest looks fine.  You need to use -w, you need to check $!.  And you
need to be very precise.  db_file is not DB_File, | is not ||, and O_RDWR
is not O_RDWR|O_CREAT.

--
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch