Storable
view release on metacpan or search on metacpan
161162163164165166167168169170171172173174175176177178179180# instead so a user setting of either variable more closely matches
# the limits the use sees.
# be fairly aggressive in trimming this, smoke testing showed
# several apparently random failures here, eg. working in one
# configuration, but not in a very similar configuration.
$max_depth
=
int
(0.6 *
$max_depth
);
$max_depth_hash
=
int
(0.6 *
$max_depth_hash
);
my
$stack_reserve
= $^O eq
"MSWin32"
? 32 : 16;
if
($] ge
"5.016"
&& !($^O eq
"cygwin"
&&
$ptrsize
== 8)) {
$max_depth
-=
$stack_reserve
;
$max_depth_hash
-=
$stack_reserve
;
}
else
{
# within the exception we need another stack depth to recursively
# cleanup the hash
$max_depth
= (
$max_depth
>> 1) -
$stack_reserve
;
$max_depth_hash
= (
$max_depth_hash
>> 1) -
$stack_reserve
* 2;
}
232425262728293031323334353637383940414243my
$x
=
chr
(1234);
is(
$x
, ${thaw freeze \
$x
});
# Long scalar
$x
=
join
''
,
map
{
chr
$_
} (0..1023);
is(
$x
, ${thaw freeze \
$x
});
# Char in the range 127-255 (probably) in utf8. This just won't work for
# EBCDIC for early Perls.
$x
= ($] lt 5.007_003) ?
chr
(175) :
chr
(utf8::unicode_to_native(175))
.
chr
(256);
chop
$x
;
is(
$x
, ${thaw freeze \
$x
});
# Storable needs to cope if a frozen string happens to be internal utf8
# encoded
$x
=
chr
256;
my
$data
= freeze \
$x
;
is(
$x
, ${thaw
$data
});
( run in 0.264 second using v1.01-cache-2.11-cpan-a5abf4f5562 )