From 06b671a72c05c061d744636057d1501672a30ae9 Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Thu, 18 Nov 2021 10:30:33 +0000 Subject: [PATCH] Bug 29516: Remove dependency on IO::Scalar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit IO::Scalar is used in Koha::App::Plugin::CGIBinKoha to create a filehandle tied to a scalar. Perl has this feature built in since 5.8.0 so IO::Scalar is not needed I'm not sure how to test this, since it should behave exactly the same with or without the patch, but we can at least verify that it doesn't introduce encoding issues. Test plan: 1. Run `morbo bin/intranet` 2. Go to http://localhost:3000 3. Create a bibliographic record with some non-latin characters (try emoji characters for instance). Verify that there is no visible encoding issues. 4. Save this record as MARCXML and re-import it as a new record using Tools ยป Stage MARC records for import. Verify that the new record has no visible encoding issues 5. `git grep IO::Scalar` should not return any result Signed-off-by: Jonathan Druart --- Koha/App/Plugin/CGIBinKoha.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Koha/App/Plugin/CGIBinKoha.pm b/Koha/App/Plugin/CGIBinKoha.pm index b7b8d4680b3..268c45fc7a8 100644 --- a/Koha/App/Plugin/CGIBinKoha.pm +++ b/Koha/App/Plugin/CGIBinKoha.pm @@ -24,7 +24,6 @@ use Mojo::Base 'Mojolicious::Plugin'; use CGI; use CGI::Compile; use CGI::Emulate::PSGI; -use IO::Scalar; sub register { my ($self, $app, $conf) = @_; @@ -80,9 +79,10 @@ sub _psgi_env { my $env = $c->req->env; my $body = $c->req->build_body; + open my $input, '<', \$body or die "Can't open in-memory scalar: $!"; $env = { %$env, - 'psgi.input' => IO::Scalar->new(\$body), + 'psgi.input' => $input, 'psgi.errors' => *STDERR, REQUEST_METHOD => $c->req->method, QUERY_STRING => $c->req->url->query->to_string, -- 2.25.1