执行脚本时出现软件错误Perl

时间:2014-03-12 17:26:25

标签: perl

大家好我有问题

当我执行Perl脚本时,这是错误:

Software error:
CybOrg::Exception=HASH(0x1b65358)BEGIN failed--compilation aborted at CybOrg/DB.pm line 182.
Compilation failed in require at /var/www/cyborg/cyborg.pl line 30.
BEGIN failed--compilation aborted at /var/www/cyborg/cyborg.pl line 30.

以下是db.pm

抱歉这个新手问题。这不是我的代码。

提前致谢..

ADD

当我将其运行到浏览器中

内部服务器错误

当我执行终端

    DB Error:db_connect
Params:HASH(0x1996098)

Status: 500
Content-type: text/html

<h1>Software error:</h1>
<pre>CybOrg::Exception=HASH(0x198d378)BEGIN failed--compilation aborted at CybOrg/DB.pm line 182.
Compilation failed in require at cyborg.pl line 30.
BEGIN failed--compilation aborted at cyborg.pl line 30.
</pre>
<p>
For help, please send mail to this site's webmaster, giving this error message
and the time and date of the error.

</p>
[Wed Mar 12 17:30:44 2014] cyborg.pl: CybOrg::Exception=HASH(0x198d378)BEGIN failed--compilation aborted at CybOrg/DB.pm line 182.
[Wed Mar 12 17:30:44 2014] cyborg.pl: Compilation failed in require at cyborg.pl line 30.
[Wed Mar 12 17:30:44 2014] cyborg.pl: BEGIN failed--compilation aborted at cyborg.pl line 30.

我不知道如何解决它。 我希望有人会帮助我.. 提前致谢

1 个答案:

答案 0 :(得分:2)

_connect无法连接到数据库。通过对CybOrb文件进行一些更改,可以获得确切的原因。

  1. 将以下内容添加到CybOrg/Exception.pm,以便发出比CybOrg::Exception=HASH(0x1b65358)更有意义的内容:

    use Data::Dumper qw( );
    
    use overload '""' => sub {
        my ($self) = @_;
        local $Data::Dumper::Useqq = 1;
        local $Data::Dumper::Terse = 1;
        local $Data::Dumper::Indent = 0;
        return
           "Error performing $self->{error_code} (" .
           Data::Dumper::Dumper($self->{error_params}) .
           ")";
    };
    
  2. 它仍然没那么有意义,因为事实证明在这种情况下实际的错误消息永远不会放在:: Exception对象中。为此,请从CybOrg/DB.pm更改

    中的第62-64行
    _exception('db_connect', {'host' => "$database{'host'}",
                              'port' => "$database{'port'}",
                              'user' => "$database{'user'}"});
    

    _exception('db_connect', {'error' => $@,
                              'host' => "$database{'host'}",
                              'port' => "$database{'port'}",
                              'user' => "$database{'user'}"});