On 26 Jan 2005, at 14:47, Marcello wrote:

Ken Gillett ha scritto:
Information about these has proved hard to come by, but having ascertained what I need to use I find another problem. I want to calculate the flags to use beforehand, but if I try
tie %$dbm, "DB_File", $dbf, $dbflags, $mode, $DB_HASH;
even though $dbflags contains O_RDONLY I get the following error:=
Argument "O_RDONLY" isn't numeric in subroutine entry at /usr/lib/perl5/5.8.6/i686-linux/DB_File.pm

You are passing the string "O_RDONLY" to the subroutine, no the value of O_RDONLY.


Maybe this works (untested):

<code>
$dbflags = O_RDONLY;

Because PERL wouldn't let me. BUT, I just tried it again and it didn't complain and the 'tie' worked perfectly, even when using O_RDWR|O_CREAT|O_TRUNC. :-)


tie %$dbm, "DB_File", $dbf, $dbflags, $mode, $DB_HASH;
</code>

In the meantime since first noticing the problem I have done some extensive re-writing of my code, so whatever I had that was causing the problem has obviously been corrected (without me knowing what it was). Anyway, the important point is that it now works as expected, so at least my expectations were correct.


Thanks.



Ken  G i l l e t t

_/_/_/_/_/_/_/_/_/


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to