Add a script for alisadb.
authorKoichi KAMICHI <kamichi@fonts.jp>
Fri, 14 Jan 2005 05:38:41 +0000 (05:38 +0000)
committerKoichi KAMICHI <kamichi@fonts.jp>
Fri, 14 Jan 2005 05:38:41 +0000 (05:38 +0000)
kagedb/getaliastxt.pl [new file with mode: 0755]

diff --git a/kagedb/getaliastxt.pl b/kagedb/getaliastxt.pl
new file mode 100755 (executable)
index 0000000..1248410
--- /dev/null
@@ -0,0 +1,26 @@
+###############################################################################
+# getaliastxt.pl
+#
+#   create txt file from KAGE/cgi 
+#   by Koichi Kamichi
+###############################################################################
+
+if($#ARGV != 0 || !(-d $ARGV[0])){
+       print "Usage: perl getaliastxt.pl aliasdb_dir\n";
+       exit;
+}
+$aliasdir = $ARGV[0];
+$aliasdir =~ s/\/?$//; # remove the last slash
+
+use Fcntl;
+use BerkeleyDB;
+
+tie %db, "BerkeleyDB::Hash", -Filename => "$aliasdir/aliasdb", -Flags => DB_RDONLY
+or die "An error occured at opening DB file.\n";
+%db = ();
+
+foreach(sort(keys(%db))){
+       print "$_\t$db{$_}\n";
+}
+
+untie(%db);