File: dump_db

package info (click to toggle)
munin 2.0.25-1+deb8u3~bpo70+1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy-backports
  • size: 6,184 kB
  • sloc: perl: 11,818; sh: 3,545; java: 1,880; makefile: 767; python: 272
file content (20 lines) | stat: -rwxr-xr-x 401 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#! /usr/bin/perl
# Dump a binary dictionary to clear text hash
# (c) GPL - Steve Schnepp <steve.schnepp@pwkf.org>

use strict;
use warnings;

use Fcntl;   # For O_RDWR, O_CREAT, etc.
use DB_File;

while (my $db_file = shift) {
	my %hash;
	tie(%hash, 'DB_File', $db_file, O_RDONLY) or die "$!";

	for my $key (sort keys %hash) {
		my $value = $hash{$key};
		print "$key\t$value\n";
	}
	untie(%hash);
}