Data-Dump-Streamer
view release on metacpan or search on metacpan
313314315316317318319320321322323324325326327328329330331332333
perl Makefile.PL NODDS [STANDARD OPTS]
1.06
Added additional support
for
utf8 and some minor doc fixes. Thanks to
Yitzchak yet again
for
the patches and advice.
1.05
Added support
for
locked hashes. Probably there are still bugs in here,
but
for
now it looks good. Thanks to Yitzchak
for
pointing out this wasn't
implemented.
Also started adding support
for
a
"smart indent mode"
. Try using Indent(1)
instead of Indent(2).
1.03, 1.04
Enhanced
format
support
for
FORMAT refs. Yitzchak pointed out some
bugs in the original handling. DeparseFormat()
has
been removed. It
151617181920212223242526272829303132333435README.md
t/as.t
t/blessed.t
t/dogpound.t
t/
dump
.t
t/filter.t
t/globtest.t
t/hardrefs.t
t/impure_madness.t
t/lexicals.t
t/locked.t
t/madness.t
t/madness_json.t
t/madness_w.t
t/names.t
t/overload.t
t/readonly.t
t/refaddr.t
t/refcount.t
t/refelem.t
t/reftype.t
1112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181# use this one for simple, non evalable tests. (GLOB)
# same ( $got,$expected,$name,$obj )
#
# use this one for eval checks and dumper checks but NOT for GLOB's
# same ( $name,$obj,$expected,@args )
my
$dump
;
my
$o
= Data::Dump::Streamer->new();
isa_ok(
$o
,
'Data::Dump::Streamer'
);
SKIP: {
skip
"No locked hashes before 5.8.0"
,
$TESTS
if
$] < 5.008;
skip
"Can't tell which keys are locked before 5.8.1"
,
$TESTS
if
$] == 5.008;
{
my
%h
= (
'a0'
..
'a9'
);
lock_keys(
%h
);
test_dump({
name
=>
"locked_ref_keys"
,
verbose
=> 1
},
$o
,
(\
%h
),
<<'EXPECT',);
$HASH1 = lock_ref_keys( {
a0 => 'a1',
a2 => 'a3',
a4 => 'a5',
a6 => 'a7',
a8 => 'a9'
} );
EXPECT
delete
(
@h
{
qw(a2 a6)
});
test_dump({
name
=>
"locked_ref_keys_plus"
,
verbose
=> 1
},
$o
,
(\
%h
),
<<'EXPECT',);
$HASH1 = lock_ref_keys_plus( {
a0 => 'a1',
a4 => 'a5',
a8 => 'a9'
}, 'a2', 'a6' );
EXPECT
}
{
my
%h
= (
'a0'
..
'a9'
);
lock_keys(
%h
);
test_dump({
name
=>
"locked_keys"
,
verbose
=> 1
},
$o
->Names(
'*h'
),
(\
%h
),
<<'EXPECT',);
%h = (
a0 => 'a1',
a2 => 'a3',
a4 => 'a5',
a6 => 'a7',
a8 => 'a9'
);
lock_keys( %h );
EXPECT
delete
(
@h
{
qw(a2 a6)
});
test_dump({
name
=>
"locked_keys_plus"
,
verbose
=> 1
},
$o
,
(\
%h
),
<<'EXPECT',);
%h = (
a0 => 'a1',
a4 => 'a5',
a8 => 'a9'
);
lock_keys_plus( %h, 'a2', 'a6');
EXPECT
$o
->Names();
}
{
my
$h
=
bless
{
'a0'
..
'a9'
},
'locked'
;
lock_keys(
%$h
);
test_dump({
name
=>
"blessed locked_ref_keys"
,
verbose
=> 1
},
$o
,
(\
%$h
),
<<'EXPECT',);
$locked1 = lock_ref_keys( bless( {
a0 => 'a1',
a2 => 'a3',
a4 => 'a5',
a6 => 'a7',
a8 => 'a9'
}, 'locked' ) );
EXPECT
delete
(
@$h
{
qw(a2 a6)
});
test_dump({
name
=>
"blessed locked_ref_keys_plus"
,
verbose
=> 1
},
$o
,
(\
%$h
),
<<'EXPECT',);
$locked1 = lock_ref_keys_plus( bless( {
a0 => 'a1',
a4 => 'a5',
a8 => 'a9'
}, 'locked' ), 'a2', 'a6' );
EXPECT
}
{
my
$h
=
bless
{
'a0'
..
'a9'
},
'locked'
;
lock_keys(
%$h
);
test_dump({
name
=>
"blessed locked_keys"
,
verbose
=> 1
},
$o
->Names(
'*h'
),
(
$h
,
$h
),
<<'EXPECT',);
%h = (
a0 => 'a1',
a2 => 'a3',
a4 => 'a5',
a6 => 'a7',
a8 => 'a9'
);
$locked1 = bless( \%h, 'locked' );
lock_keys( %h );
EXPECT
delete
(
@$h
{
qw(a2 a6)
});
test_dump({
name
=>
"blessed locked_keys_plus"
,
verbose
=> 1
},
$o
,
(
$h
,
$h
),
<<'EXPECT',);
%h = (
a0 => 'a1',
a4 => 'a5',
a8 => 'a9'
);
$locked1 = bless( \%h, 'locked' );
lock_keys_plus( %h, 'a2', 'a6');
EXPECT
$o
->Names();
}
{
my
$x
= 0;
my
%hashes
=
map
{
$_
=> lock_ref_keys_plus({
foo
=>
$_
},
$x
++) } 1 .. 10;
lock_keys_plus(
%hashes
, 10 .. 19);
test_dump({
name
=>
"blessed locked_keys_plus"
,
verbose
=> 1
},
$o
,
(\
%hashes
),
<<
'EXPECT'
,);
$HASH1
= lock_ref_keys_plus( {
1
=> lock_ref_keys_plus( {
foo
=> 1 }, 0 ),
2
=> lock_ref_keys_plus( {
foo
=> 2 }, 1 ),
3
=> lock_ref_keys_plus( {
foo
=> 3 }, 2 ),
4
=> lock_ref_keys_plus( {
foo
=> 4 }, 3 ),
t/xs_subs.t view on Meta::CPAN
242526272829303132333435363738394041424344454647484950515253ok(!readonly(
$var
),
'$var = fred; readonly($var)'
);
ok(
$var
eq
"fred"
,
'$var eq "fred"'
);
$var
= \2;
ok(!readonly(
$var
),
'$var=\2; readonly($var)'
);
ok(readonly(
$$var
),
'readonly($$var)'
);
ok(!readonly(
*STDOUT
),
'readonly(*STDOUT)'
);
# new
SKIP: {
skip
"No locked key semantics before 5.8.0"
,
$XTRA
if
$] < 5.008;
{
my
%hash
=
map
{
$_
=> 1 }
qw( a b c d e f)
;
delete
$hash
{c};
lock_keys(
%hash
);
ok(Internals::SvREADONLY(
%hash
),
'lock_keys'
);
# we do this skip here just to make sure lock_keys is correctly setup.
skip
"Cant tell if a key is locked in 5.8.0"
,
$XTRA
- 1
if
$] == 5.008;
delete
@hash
{
qw(b e)
};
my
@hidden
=
sort
(hidden_keys(
%hash
));
my
@legal
=
sort
(legal_keys(
%hash
));
my
@keys
=
sort
(
keys
(
%hash
));
#warn "@legal\n@keys\n";
is(
"@hidden"
,
"b e"
,
'lock_keys @hidden'
);
is(
"@legal"
,
"a b d e f"
,
'lock_keys @legal'
);
( run in 0.510 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )