Chinaunix首页 | 论坛 | 博客
  • 博客访问: 59250
  • 博文数量: 11
  • 博客积分: 687
  • 博客等级: 上士
  • 技术积分: 190
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-10 10:56
文章分类
文章存档

2011年(1)

2010年(10)

分类:

2010-01-19 16:33:43

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!
阅读(2328) | 评论(0) | 转发(0) |
0

上一篇:PF防火墙详解

下一篇:xubuntu 使用笔记

给主人留下些什么吧!~~