Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

t/00_base/06_dancer_object.t fails if FamilyTreeInfo-2.3.24 is installed #1127

Closed
eserte opened this issue Sep 20, 2015 · 7 comments · Fixed by #1128
Closed

t/00_base/06_dancer_object.t fails if FamilyTreeInfo-2.3.24 is installed #1127

eserte opened this issue Sep 20, 2015 · 7 comments · Fixed by #1128

Comments

@eserte
Copy link
Contributor

eserte commented Sep 20, 2015

On some systems the Dancer testsuite fails:

Missing initializer label for Person: 'id'.
Fatal error in constructor call at t/00_base/06_dancer_object.t line 21.
# Looks like your test exited with 2 before it could output anything.
t/00_base/06_dancer_object.t ........................ 
Dubious, test returned 2 (wstat 512, 0x200)
Failed 19/19 subtests 

This happens if Person.pm from FamilyTreeInfo-2.3.24 is installed. For some reason this module will be loaded in the test suite...

@ambs
Copy link
Member

ambs commented Sep 20, 2015

Ahahaha! (sorry!, but couldn't resist)

But I have no clue why Perl would try to load Person from the system. There is no use line. The module Person is defined in-line. I have no magic-fu enough to understand what is going on :-/

@eserte
Copy link
Contributor Author

eserte commented Sep 20, 2015

A smaller test case. Make sure that there's somewhere a Person.pm (not necessarily from FamilyTreeInfo):

$ perl5.20.3 -Mblib=../FamilyTreeInfo-2.3.24-7lmpD7 -e '{package Person; use base "Dancer::Object"; } {package Person::Child; use base "Person"} Person->new'
Missing initializer label for Person: 'id'.
Fatal error in constructor call at -e line 1.

Workaround: make base.pm think that the Person package really exists:

$ perl5.20.3 -Mblib=../FamilyTreeInfo-2.3.24-7lmpD7 -e '{package Person; use base "Dancer::Object"; } BEGIN { $INC{"Person.pm"}="foo" } {package Person::Child; use base "Person"} Person->new'
(no failure)

@ambs
Copy link
Member

ambs commented Sep 20, 2015

Can this be a base bug that can be fixed upstream?

@eserte
Copy link
Contributor Author

eserte commented Sep 20, 2015

Yes, this smells like a base bug. I am right now searching the net...

Before you try: use parent has the same problem. But parent has the -norequire switch which would make the problem go away.

@ambs
Copy link
Member

ambs commented Sep 20, 2015

I recall reading some time ago one of those as being lighter than the other, but can't remember which was what.

@eserte
Copy link
Contributor Author

eserte commented Sep 20, 2015

parent is lighter. And base is by now marked as discouraged in favor of parent. But both are documented to require the parent module.

I think it's best to use parent -norequire => "Person" here. parent is already a prereq for Dancer, it seems.

@ambs
Copy link
Member

ambs commented Sep 20, 2015

Do you care to prepare a pull request? That would be great.

eserte added a commit to eserte/Dancer that referenced this issue Sep 20, 2015
This fixes PerlDancer#1127 (an installed Person.pm could interfere with the
inline Person class).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants