Can't subclass Wx::Frame using parent.pm?
Hi, I have tried: package Package::Name; use strict; use warnings; use Wx ':everything'; use parent 'Wx::Frame'; It gives the following error: Can't locate Wx/Frame.pm in @INC (@INC contains: E:/usr/site/lib E:/usr/lib .) at E:/usr/lib/parent.pm line 20. BEGIN failed--compilation aborted at E:\work\lib\Package\Name.pm line 7. The program doesn't giv the error if I use instead: use base 'Wx::Frame'; Is there anything in base.pm which is needed by WxPerl but it isn't offered by parent.pm? Thanks. Octavian
Re: Can't subclass Wx::Frame using parent.pm?
Octavian Rasnita orasn...@gmail.com writes: use parent 'Wx::Frame'; It gives the following error: Can't locate Wx/Frame.pm in @INC (@INC contains: E:/usr/site/lib E:/usr/lib .) at E:/usr/lib/parent.pm line 20. BEGIN failed--compilation aborted at E:\work\lib\Package\Name.pm line 7. ... Is there anything in base.pm which is needed by WxPerl but it isn't offered by parent.pm? parent.pm insists on loading the module as Wx/Frame.pm, while most Wx modules are loaded from other files when you did use Wx. base.pm seems to be much smarter. You can get the desired behaviour by using use parent -norequire, 'Wx::Frame'; (Which I consider an ugly hack...) -- Johan
Re: Can't subclass Wx::Frame using parent.pm?
From: Johan Vromans jvrom...@squirrel.nl Octavian Rasnita orasn...@gmail.com writes: use parent 'Wx::Frame'; It gives the following error: Can't locate Wx/Frame.pm in @INC (@INC contains: E:/usr/site/lib E:/usr/lib .) at E:/usr/lib/parent.pm line 20. BEGIN failed--compilation aborted at E:\work\lib\Package\Name.pm line 7. ... Is there anything in base.pm which is needed by WxPerl but it isn't offered by parent.pm? parent.pm insists on loading the module as Wx/Frame.pm, while most Wx modules are loaded from other files when you did use Wx. Oh yes, Wx uses a strange design and I have forgotten that this could be a problem. :-) base.pm seems to be much smarter. You can get the desired behaviour by using use parent -norequire, 'Wx::Frame'; (Which I consider an ugly hack...) Yes you're right. Better using 'base.pm'... Thank you. Octavian