Perl 好像坏了:“=: not found"和“包:未找到" [英] Perl seems to have broken: "=: not found" and "package: not found"

查看:59
本文介绍了Perl 好像坏了:“=: not found"和“包:未找到"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 perl 脚本;在我的个人机器上,运行完全相同版本的 perl (5.10.1),它运行得非常好.但是,在服务器计算机上,它不仅无法运行,而且还出现奇怪的错误.直到最近它都运行良好,我确实检查了所需的软件包是否已安装.

I have a perl script; on my personal machine, running the exact same version of perl (5.10.1), it runs perfectly fine. However, on the server machine, it not only doesn't run, it gives me odd errors. It ran fine until recently, and I did check that the packages required are installed.

脚本的开头(窒息的地方):

The beginning of the script (where it chokes):

#!/usr/bin/perl
package Hermes;
$VERSION = 3.5;

use FindBin qw($Bin);
push @INC,$Bin;
push @INC ,"/usr/local/lib/perl5/site_perl/5.10.1/";

require("Hermes_config.pm");
$install_Directory = $Config::install_Directory;
push @INC,$install_Directory; #Fix for running from rc.local

use warnings;
#use strict;
use Safe;
use POE;
use POE::Component::IRC;
use Module::Reload;
use Math::Expression::Evaluator;

输出:

Hermes3.0/hermes3.5.pl: 17: package: not found
Hermes3.0/hermes3.5.pl: 18: =: not found
Hermes3.0/hermes3.5.pl: 20: Syntax error: "(" unexpected

(程序开始前有 15 行带注释的开源版权声明,因此是行号).

(there's 15 lines of commented open-source copyright notice before the program begins, hence the line numbers).

POE、Module::Reload 和 Math::Expression::Evaluator 已安装(根据 instmodsh),cpan 告诉我 FindBin 是最新的,重新安装 Safe 没有帮助,所以它似乎不是丢失的包 - 除此之外,它并没有告诉我丢失的包名称,它似乎被包"这个词窒息了.重新安装 Perl 没有帮助(使用 apt-get install --reinstall perl).

POE, Module::Reload, and Math::Expression::Evaluator are installed (according to instmodsh), cpan tells me FindBin is up to date, reinstalling Safe didn't help, so it doesn't seem to be a missing package - besides which, it's not telling me a package name that's missing, it appears to be choking on the word "package". Reinstalling Perl didn't help (using apt-get install --reinstall perl).

我最近升级了机器的ubuntu版本;很可能把事情搞砸了,所以任何关于从哪里开始寻找的提示都将不胜感激.

I recently upgraded the machine's version of ubuntu; it's very possible that messed something up, so any hint as to where to start looking would be appreciated.

推荐答案

问题是 bash 试图运行/编译/解释脚本,而不是 perl.

The issue is that bash is trying to run/compile/interpret the script, rather than perl.

#! /usr/bin/perl

应该在文件的最顶部,不要在上面放东西.

should be at the very top of your file, don't have stuff above it.

这篇关于Perl 好像坏了:“=: not found"和“包:未找到"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆