Lines 64-151
my $launcher = sub {
Link Here
|
64 |
debug => 1, |
64 |
debug => 1, |
65 |
} |
65 |
} |
66 |
); |
66 |
); |
67 |
$result = "ta" unless $result; |
|
|
68 |
my $f0 = substr( $result, 0, 1 ); |
69 |
my $f1 = substr( $result, 1, 1 ); |
70 |
|
67 |
|
71 |
#added new parameters to allow for all material types |
68 |
$result = "ta" unless $result; |
72 |
my $f2 = substr( $result, 2, 1 ); |
69 |
my $pad_length = 23 - length $result; |
73 |
my $f3 = substr( $result, 3, 1 ); |
70 |
my @fvalues = split //, $result; |
74 |
my $f4 = substr( $result, 4, 1 ); |
71 |
if ($pad_length>0) { |
75 |
my $f5 = substr( $result, 5, 1 ); |
72 |
push @fvalues, (undef)x($pad_length); |
76 |
my $f6 = substr( $result, 6, 1 ); |
73 |
} |
77 |
my $f7 = substr( $result, 7, 1 ); |
74 |
my @fnames = map { "f$_" } (0..22); |
78 |
my $f8 = substr( $result, 8, 1 ); |
|
|
79 |
my $f9 = substr( $result, 9, 1 ); |
80 |
my $f10 = substr( $result, 10, 1 ); |
81 |
my $f11 = substr( $result, 11, 1 ); |
82 |
my $f12 = substr( $result, 12, 1 ); |
83 |
my $f13 = substr( $result, 13, 1 ); |
84 |
my $f14 = substr( $result, 14, 1 ); |
85 |
my $f15 = substr( $result, 15, 1 ); |
86 |
my $f16 = substr( $result, 16, 1 ); |
87 |
my $f17 = substr( $result, 17, 1 ); |
88 |
my $f18 = substr( $result, 18, 1 ); |
89 |
my $f19 = substr( $result, 19, 1 ); |
90 |
my $f20 = substr( $result, 20, 1 ); |
91 |
my $f21 = substr( $result, 21, 1 ); |
92 |
my $f22 = substr( $result, 22, 1 ); |
93 |
|
75 |
|
94 |
#FIXME: There is probably a more-elegant way to do this! |
|
|
95 |
#FIXME: Two of the material types treat position 06, 07, and 08 as a single |
76 |
#FIXME: Two of the material types treat position 06, 07, and 08 as a single |
96 |
#three-char field. This script works fine for creating values and sending them |
77 |
#three-char field. This script works fine for creating values and sending them |
97 |
#back to the MARC, but if there is already a value in the 007, it won't send |
78 |
#back to the MARC, but if there is already a value in the 007, it won't send |
98 |
#it properly to the value builder for those two instances. Not sure how to solve. |
79 |
#it properly to the value builder for those two instances. Not sure how to solve. |
99 |
$template->param( |
80 |
$template->param( index => $index ); |
100 |
index => $index, |
81 |
foreach my $count ( 0..22 ) { |
101 |
f0 => $f0, |
82 |
if (defined $fvalues[$count]) { |
102 |
"f0$f0" => $f0, |
83 |
# template uses f##pipe variables. |
103 |
f1 => $f1, |
84 |
my $key2; |
104 |
"f1$f1" => $f1, |
85 |
if ($fvalues[$count] eq q{|}) { |
105 |
f2 => $f2, |
86 |
$key2 = $fnames[$count] . 'pipe'; |
106 |
"f2$f2" => $f2, |
87 |
} |
107 |
f3 => $f3, |
88 |
else { |
108 |
"f3$f3" => $f3, |
89 |
$key2 = $fnames[$count] . $fvalues[$count]; |
109 |
f4 => $f4, |
90 |
} |
110 |
"f4$f4" => $f4, |
91 |
$template->param( |
111 |
f5 => $f5, |
92 |
$fnames[$count] => $fvalues[$count], |
112 |
"f5$f5" => $f5, |
93 |
$key2 => $fvalues[$count] |
113 |
f6 => $f6, |
94 |
); |
114 |
"f6$f6" => $f6, |
95 |
} |
115 |
f7 => $f7, |
96 |
} |
116 |
"f7$f7" => $f7, |
|
|
117 |
f8 => $f8, |
118 |
"f8$f8" => $f8, |
119 |
f9 => $f9, |
120 |
"f9$f9" => $f9, |
121 |
f10 => $f10, |
122 |
"f10$f10" => $f10, |
123 |
f11 => $f11, |
124 |
"f11$f11" => $f11, |
125 |
f12 => $f12, |
126 |
"f12$f12" => $f12, |
127 |
f13 => $f13, |
128 |
"f13$f13" => $f13, |
129 |
f14 => $f14, |
130 |
"f14$f14" => $f14, |
131 |
f15 => $f15, |
132 |
"f15$f15" => $f15, |
133 |
f16 => $f16, |
134 |
"f16$f16" => $f16, |
135 |
f17 => $f17, |
136 |
"f17$f17" => $f17, |
137 |
f18 => $f18, |
138 |
"f18$f18" => $f18, |
139 |
f19 => $f19, |
140 |
"f19$f19" => $f19, |
141 |
f20 => $f20, |
142 |
"f20$f20" => $f20, |
143 |
f21 => $f21, |
144 |
"f21$f21" => $f21, |
145 |
f22 => $f22, |
146 |
"f22$f22" => $f22, |
147 |
); |
148 |
output_html_with_http_headers $input, $cookie, $template->output; |
97 |
output_html_with_http_headers $input, $cookie, $template->output; |
149 |
}; |
98 |
}; |
150 |
|
99 |
|
151 |
return { builder => $builder, launcher => $launcher }; |
100 |
return { builder => $builder, launcher => $launcher }; |
152 |
- |
|
|