Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] Converting Berkeley DB to GNU dbm
- Date: Tue, 3 Sep 2002 17:03:26 +0900
- From: "A. Sajjad Zaidi" <sajjad@example.com>
- Subject: Re: [tlug] Converting Berkeley DB to GNU dbm
- References: <20020903073351.GD1876@example.com> <E17m8Ps-0004P1-00@example.com>
- User-agent: Mutt/1.4i
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tue, Sep 03, 2002 at 03:48:04PM +0800, Shimpei Yamashita wrote: > > If you can't find a customized tool, try hacking one together using the > DB_File and GDBM_File modules in perl. Tie the old password file to a > DB_File hash, tie the new password to a GDBM_File hash, do a > foreach(keys()) > through the old file and populate the new file. Should work--in theory, > assuming that things like password encoding format haven't changed. Found this example in the Perl Bookshelf: #!/usr/bin/perl -w # db2gdbm: converts DB to GDBM use strict; use DB_File; use GDBM_File; unless (@example.com == 2) { die "usage: db2gdbm infile outfile\n"; } my ($infile, $outfile) = @example.com; my (%db_in, %db_out); # open the files tie(%db_in, 'DB_File', $infile) or die "Can't tie $infile: $!"; tie(%db_out, 'GDBM_File', $outfile, GDBM_WRCREAT, 0666) or die "Can't tie $outfile: $!"; # copy (don't use %db_out = %db_in because it's slow on big databases) while (my($k, $v) = each %db_in) { $db_out{$k} = $v; } # these unties happen automatically at program exit untie %db_in; untie %db_out; Am trying it now. Hope it works. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE9dGzIt1KjqyZ+DQ4RArYfAJ4udO75gavldFBwSd8HZ355FF16IACfQ8N+ OvTsWgumTUYEqc7x8NqSK2E= =151K -----END PGP SIGNATURE-----
- References:
- [tlug] Converting Berkeley DB to GNU dbm
- From: A. Sajjad Zaidi
- Re: [tlug] Converting Berkeley DB to GNU dbm
- From: Shimpei Yamashita
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] Converting Berkeley DB to GNU dbm
- Next by Date: Re: [tlug] Followup on mutt and gpg
- Previous by thread: Re: [tlug] Converting Berkeley DB to GNU dbm
- Next by thread: Re: [tlug] "interactive" perl
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links