Subject: | — instead of - in perldoc |
Date: | Tue, 29 Nov 2011 17:43:04 -0500 |
To: | bug-Number-Bytes-Human [...] rt.cpan.org |
From: | Mark Mandel <mamandel [...] ldc.upenn.edu> |
[This is a copy of email also sent to
"Adriano R. Ferreira" <ferreira@cpan.org>
and to
bug−Number−Bytes−Human@rt.cpan.org. The latter bounced, for the reason described below: those aren't hyphens but something else.]
=====================
I installed Number-Bytes-Human-0.07 on my iMac, under Mac OS X v10.6.8.
I copied the example script from the perldoc Synopsis and added a subroutine to show the results. Here it is, with the output:
------------
iMac:tmp 9 $ cat nbh.pl
sub show {
printf("%s\n", $_[0]);
}
use Number::Bytes::Human qw(format_bytes);
show $size = format_bytes(0); # '0'
show $size = format_bytes(2*1024); # '2.0K'
show $size = format_bytes(1_234_890, bs => 1000); # '1.3M'
show $size = format_bytes(1E9, bs => 1000); # '1.0G'
# the OO way
$human = Number::Bytes::Human−>new(bs => 1000, si => 1);
show $size = $human−>format(1E7); # '10MB'
$human−>set_options(zero => '−');
show $size = $human−>format(0); # '−'
iMac:tmp 10 $ perl nbh.pl
Unrecognized character \xE2 in column 39 at nbh.pl line 12.
iMac:tmp 11 $ perl nbh.pl
Unrecognized character \xE2 in column 29 at nbh.pl line 13.
iMac:tmp 12 $ perl nbh.pl
Unrecognized character \xE2 in column 16 at nbh.pl line 14.
iMac:tmp 13 $ perl nbh.pl
Unrecognized character \xE2 in column 29 at nbh.pl line 15.
iMac:tmp 14 $ perl nbh.pl
0
2.0K
1.3M
1.0G
10MB
−
iMac:tmp 15 $
------------
Those are the first characters in the small arrow notation, '−'. For whatever reason, that's not a minus sign \x2D. \xE2 is small a with circumflex, â, which that certainly is not. There are a couple of other odd characters in there -- \x88 and \x92. When I edited the file in Emacs and manually replaced each "Unrecognized character \xE2" with a proper minus sign/hyphen, \x2D, I got the expected result.
The CPAN page you gave in the Perldoc,
https://rt.cpan.org/Public/Dist/Display.html?Name=Number−Bytes−Human,
came out in one of my tries as
https://rt.cpan.org/Public/Dist/Display.html?Name=Number%E2%88%92Bytes%E2%88%92Human
and gives the following result:
------------
Unable to find distribution
The distribution you specified, Number−Bytes−Human, could not be found. Please use the search or new ticket form at the top of the page to find the distribution's bug report page.
------------
I suspect that's why it tells you you can't log in. Two problems here:
1. You're delimiting the parts of the name of the module with what look like hyphens \x2D, but the URL reveals that you're actually using the same wrong string there as you are in the synopsis, \xE2\x88\x92.
2. CPAN doesn't use hyphens anyway, it uses double colons. I tried
https://rt.cpan.org/Public/Dist/Display.html?Name=Number::Bytes::Human
and I got
----------
Maintainer(s)
FERREIRA
Bugs
----------
The mistaken character produced by that byte triplet looks like an em dash, \x2014. I don't know if that's what it is or how it got there, but the problem is obvious and so is the solution.
1. Don't type your example code in a word processor. Word processors do to words (and especially code) what food processors do to food.
2. Use the right delimiters.
I hope that now I will be able to use your module for my work as I intended to.
Sincerely,
--
Mark A. Mandel, Research Administrator
Linguistic Data Consortium
University of Pennsylvania
3600 Market Street, Suite 810, rm.125
Philadelphia, PA, 19104-2653, USA
ph: 215-573-5615
fax: 215-573-2175