Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Text-Hyphen CPAN distribution.

Report information
The Basics
Id: 106435
Status: open
Priority: 0/
Queue: Text-Hyphen

People
Owner: KAPPA [...] cpan.org
Requestors: laurent.rosenfeld [...] googlemail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Text::Hyphen documentation bug
Date: Thu, 13 Aug 2015 20:56:52 +0200
To: bug-Text-Hyphen [...] rt.cpan.org
From: Laurent Rosenfeld <laurent.rosenfeld [...] googlemail.com>
Hi, I have just tried the example of Text::Hyphen you give in your documentation ( http://search.cpan.org/~kappa/Text-Hyphen-0.11/lib/Text/Hyphen.pm), and it did not work properly: $ perl -e 'use Text::Hyphen; my $hyphenator = new Text::Hyphen; print $hyphenator->hyphenate('representation'); ' representation I ran your example under the debugger and found that this code line: return wantarray ? @pieces : join($delim, @pieces); does not work properly with print in the calling program, because print forces a list context, so that your module return the @pieces array, not the joined string, and the pieces are glued together by the print. Running it again with a scalar context solved the issue: $ perl -e 'use Text::Hyphen; my $hyphenator = new Text::Hyphen; print scalar $hyphenator->hyphenate('representation'); ' rep-re-sen-ta-tion So, only a minor glitch in the documentation, I think. Best regards, Laurent.
Laurent, thanks for the investigation. It is a real shame that the example from Synopsis didn't work for so long. I fixed it in 0.2 which now heads to CPAN. 13 Ağu 2015 Prş, 14:57:02 tarihinde, laurent.rosenfeld@googlemail.com yazdı: Show quoted text
> Hi, > I have just tried the example of Text::Hyphen you give in your > documentation ( > http://search.cpan.org/~kappa/Text-Hyphen-0.11/lib/Text/Hyphen.pm), and it > did not work properly: > > $ perl -e 'use Text::Hyphen; > my $hyphenator = new Text::Hyphen; > print $hyphenator->hyphenate('representation'); > ' > representation > > I ran your example under the debugger and found that this code line: > > return wantarray ? @pieces : join($delim, @pieces); > > does not work properly with print in the calling program, because print > forces a list context, so that your module return the @pieces array, not > the joined string, and the pieces are glued together by the print. > > Running it again with a scalar context solved the issue: > > $ perl -e 'use Text::Hyphen; > my $hyphenator = new Text::Hyphen; > print scalar $hyphenator->hyphenate('representation'); > ' > rep-re-sen-ta-tion > > So, only a minor glitch in the documentation, I think. > > Best regards, > Laurent.