home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.perl
- Path: sparky!uunet!mcsun!chsun!bernina!neptune!weingart
- From: weingart@inf.ethz.ch (Tobias Weingartner)
- Subject: DBM stuff random?
- Message-ID: <1992Nov18.162917.4712@neptune.inf.ethz.ch>
- Followup-To: comp.lang.perl
- Keywords: DBM
- Sender: news@neptune.inf.ethz.ch (Mr News)
- Nntp-Posting-Host: tau.inf.ethz.ch
- Reply-To: weingart@inf.ethz.ch
- Organization: ETH - Switzerland
- Date: Wed, 18 Nov 1992 16:29:17 GMT
- Lines: 66
-
- This one has me baffeld. I have a piece of code,
- that updates a dbm file (dbmopen....), and also
- the ASCII version of this file.
-
- The ASCII version gets updated with no problem.
- The DBM version does not seem to get updated.
-
- However, IF I DO the updating using the debugger
- (perl -d) everything works. I don't mean if I
- step though the code, but if it type in:
-
- perl -de 0
-
- And then do the dbmopen(...);$FOO{...} = BAR;dbmclose(..);
-
- If anyone can see where I have gone wrong in the following
- excerpt, please pound me on the noggin. I know, this ain't
- pretty code, but I AM in the process of munging into something
- a little better...
-
- #
- # Open and update ASCII file
- #
- open(UDB, "<$udb_data") || return "Open $!.";
- chop(@udb = <UDB>);
- close(UDB);
-
- @udb = grep(!/^$user:/, @udb);
- push(@udb, join(':', @uinfo));
-
- open(UDB, ">$udb_data") || return "Open $! $udb_data.";
- for(@udb){
- print UDB "$_\n";
- }
- close(UDB);
-
- #
- # Open and update both DBM files.
- #
- dbmopen(BYU, "$udb_by_u", undef) || return "Open $! $udb_by_u.";
- dbmopen(BYN, "$udb_by_n", undef) || return "Open $! $udb_by_n.";
-
- $BYU{$user} = join(':', @uinfo); # Don't work, WHY???
- $BYN{$uinfo[1]} = join(':', @uinfo); # Don't work, WHY???
-
- dbmclose(BYU);
- dbmclose(BYN);
-
-
- I'm lost!
-
- --Toby.
-
- ***************************************************************
- * Tobias Weingartner * Not every man is willing to die... *
- * c/o Bruno Opprecht * Some have to be PUSHED out the window *
- * Oberdierikoner st.7 * ------------------------------------- *
- * 6030 Ebikon Luzern * Anybody who dictates that computers *
- * SWITZERLAND * are logical, I'll ... *
- ***************************************************************
- * +41'041'33'25'40 * ..Midnight the fading, blue Wizrd.. *
- ***************************************************************
- SYSTEM-F-ANARCHISM, the operating system has been overthrown
-
- PGP2.0 Public Key available at 'finger weingart@tau.inf.ethz.ch'
-
-