This file is indexed.

/usr/share/perl5/Data/Stag/StagDB.pm is in libdata-stag-perl 0.11-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
package Data::Stag::StagDB;

=head1 NAME

  Data::Stag::StagDB - persistent storage and retrieval of stag nodes

=head1 SYNOPSIS

  # parsing a file into a file based index
  my $sdb = Data::Stag::StagDB->new;
  $sdb->unique_key("ss_details/social_security_no");
  $sdb->record_type("person");
  $sdb->indexfile("./person_by_ss-idx");
  Data::Stag->parse(-file=>$fn, -handler=>$sdb);
  my $obj = $sdb->index_hash;
  my $person = $obj->{'999-9999-9999'};
  print $person->xml;

  # indexing an existing stag tree into a file based index
  my $personset = Data::Stag->parse($fn);
  my $sdb = Data::Stag::StagDB->new;
  $sdb->unique_key("ss_details/social_security_no");
  $sdb->record_type("person");
  $sdb->indexfile("./person_by_ss-idx");
  $personset->sax($sdb);
  my $obj = $sdb->index_hash;
  my $person = $obj->{'999-9999-9999'};
  print $person->xml;


=cut

=head1 DESCRIPTION

This module is an extension of L<Data::Stag::HashDB> - you can use it
in the same way.

It creates a simple file based database of stag nodes

This is useful if you want your data to persist; or if you want to use L<Data::Stag::HashDB> but your data will not fit into memory

=head1 PUBLIC METHODS -

=cut

use strict;
use base qw(Data::Stag::HashDB);
use Data::Stag qw(:all);
use MLDBM qw(DB_File Storable);
use Fcntl;

use vars qw($VERSION);
$VERSION="0.11";

sub init {
    my $self = shift;
    $self->SUPER::init(@_);
    return $self;
}


=head2 indexfile

  Usage   -
  Returns -
  Args    -

=cut

sub indexfile {
    my $self = shift;
    $self->{_indexfile} = shift if @_;
    return $self->{_indexfile};
}

sub index_hash {
    my $self = shift;
    $self->{_index_hash} = shift if @_;
    if (!$self->{_index_hash}) {
	my %obj = ();
	my $f = $self->indexfile || 'tmp-stagdb';
	my $dbm = tie %obj, 'MLDBM', $f, O_CREAT|O_RDWR, 0640 or die $!;
	$self->dbm($dbm);
	$self->{_index_hash} = \%obj;
    }
    return $self->{_index_hash};
}

sub dbm {
    my $self = shift;
    $self->{_dbm} = shift if @_;
    return $self->{_dbm};
}


1;