my
$bare_treelet
=
[
'B'
, {
'pie'
=>
'no'
},
'a'
,
[
'C'
, {
'bzrok'
=>
'plip'
},
'b'
],
'c'
]
;
my
$treelet
= Pod::Simple::LinkSection->new(
$bare_treelet
);
is
ref
(
$bare_treelet
),
'ARRAY'
;
is
ref
(
$treelet
),
'Pod::Simple::LinkSection'
;
print
"# Testing stringification...\n"
;
is
$treelet
->stringify,
'abc'
;
is
join
(
''
,
$treelet
),
'abc'
;
print
"# Testing non-coreferentiality...\n"
;
{
my
@stack
= (
$bare_treelet
);
my
$this
;
while
(
@stack
) {
$this
=
shift
@stack
;
if
(
ref
(
$this
||
''
) eq
'ARRAY'
) {
push
@stack
,
splice
@$this
;
push
@$this
, (
"BAD!"
) x 3;
}
elsif
(
ref
(
$this
||
''
) eq
'Pod::Simple::LinkSection'
) {
push
@stack
,
splice
@$this
;
push
@$this
, (
"BAD!"
) x 3;
}
elsif
(
ref
(
$this
||
''
) eq
'HASH'
) {
%$this
= ();
}
}
is
$treelet
->stringify,
'abc'
;
is
join
(
''
,
$treelet
),
'abc'
;
}