Start to switch to Moose
[scpubgit/stemmatology.git] / lib / Text / Tradition.pm
1 #!/usr/bin/env perl
2
3 package Text::Tradition;
4
5 use Moose;
6
7 has 'collation' => (
8                     is => 'ro',
9                     isa => 'Text::Tradition::Collation',
10                     init_arg => undef,
11                     );
12
13 has 'witnesses' => (
14                     traits => ['Array'],
15                     is => 'rw',
16                     isa => 'ArrayRef[Text::Tradition::Witness]',
17                     handles => {
18                         all_options    => 'elements',
19                         add_option     => 'push',
20                         map_options    => 'map',
21                         option_count   => 'count',
22                         sorted_options => 'sort',
23                     },
24                     );
25
26 # The user will usually be instantiating a Tradition object, and
27 # examining its collation.  The information about the tradition can
28 # come via several routes:
29 # - graphML from CollateX or elsewhere, standalone
30 # - TEI parallel segmentation
31 # - Leuven-style spreadsheet of variants, converted to CSV, plus base text
32 # - apparatus pulled from CTE, plus base text
33 # From this we should be able to get basic witness information.
34
35 # Alternatively the user can just give us the uncollated texts.  Then
36 # instead of passing a collation, s/he is passing a set of witnesses
37 # from which we will generate a collation.  Those witnesses can be in
38 # plaintext or in TEI with certain constraints adopted.
39
40 # So the constructor for a tradition needs to take one of these infosets,
41 # and construct the collation and the witness objects.
42
43 no Moose;
44 __PACKAGE__->meta->make_immutable;