~ubuntu-branches/ubuntu/intrepid/horae/intrepid

« back to all changes in this revision

Viewing changes to 0CPAN/STAR-Parser-0.59/lib/STAR/Dictionary.pm

  • Committer: Bazaar Package Importer
  • Author(s): Carlo Segre
  • Date: 2008-02-23 23:13:02 UTC
  • mfrom: (2.1.2 hardy)
  • Revision ID: james.westby@ubuntu.com-20080223231302-mnyyxs3icvrus4ke
Tags: 066-3
Apply patch to athena_parts/misc.pl for compatibility with 
perl-tk 804.28.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
package STAR::Dictionary;
2
 
 
3
 
use strict;
4
 
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK );
5
 
use STAR::DataBlock;
6
 
 
7
 
@ISA = qw( STAR::DataBlock );
8
 
 
9
 
$VERSION = '0.56';
10
 
 
11
 
# $Id: Dictionary.pm,v 1.2 2000/12/19 22:54:56 helgew Exp $   RCS Identification
12
 
 
13
 
 
14
 
####################
15
 
# Constructor: new #
16
 
####################
17
 
 
18
 
sub new {
19
 
    my ($proto, @parameters) = @_;
20
 
    my $class = ref($proto) || $proto;
21
 
    my $file;
22
 
    my $self;
23
 
 
24
 
    $file = shift @parameters unless $#parameters;
25
 
    while ($_ = shift @parameters) {
26
 
        $file = shift @parameters if /-file/;
27
 
    }
28
 
 
29
 
    if ( $file ) {
30
 
        $self = Storable::retrieve($file);
31
 
    }
32
 
    else {
33
 
        $self = {};
34
 
        bless ($self,$class);
35
 
    }
36
 
 
37
 
    return $self;
38
 
}
39
 
 
40
 
 
41
 
##################################
42
 
# Object method: get_save_blocks #
43
 
##################################
44
 
 
45
 
sub get_save_blocks {
46
 
 
47
 
    my $self = shift;
48
 
    my ($d, $s);
49
 
    my (@save_blocks);
50
 
 
51
 
    foreach $d ( sort keys %{$self->{DATA}} ) {
52
 
        foreach $s ( sort keys %{$self->{DATA}{$d}} ) {
53
 
            push @save_blocks,$s;
54
 
        }
55
 
    }
56
 
    return @save_blocks;
57
 
}
58
 
 
59
 
1;
60
 
__END__
61
 
 
62
 
 
63
 
=head1 NAME
64
 
 
65
 
STAR::Dictionary - Perl extension for handling dictionaries that 
66
 
were parsed from STAR compliant files.
67
 
 
68
 
=head2 Version
69
 
 
70
 
This documentation refers to version 0.56 of this module. 
71
 
 
72
 
=head1 SYNOPSIS
73
 
 
74
 
  use STAR::Dictionary;
75
 
 
76
 
  $dict_obj = STAR::Dictionary->new(-file=>$file);
77
 
  @items_in_dict = $dict_obj->get_save_blocks;
78
 
 
79
 
=head1 DESCRIPTION
80
 
 
81
 
This package contains class and object methods for Dictionary objects 
82
 
created by STAR::Parser. 
83
 
This class is a sub class of STAR::DataBlock. It supports all methods from 
84
 
STAR::DataBlock (see related documentation), as well as the 
85
 
additional method get_save_blocks.
86
 
 
87
 
=head1 OBJECT METHODS
88
 
 
89
 
=head2 get_save_blocks
90
 
 
91
 
  Usage:   @save_blocks = $dict_obj->get_save_blocks; 
92
 
 
93
 
This methods returns an array with all save_ blocks found in the Dictionary 
94
 
object. Each item defined in the dictionary is described within a save block. 
95
 
In addition, items pertaining to the dictionary itself (such as 
96
 
_dictionary.version) are found outside of save blocks in the dictionary file. 
97
 
In the data structure of a Dictionary object, these items are gathered 
98
 
in a C<$s='-'> save block.
99
 
 
100
 
=head1 AUTHOR
101
 
 
102
 
Wolfgang Bluhm, mail@wbluhm.com
103
 
 
104
 
=head2 Acknowledgments
105
 
 
106
 
Thanks to Phil Bourne, Helge Weissig, Anne Kuller, Doug Greer,
107
 
Michele Bluhm, and others for support, help, and comments.
108
 
 
109
 
=head1 COPYRIGHT
110
 
 
111
 
A full copyright statement is provided with the distribution
112
 
Copyright (c) 2000 University of California, San Diego
113
 
 
114
 
=head1 SEE ALSO
115
 
 
116
 
STAR::Parser, STAR::DataBlock.
117
 
 
118
 
=cut