Skip to content

Commit 382176c

Browse files
committed
perlfunc/pack: indent verbatim paragraphs consistently
Previously, there was a mix of 1-space, 4-space, 3-space, 7-space, and tab-based indentation. Most of perlfunc uses 4 spaces, so go with that. Also, align the second column in the "This code:" ... "gives this result:" table. To fit within the line length limit (and make podcheck.t happy), use slightly shorter sample strings.
1 parent 079a9d4 commit 382176c

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

pod/perlfunc.pod

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5702,14 +5702,14 @@ the I<length-item> is the string length, not the number of strings. With
57025702
an explicit repeat count for pack, the packed string is adjusted to that
57035703
length. For example:
57045704

5705-
This code: gives this result:
5705+
This code: gives this result:
57065706

5707-
unpack("W/a", "\004Gurusamy") ("Guru")
5708-
unpack("a3/A A*", "007 Bond J ") (" Bond", "J")
5709-
unpack("a3 x2 /A A*", "007: Bond, J.") ("Bond, J", ".")
5707+
unpack("W/a", "\004Gurusamy") ("Guru")
5708+
unpack("a3/A A*", "007 Bond J ") (" Bond", "J")
5709+
unpack("a3 x2 /A A*", "007: Bond, J.") ("Bond, J", ".")
57105710

5711-
pack("n/a* w/a","hello,","world") "\000\006hello,\005world"
5712-
pack("a/W2", ord("a") .. ord("z")) "2ab"
5711+
pack("n/a* w/a", "hi,", "world") "\000\003hi,\005world"
5712+
pack("a/W2", ord("a") .. ord("z")) "2ab"
57135713

57145714
The I<length-item> is not returned explicitly from
57155715
L<C<unpack>|/unpack TEMPLATE,EXPR>.
@@ -5729,10 +5729,10 @@ may be larger. This is mainly an issue on 64-bit platforms. You can
57295729
see whether using C<!> makes any difference this way:
57305730

57315731
printf "format s is %d, s! is %d\n",
5732-
length pack("s"), length pack("s!");
5732+
length pack("s"), length pack("s!");
57335733

57345734
printf "format l is %d, l! is %d\n",
5735-
length pack("l"), length pack("l!");
5735+
length pack("l"), length pack("l!");
57365736

57375737

57385738
C<i!> and C<I!> are also allowed, but only for completeness' sake:
@@ -5750,11 +5750,11 @@ the command line:
57505750

57515751
or programmatically via the L<C<Config>|Config> module:
57525752

5753-
use Config;
5754-
print $Config{shortsize}, "\n";
5755-
print $Config{intsize}, "\n";
5756-
print $Config{longsize}, "\n";
5757-
print $Config{longlongsize}, "\n";
5753+
use Config;
5754+
print $Config{shortsize}, "\n";
5755+
print $Config{intsize}, "\n";
5756+
print $Config{longsize}, "\n";
5757+
print $Config{longlongsize}, "\n";
57585758

57595759
C<$Config{longlongsize}> is undefined on systems without
57605760
long long support.
@@ -5783,14 +5783,14 @@ Peace" by Danny Cohen, USC/ISI IEN 137, April 1, 1980.
57835783

57845784
Some systems may have even weirder byte orders such as
57855785

5786-
0x56 0x78 0x12 0x34
5787-
0x34 0x12 0x78 0x56
5786+
0x56 0x78 0x12 0x34
5787+
0x34 0x12 0x78 0x56
57885788

57895789
These are called mid-endian, middle-endian, mixed-endian, or just weird.
57905790

57915791
You can determine your system endianness with this incantation:
57925792

5793-
printf("%#02x ", $_) for unpack("W*", pack L=>0x12345678);
5793+
printf("%#02x ", $_) for unpack("W*", pack L=>0x12345678);
57945794

57955795
The byteorder on the platform where Perl was built is also available
57965796
via L<Config>:
@@ -5947,9 +5947,9 @@ characters. For example, to L<C<pack>|/pack TEMPLATE,LIST> or
59475947
L<C<unpack>|/unpack TEMPLATE,EXPR> a C structure like
59485948

59495949
struct {
5950-
char c; /* one signed, 8-bit character */
5951-
double d;
5952-
char cc[2];
5950+
char c; /* one signed, 8-bit character */
5951+
double d;
5952+
char cc[2];
59535953
}
59545954

59555955
one may need to use the template C<c x![d] d c[2]>. This assumes that

0 commit comments

Comments
 (0)