Data-Dump-Streamer

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
  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

MANIFEST  view on Meta::CPAN

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
README.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

t/locked.t  view on Meta::CPAN

11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# 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

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
ok(!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 )