What's wrong with this Perl module?

谁都会走 提交于 2019-12-24 08:47:58

问题


I am making a very, very simple module (it is the first I've ever wrote):

package Master::Math;
use 5.12.4;
use strict;
use warnings;

require Exporter;

our @ISA = qw(Exporter)

our %EXPORT_TAGS = ( 
    'all' => [ qw(
        max



=cut

1; # End of Master::Math

When I run use this in my program, I get the error

Invalid version format (non-numeric data) at C:/Perl/lib/Master/Math.pm line 3, near "package Master::Math

" syntax error at C:/Perl/lib/Master/Math.pm line 3, near "package Master::Math

require Exporter" Compilation failed in require at C:\MainDev\myperl\max.pl line 3. BEGIN failed--compilation aborted at C:\MainDev\myperl\max.pl line 3.

What do I need to fix this? Thanks!


回答1:


You're missing a semicolon on the declaration of @ISA.

In sub max, $foo is undeclared; use foreach my $foo ....

That should get it to compile. I haven't looked beyond that.

(BTW, I didn't get the same errors you did. I used perl 5.14.0, perl -cw master-math.pm.)



来源:https://stackoverflow.com/questions/8204809/whats-wrong-with-this-perl-module

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!