https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40680
--- Comment #83 from David Cook <[email protected]> --- (In reply to Jonathan Druart from comment #25) > 365 die ($data->{message} || $data->{errorCode})."\n"; > 573 die ($data->{message} || $data->{errorCode})."\n"; > 643 die ($data->{message} || $data->{errorCode})."\n"; > > This is weird, the code looks correct. I guess perl warns because it expects > to see die and "or" instead of "||", but here it's not a die ... or! Jonathan saved everyone else a lot of text from me by messaging me about this. After doing some reading and experimenting, I think I managed to work out the problem here. In Koha and in Perl, we often omit parentheses for functions like print, warn, die, etc. But Perl will also ignore whitespace. So the two following statements are equivalent: die ($data->{message} || $data->{errorCode})."\n"; die($data->{message} || $data->{errorCode})."\n"; Obviously the second one isn't conceptually valid. I would expect a fatal syntax error. But older Perls will just say "Useless use of concatenation (.) or string in void context" whereas now with newer Perls we get "Possible precedence issue with control flow operator" Which makes sense because that concatenation operator "." is never going to be reached. die() will always return before it gets there. So the simplest solution is just to be more explicit about the precedence we want: die(($data->{message} || $data->{errorCode})."\n"); -- 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/
