File: README

package info (click to toggle)
libmarc-spec-perl 2.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 244 kB
  • sloc: perl: 686; makefile: 2
file content (133 lines) | stat: -rw-r--r-- 4,431 bytes parent folder | download | duplicates (2)
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
NAME

    MARC::Spec - A MARCspec parser and builder

SYNOPSIS

        use MARC::Spec;
        
        # Parsing MARCspec from a string
        my $ms = MARC::Spec::parse('246[0-1]$f{245$h~\[microform\]|245$h~\microfilm}');
    
        # Structure
        say ref $ms;                                             # MARC::Spec
        say ref $ms->field;                                      # MARC::Spec::Field
        say ref $ms->subfields;                                  # ARRAY
        say ref $ms->subfields->[0];                             # MARC::Spec::Subfield
        say ref $ms->subfields->[0]->subspecs;                   # ARRAY
        say ref $ms->subfields->[0]->subspecs->[0];              # ARRAY
        say ref $ms->subfields->[0]->subspecs->[0]->[1];         # MARC::Spec::Subspec
        say ref $ms->subfields->[0]->subspecs->[0]->[1]->left;   # MARC::Spec
        say ref $ms->subfields->[0]->subspecs->[0]->[1]->right;  # MARC::Spec::Comparisonstring
    
        # Access to attributes
        say $ms->field->base;                                                    # 246[0-1]
        say $ms->field->tag;                                                     # 246
        say $ms->field->index_start;                                             # 0
        say $ms->field->index_end;                                               # 1
        say $ms->field->index_length;                                            # 2
        say $ms->subfields->[0]->base;                                           # 'f[0-#]'
        say $ms->subfields->[0]->code;                                           # 'f'
        say $ms->subfields->[0]->index_start;                                    # 0
        say $ms->subfields->[0]->index_end;                                      # '#'
        say $ms->subfields->[0]->subspecs->[0]->[0]->subterms;                   # '245$h~\[microform\]'
        say $ms->subfields->[0]->subspecs->[0]->[0]->left->field->tag;           # 245
        say $ms->subfields->[0]->subspecs->[0]->[0]->left->field->index_length;  # -1
        say $ms->subfields->[0]->subspecs->[0]->[0]->left->subfields->[0]->code; # 'h'
        say $ms->subfields->[0]->subspecs->[0]->[0]->right->comparable;          # '[microform]'
        say $ms->subfields->[0]->subspecs->[0]->[1]->right->comparable;          # 'microfilm'
        
        # creating MARCspec from scratch
        my $field    =  MARC::Spec::Field->new('245');
        my $subfield = MARC::Spec::Subfield->new('a');
        my $spec     = MARC::Spec->new($field);
        $spec->add_subfield($subfield);

DESCRIPTION

    MARC::Spec is a MARCspec - A common MARC record path language
    <http://marcspec.github.io/MARCspec/> parser and builder.

FUNCTIONS

 parse(Str)

    Parses a MARCspec as string and returns an instance of MARC::Spec.

METHODS

 new(MARC::Spec::Field)

    Create a new MARC::Spec instance. Parameter must be an instance of
    MARC::Spec::Field.

 add_subfield(MARC::Spec::Subfield)

    Appends a subfield to the array of the attribute subfields. Parameter
    must be an instance of MARC::Spec::Subfield.

 add_subfields(ArrayRef[MARC::Spec::Subfield])

    Appends subfields to the array of the attribute subfields. Parameter
    must be an ArrayRef and elements must be instances of
    MARC::Spec::Subfield.

PREDICATES

 has_subfields

    Returns true if attribute subfields has an value and false otherwise.

 has_indicator

    Returns true if attribute indicator has an value and false otherwise.

ATTRIBUTES

 field

    Obligatory. Attribute field is an instance of MARC::Spec::Field.

 subfields

    If defined, subfields is an array of instances of MARC::Spec::Subfield.

 indicator

    If defined, indicator is an instance of MARC::Spec::Indicator.

AUTHOR

    Carsten Klee <klee at cpan.org>

CONTRIBUTORS

      * Johann Rolschewski, <jorol at cpan>

COPYRIGHT AND LICENSE

    This software is copyright (c) 2016 by Carsten Klee.

    This is free software; you can redistribute it and/or modify it under
    the same terms as the Perl 5 programming language system itself.

BUGS

    Please report any bugs to https://github.com/MARCspec/MARC-Spec/issues

SEE ALSO

      * MARC::Spec::Field

      * MARC::Spec::Subfield

      * MARC::Spec::Indicator

      * MARC::Spec::Subspec

      * MARC::Spec::Structure

      * MARC::Spec::Comparisonstring

      * MARC::Spec::Parser