From: Ken Gillett <[EMAIL PROTECTED]> Subject: Re: tie DB_File flags Date sent: Fri, 28 Jan 2005 11:59:52 +0000 To: Marcello <[EMAIL PROTECTED]>
> 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. :-) I guess the constants were not imported into the main namespace. Any chance you had something like use DB_File (); in the code? That way the constants would not be imported. Jenda ===== [EMAIL PROTECTED] === 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 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>