Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the PPI CPAN distribution.

Report information
The Basics
Id: 13595
Status: resolved
Worked: 1 hour (60 min)
Priority: 0/
Queue: PPI

People
Owner: adamk [...] cpan.org
Requestors: johanl [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.996
Fixed in: (no value)



Subject: Document requires Storable support
Storable freeze + thaw doesn't render identical behavuour. I've attached the test as we talked about. Gotta run.
#!/usr/bin/perl -w # use strict; use lib (); use UNIVERSAL 'isa'; use File::Spec::Functions ':ALL'; BEGIN { $| = 1; unless ( $ENV{HARNESS_ACTIVE} ) { require FindBin; $FindBin::Bin = $FindBin::Bin; # Avoid a warning chdir catdir( $FindBin::Bin, updir() ); lib->import('blib', 'lib'); } } # Load the code to test use Class::Autouse ':devel'; BEGIN { $PPI::XS_DISABLE = 1 } use PPI::Document (); use Storable qw/dclone/; # Execute the tests use Test::More tests => 100; use Scalar::Util 'refaddr'; ##################################################################### # Test freeze/thaw of PPI::Document objects { # Create a document with various example package statements my $Document = PPI::Lexer->lex_source( <<'END_PERL' ); package Foo; @ISA = (qw/File::Spec/); 1; END_PERL isa_ok( $Document, 'PPI::Document' ); print "\nDo it with normally\n"; ok(my $variableIsa = $Document->find_first(sub { $_[1] eq '@ISA'; }), "Found ISA var"); is($variableIsa->parent, q|@ISA = (qw/File::Spec/);|, "Got parent ok"); print "\nDo it with a cloned (freeze+thaw) document\n"; ok(my $CloneDocument = dclone($Document), "dclone ok"); is(ref($CloneDocument), ref($Document), " same class"); ok(my $cloneVariableIsa = $CloneDocument->find_first(sub { $_[1] eq '@ISA'; }), "Found ISA var"); is($cloneVariableIsa->parent, q|@ISA = (qw/File::Spec/);|, "Got parent ok"); # <-- this one fails } 1;