Package: libtext-lorem-perl
Version: 0.34-3
Severity: normal
Tags: patch upstream
Forwarded: https://github.com/adeolaawoyemi/Text-Lorem/pull/11

The lorem executable has 2 issues:
* The elements of the array need to be separated by " " or "\n".
* A final "\n" needs to be output (to get a POSIX text file and
  to avoid issues in an interactive shell).

Without the separators, the lorem executable is useless.
For instance, with bash:

vinc17@qaa:~$ lorem -w 5
accusantiumeosrationeestofficiavinc17@qaa:~$ 

One cannot see the separation between the words and this is mixed up
with the shell prompt.

I've attached the patch I've written for the pull request upstream.

-- System Information:
Debian Release: trixie/sid
  APT prefers unstable-debug
  APT policy: (500, 'unstable-debug'), (500, 'stable-updates'), (500, 
'stable-security'), (500, 'stable-debug'), (500, 'proposed-updates-debug'), 
(500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 6.12.22-amd64 (SMP w/16 CPU threads; PREEMPT)
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages libtext-lorem-perl depends on:
ii  perl  5.40.1-3

libtext-lorem-perl recommends no packages.

libtext-lorem-perl suggests no packages.

-- no debconf information

-- 
Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Pascaline project (LIP, ENS-Lyon)
diff --git a/bin/lorem b/bin/lorem
index 7a4bfa1..461a925 100644
--- a/bin/lorem
+++ b/bin/lorem
@@ -18,17 +18,18 @@ die usage()
 
 my $lorem = Text::Lorem->new;
 if ($opt_w) {
-    print $lorem->words($opt_w);
+    print join " ", $lorem->words($opt_w);
 }
 elsif ($opt_s) {
-    print $lorem->sentences($opt_s);
+    print join " ", $lorem->sentences($opt_s);
 }
 elsif ($opt_p) {
-    print $lorem->paragraphs($opt_p);
+    print join "\n", $lorem->paragraphs($opt_p);
 }
 else {
     print $lorem->paragraphs(1);
 }
+print "\n";
 
 sub usage {
     return <<USAGE;

Reply via email to