line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::Fix::sfx_threshold; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
64306
|
use Catmandu::Sane; |
|
1
|
|
|
|
|
153344
|
|
|
1
|
|
|
|
|
6
|
|
4
|
1
|
|
|
1
|
|
277
|
use Catmandu::Util qw(:is); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
241
|
|
5
|
1
|
|
|
1
|
|
5
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
6
|
1
|
|
|
1
|
|
803
|
use Catmandu::SFX; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
27
|
|
7
|
1
|
|
|
1
|
|
391
|
use Catmandu::Fix::Has; |
|
1
|
|
|
|
|
718
|
|
|
1
|
|
|
|
|
5
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has path => (fix_arg => 1); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
with 'Catmandu::Fix::SimpleGetValue'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub emit_value { |
14
|
6
|
|
|
6
|
0
|
13329
|
my ($self, $var, $fixer) = @_; |
15
|
6
|
|
|
|
|
28
|
my $sfx = $fixer->capture(Catmandu::SFX->new()); |
16
|
6
|
|
|
|
|
282
|
"if (is_string(${var})) {" . |
17
|
|
|
|
|
|
|
"${var} = ${sfx}->parse_sfx_threshold(${var})" . |
18
|
|
|
|
|
|
|
"}"; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
1; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
__END__ |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=encoding utf-8 |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 NAME |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Catmandu::Fix::sfx_threshold - parse the SFX threshold data |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# Map the SFX threshold data |
32
|
|
|
|
|
|
|
marc_map('866a','holding.$append') |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# Calculate the content of the holdings |
35
|
|
|
|
|
|
|
sfx_threshold(holding.*) |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# If the SFX threshold was something like: |
38
|
|
|
|
|
|
|
# |
39
|
|
|
|
|
|
|
# Available from 2013 |
40
|
|
|
|
|
|
|
# |
41
|
|
|
|
|
|
|
# then the holding contains |
42
|
|
|
|
|
|
|
# |
43
|
|
|
|
|
|
|
# holding => [{ |
44
|
|
|
|
|
|
|
# raw => 'Available from 2013' , |
45
|
|
|
|
|
|
|
# start => { |
46
|
|
|
|
|
|
|
# year => 2013 |
47
|
|
|
|
|
|
|
# } , |
48
|
|
|
|
|
|
|
# end => {} , |
49
|
|
|
|
|
|
|
# limit => {} , |
50
|
|
|
|
|
|
|
# years => [ 2013, 2014, .... $current_year ] |
51
|
|
|
|
|
|
|
# }] |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 DESCRIPTION |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
The sfx_threshold parses the Ex Libris SFX data for machine processing. |
56
|
|
|
|
|
|
|
The result output contains a HASH for every threshold containing the |
57
|
|
|
|
|
|
|
following fields: |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
* raw - The unprocessed SFX threshold |
60
|
|
|
|
|
|
|
* start.year - A start year |
61
|
|
|
|
|
|
|
* start.volume - A start volume |
62
|
|
|
|
|
|
|
* start.issue - A start issue |
63
|
|
|
|
|
|
|
* end.year - An end year |
64
|
|
|
|
|
|
|
* end.volume - An end volume |
65
|
|
|
|
|
|
|
* end.issue - An end issue |
66
|
|
|
|
|
|
|
* limit.num - Number of year or months if a moving wall is applicable |
67
|
|
|
|
|
|
|
* limit.type - 'year' or 'month' |
68
|
|
|
|
|
|
|
* limit.availble - 1, when the holding includes the years/months, 0 otherwise |
69
|
|
|
|
|
|
|
* human - A human understandable string. E.g. 1997 - 2013 |
70
|
|
|
|
|
|
|
* is_running - 1, when it is a running subscription, 0 otherwise |
71
|
|
|
|
|
|
|
* years - An array of all years available [ 2001, 2002, 2003 ... ] |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 AUTHOR |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Patrick Hochstenbach <Patrick.Hochstenbach@UGent.be> |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
This software is copyright (c) 20145by Patrick Hochstenbach. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
82
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |