line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: Creates db_util command line for DB_File management |
2
|
|
|
|
|
|
|
package DB_File::Utils; |
3
|
|
|
|
|
|
|
$DB_File::Utils::VERSION = '0.004'; |
4
|
2
|
|
|
2
|
|
61980
|
use DB_File; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
use Fcntl; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
use App::Cmd::Setup -app; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub global_opt_spec { |
10
|
|
|
|
|
|
|
return ( |
11
|
|
|
|
|
|
|
['u|utf8' => "Force UTF8 encoding/decoding on values."], |
12
|
|
|
|
|
|
|
['btree' => "Use BTree indexing method (default)"], |
13
|
|
|
|
|
|
|
['hash' => "Use Hash indexing method"], |
14
|
|
|
|
|
|
|
['recno' => "Use RecNo indexing method"], |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub do_tie { |
19
|
|
|
|
|
|
|
my ($self, $file, $ops) = @_; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my $mode = $ops->{_create_} ? (O_CREAT | O_RDWR) : O_RDWR; |
22
|
|
|
|
|
|
|
if ($ops->{recno}) { |
23
|
|
|
|
|
|
|
my @array; |
24
|
|
|
|
|
|
|
my $method = $DB_RECNO; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
tie @array, 'DB_File', $file, $mode, '0666', $method; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
return \@array; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
else { |
31
|
|
|
|
|
|
|
my %hash; |
32
|
|
|
|
|
|
|
my $method = $ops->{hash} ? $DB_HASH : $DB_BTREE; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
tie %hash, 'DB_File', $file, $mode, '0666', $method; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
return \%hash; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=encoding UTF-8 |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 NAME |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
DB_File::Utils - main module for db_util command line tool |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 DESCRIPTION |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
Please refer to C for detail on module usage. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 SEE ALSO |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
db_util (3) |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 AUTHOR |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Alberto Simões C<< >> |