Perl与refferrer发生错误 [英] Perl getting an error with refferrer

查看:103
本文介绍了Perl与refferrer发生错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  my $ refer = $ ENV {HTTP_REFERER}; 
my $ gk1 = substr($ str1,-4);
if($ gk1 = .swf){my $ antigk =gk detected; }
else
{my $ antigk = $ link; }

这段代码有什么问题?编辑后出现一些错误:|

是我的第一个Perl代码,所以:|我不知道我做错了什么:|

可能是因为这个

  my $ antigk 

 这是我的新错误:
软件错误:

全局符号$ str1需要在index_dl.pm行680处显式包名。
语法错误在index_dl.pm第682行,在=附近。
语法错误在index_dl.pm第683行,在else附近
全局符号$ antigk需要在index_dl.pm第684行显式包名称。
全局符号$ direct_link需要明确包名称在index_dl.pm第684行。
语法错误在index_dl.pm第727行,在}
附近不能在my的index_dl.pm第731行中使用全局@_,在 = @_
在index_dl.pm第735行的语法错误,在}附近的}
语法错误761行附近的}
在index_dl.pm的语法错误第779行,}
index_dl.pm附近的错误太多。
如需帮助,请发送邮件给本网站的网站管理员,提供此错误消息以及错误的时间和日期。

状态:500内容类型:text / html
软件错误:

[Wed Oct 2 20:40:40 2013] fast_index_dl.cgi:全局符号$ str1需要在index_dl.pm第680行显式包名称。
[Wed Oct 2 20:40:40 2013] fast_index_dl.cgi:语法错误在index_dl.pm第682行,在=附近。
[Wed Oct 2 20:40:40 2013] fast_index_dl.cgi:语法错误在index_dl.pm第683行,在else附近
[Wed Oct 2 20:40:40 2013] fast_index_dl.cgi :全局符号$ antigk需要在index_dl.pm第684行显式包名。
[Wed Oct 2 20:40:40 2013] fast_index_dl.cgi:全局符号$ direct_link需要在index_dl处显式包名。 pm line 684.
[Wed Oct 2 20:40:40 2013] fast_index_dl.cgi:语法错误在index_dl.pm 727行,在}
附近[Wed Oct 2 20:40:40 2013 ] fast_index_dl.cgi:不能在index_dl.pm第731行的my中使用全局@_,靠近= @_
[Wed Oct 2 20:40:40 2013] fast_index_dl.cgi:语法错误在index_dl.pm第735行,靠近}
[Wed Oct 2 20:40:40 2013] fast_index_dl.cgi:语法错误在index_dl.pm第761行,靠近}
[Wed Oct 2 20:40:40 2013] fast_index_dl.cgi:语法错误在index_dl.pm第779行,在}
附近[Wed Oct 2 20:40:40 2013] fast_index_dl.cgi:index_dl.pm有太多错误。
编译在./fast_index_dl.cgi第53行需要编译失败。
如需帮助,请发送邮件给本网站的网站管理员,提供此错误消息以及错误的时间和日期。


解决方案

您可能会在< c $ c> index_dl.pm file:

  use strict; 

这意味着您需要用 my 在你使用它之前:

  my $ str1; 

您可能希望在之前声明 $ antigk 你的if-else块,也许你真的想要:

  my $ antigk = $ link; 
if($ gk1 eq'.swf'){$ antigk =gk detected; }
else
{$ antigk = $ link; }


my $refer = $ENV{HTTP_REFERER};
 my $gk1 = substr($str1, -4); 
if ($gk1 = .swf) { my $antigk = "gk detected"; } 
else 
{ my $antigk = $link; }

what is wrong with this code? i get some errors after editing it :|

is my first perl code so :| i dont know what i did wrong :|

could it be becouse of that

my $antigk

?

THIS is my new error:
Software error:

Global symbol "$str1" requires explicit package name at index_dl.pm line 680.
syntax error at index_dl.pm line 682, near "= ."
syntax error at index_dl.pm line 683, near "else"
Global symbol "$antigk" requires explicit package name at index_dl.pm line 684.
Global symbol "$direct_link" requires explicit package name at index_dl.pm line 684.
syntax error at index_dl.pm line 727, near "}"
Can't use global @_ in "my" at index_dl.pm line 731, near "= @_"
syntax error at index_dl.pm line 735, near "}"
syntax error at index_dl.pm line 761, near "}"
syntax error at index_dl.pm line 779, near "}"
index_dl.pm has too many errors.
For help, please send mail to this site's webmaster, giving this error message and the time and date of the error.

Status: 500 Content-type: text/html
Software error:

[Wed Oct  2 20:40:40 2013] fast_index_dl.cgi: Global symbol "$str1" requires explicit package name at index_dl.pm line 680.
[Wed Oct  2 20:40:40 2013] fast_index_dl.cgi: syntax error at index_dl.pm line 682, near "= ."
[Wed Oct  2 20:40:40 2013] fast_index_dl.cgi: syntax error at index_dl.pm line 683, near "else"
[Wed Oct  2 20:40:40 2013] fast_index_dl.cgi: Global symbol "$antigk" requires explicit package name at index_dl.pm line 684.
[Wed Oct  2 20:40:40 2013] fast_index_dl.cgi: Global symbol "$direct_link" requires explicit package name at index_dl.pm line 684.
[Wed Oct  2 20:40:40 2013] fast_index_dl.cgi: syntax error at index_dl.pm line 727, near "}"
[Wed Oct  2 20:40:40 2013] fast_index_dl.cgi: Can't use global @_ in "my" at index_dl.pm line 731, near "= @_"
[Wed Oct  2 20:40:40 2013] fast_index_dl.cgi: syntax error at index_dl.pm line 735, near "}"
[Wed Oct  2 20:40:40 2013] fast_index_dl.cgi: syntax error at index_dl.pm line 761, near "}"
[Wed Oct  2 20:40:40 2013] fast_index_dl.cgi: syntax error at index_dl.pm line 779, near "}"
[Wed Oct  2 20:40:40 2013] fast_index_dl.cgi: index_dl.pm has too many errors.
Compilation failed in require at ./fast_index_dl.cgi line 53.
For help, please send mail to this site's webmaster, giving this error message and the time and date of the error.

解决方案

You probably have this near the top of your index_dl.pm file:

use strict;

This means that you need to declare each variable with my before you use it:

my $str1;

You probably want to declare $antigkbefore your if-else block and maybe you really want:

my $antigk = $link;
if ($gk1 eq '.swf') { $antigk = "gk detected"; } 
else 
{ $antigk = $link; }

这篇关于Perl与refferrer发生错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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