Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Test-Synopsis CPAN distribution.

Report information
The Basics
Id: 76856
Status: resolved
Priority: 0/
Queue: Test-Synopsis

People
Owner: Nobody in particular
Requestors: RWSTAUNER [...] cpan.org
Cc:
AdminCc:

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



Subject: Sandbox breaks when combining synopses that use Moose and Moose::Role
'all_synopsis_ok' can have issues if the synopsis of one module breaks something in the sandbox package for the synopsis of another. For example, running the test in a dist that has one module whose Synopsis has 'use Moose;' and another module has 'use Moose::Role;' the whole thing dies: You can reproduce with something like: perl -MTest::Synopsis -e 'use strict; print Test::Synopsis::_compile("use $_;") || $@ for qw(Moose Moose::Role)' Test::Synopsis::Sandbox already has a metaclass, but it does not inherit Moose::Meta::Role (Moose::Meta::Class=HASH(0x134bc98)). You cannot make the same thing a role and a class. Remove either Moose or Moose::Role. at /home/rando/perl5/perlbrew/perls/5.14.2-st/lib/site_perl/5.14.2/x86_64-linux-thread-multi/Moose/Role.pm line 129. Moose::Role::init_meta('Moose::Role', 'for_class', 'Test::Synopsis::Sandbox', 'metaclass', undef, 'meta_name', 'meta') called at /home/rando/perl5/perlbrew/perls/5.14.2-st/lib/site_perl/5.14.2/x86_64-linux-thread-multi/Moose/Exporter.pm line 435 Moose::Exporter::__ANON__('Moose::Role') called at (eval 244) line 1 Test::Synopsis::Sandbox::BEGIN() called at (eval 244) line 1 eval {...} called at (eval 244) line 1 eval 'use Moose::Role;' called at /home/rando/perl5/perlbrew/perls/5.14.2-st/lib/site_perl/5.14.2/Test/Synopsis.pm line 39 Test::Synopsis::_compile('use Moose::Role;') called at -e line 1 BEGIN failed--compilation aborted at (eval 244) line 1. The attached patch uses a simple increment which seems fix the one-liner, though I haven't yet produced a reliable test script to go with it. perl 5.14.2, Test::Synopsis 0.06
Subject: test-synopsis-sandbox-increment.patch
diff --git a/lib/Test/Synopsis.pm b/lib/Test/Synopsis.pm index fedeacd..14d8767 100644 --- a/lib/Test/Synopsis.pm +++ b/lib/Test/Synopsis.pm @@ -33,10 +33,11 @@ sub synopsis_ok { } } +my $sandbox = 0; sub _compile { package Test::Synopsis::Sandbox; - eval $_[0]; ## no critic + eval sprintf "package\nTest::Synopsis::Sandbox%d;\n%s", ++$sandbox, $_[0]; ## no critic } sub extract_synopsis {
Thanks for the patch! Applied and made the test. Pushed to the repo (zoffix/fix-all-RT-bugs branch). Will release to CPAN soon. -- Cheers, ZZ [ https://metacpan.org/author/ZOFFIX ]
Resolved in version 0.7 which is now on CPAN: https://metacpan.org/release/ZOFFIX/Test-Synopsis-0.07 -- Cheers, ZZ [ https://metacpan.org/author/ZOFFIX ]