commit:     584ff491608907197112649e72214fdb0ae659f7
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Fri Aug 22 06:22:56 2025 +0000
Commit:     Kerin Millar <kfm <AT> plushkava <DOT> net>
CommitDate: Fri Aug 22 22:44:42 2025 +0000
URL:        https://gitweb.gentoo.org/proj/locale-gen.git/commit/?id=584ff491

Have render_printable() load JSON::PP on demand

Presently, the render_printable() subroutine calls the encode() method
of the JSON::PP subroutine. Given that this only occurs in the course of
throwing certain exceptions, load the JSON::PP module at that juncture.

See-also: 3a2dbe021877709c97708f0b2ebf4af53532053e
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>

 locale-gen | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/locale-gen b/locale-gen
index 8bcbb05..236f8fc 100755
--- a/locale-gen
+++ b/locale-gen
@@ -13,7 +13,6 @@ use Fcntl qw(SEEK_SET);
 use File::Spec::Functions qw(canonpath catfile catdir splitpath);
 use File::Temp qw(tempdir);
 use Getopt::Long ();
-use JSON::PP ();
 
 # Formally stable as of v5.40; sufficiently functional in both v5.36 and v5.38.
 use experimental qw(try);
@@ -594,6 +593,7 @@ sub redirect_stderr ($stderr, $callback) {
 }
 
 sub render_printable ($value) {
+       require JSON::PP;
        return JSON::PP->new->ascii->space_after->encode($value)
 }
 

Reply via email to