1 package Devel::PeekPoke::Constants;
9 my $ptr_size = $Config{ptrsize};
10 eval "sub PTR_SIZE () { $ptr_size }";
12 my $ptr_pack_type = do {
16 elsif ($ptr_size == 8) {
20 die "Unsupported \$Config{ptrsize}: $ptr_size\n";
23 eval "sub PTR_PACK_TYPE () { $ptr_pack_type }";
26 my $ivnums = join '', (1 .. $Config{ivsize});
27 if ($Config{byteorder} eq $ivnums ) {
30 elsif ($Config{byteorder} eq scalar reverse $ivnums ) {
34 die "Weird byteorder: $Config{byteorder}\n";
37 eval "sub BIG_ENDIAN () { $big_endian }";
41 our @EXPORT_OK = (qw/PTR_SIZE PTR_PACK_TYPE BIG_ENDIAN/);
45 Devel::PeekPoke::Constants - Some convenience constants based on your machine
49 This module provides some convenience constants based on your machine. It
50 provides the following constants (exportable on request)
54 The size of your pointer, equivalent to L<$Config::ptr_size|Config>.
58 The L<pack|perlfunc/pack> template type suitable for L</PTR_SIZE> pointers.
59 Either C<L> (32 bit) or C<Q> (64 bit).
63 An indicator whether your system is big-endian (constant is set to C<1>) or
64 little-endian (constant is set to C<0>).
68 See L<Devel::PeekPoke/COPYRIGHT>.
72 See L<Devel::PeekPoke/LICENSE>.