https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=37380

--- Comment #13 from Tomás Cohen Arazi <[email protected]> ---
Hi, I rolled back with making it return undef. As I noticed the tradeoff was
not good. We ended up having to add `// q{}` in a bunch of places, which is not
worth. Tests and code have been adjusting to go back to the old behavior.

I wanted to share that I made some exhaustive tests on MARC::Record and
MARC::Field behavior...

```
perl -MDDP \
     -MMARC::File::XML \
     -MMARC::Record \
     -MMARC::Field \
-e 'my $f = MARC::Field->new( "001", undef); p($f->data); my $r =
MARC::Record->new(); $r->append_fields($f);
$r->append_fields(MARC::Field->new("245", "", "", a => "Stuff")); my $xml =
$r->as_xml; $r = MARC::Record->new_from_xml($xml); p($r->as_xml);'
```

My conclusion is that MARC::Field allows adding `undef` values but it will then
warn when appending them. But I also found out that once the record gets
serialized as XML, the `undef` is replaced by an empty string and that's how it
is going to stay forever, with our code. So having `undef` is a weird
artificially created scenario.

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to