1Data::Stag::HashDB(3) User Contributed Perl DocumentationData::Stag::HashDB(3)
2
3
4

NAME

6         Data::Stag::HashDB
7

SYNOPSIS

9         # parsing a file into a hash
10         my $hdb = Data::Stag::HashDB->new;
11         $hdb->unique_key("ss_details/social_security_no");
12         $hdb->record_type("person");
13         my $obj = {};
14         $hdb->index_hash($obj);
15         Data::Stag->parse(-file=>$fn, -handler=>$hdb);
16         my $person = $obj->{'999-9999-9999'};
17         print $person->xml;
18
19         # indexing an existing stag tree into a hash
20         my $personset = Data::Stag->parse($fn);
21         my $hdb = Data::Stag::HashDB->new;
22         $hdb->unique_key("ss_details/social_security_no");
23         $hdb->record_type("person");
24         my $obj = {};
25         $hdb->index_hash($obj);
26         $personset->sax($hdb);
27         my $person = $obj->{'999-9999-9999'};
28         print $person->xml;
29

DESCRIPTION

31       Used for building indexes over Stag files or objects
32
33       You need to provide a record_type - this is the type of element that
34       will be indexed
35
36       You need to provide a 1 - this is a single value used to index the
37       record_types
38
39       For example, if we have data in the stag structure below, and if ss_no
40       is unique (we assume it is) then we can index all the people in the
41       database using the code above
42
43         publicinfo:
44           persondata:
45             person:
46               ss_details:
47                 social_security_no:
48               name:
49               address:
50
51       There is a subclass of this method callsed Data::Stag::StagDB, which
52       makes the hash persistent
53

PUBLIC METHODS -

55       record_type
56
57         Usage   -
58         Returns -
59         Args    -
60
61       unique_key
62
63         Usage   -
64         Returns -
65         Args    -
66
67       index_hash
68
69         Usage   -
70         Returns -
71         Args    -
72
73
74
75perl v5.8.8                       2005-12-16             Data::Stag::HashDB(3)
Impressum