文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Can't locate object method "new" via package "A::B

Can't locate object method "new" via package "A::B

时间:2010-01-19  来源:cjc921

I'm getting the following error:
Software error:
Can't locate object method "new" via package "A::B" at /path/file.cgi line 5.

My code is basically this:
Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl -w
  2. use strict;
  3. use warnings;
  4. use A::B;
  5. my $test = new A::B;
And in folder A in B.pm:
Expand|Select|Wrap|Line Numbers
  1. package A::B;
  2. use strict;
  3. use warnings;
  4.  
  5. sub new {
  6.     print "Content-type: text/html\n\nHello World!";
  7. }
  8. 1;
Obviously this isn't my real code, but I've simplified it. I didn't misspell the package name and I did define the 'new' method. Furthermore, I'm getting the error only when I test in the browser. I use Komodo IDE and it has a compiler and debugger and in Komodo it runs just fine. Also, my colleague (who's unfortunately away now) runs the same code and it's working for him. 

I realize I'm not giving a lot of information here, but I don't know what else to specify except I'm on Mac OS X Leopard. I would really appreciate any help. If you need any other information, please ask for what you need to know.

Thank you!
排行榜 更多 +
方块枪战战场安卓版

方块枪战战场安卓版

飞行射击 下载
战斗火力射击安卓版

战斗火力射击安卓版

飞行射击 下载
空中防御战安卓版

空中防御战安卓版

飞行射击 下载