加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

自己写perl 模块

发布时间:2020-12-15 23:49:52 所属栏目:大数据 来源:网络整理
导读:今天终于知道perl模块的基本写法和调用方法了!不过还是有很多地方不懂,慢慢来!先把今天的成果记录下来! 模块文件: test_module.pm 调用文件: perl_test.pl 先是调用文件: #!perl# perl_test.pluse test_module;test_1;tess_2;# test_4; 下面是模块的定

今天终于知道perl模块的基本写法和调用方法了!不过还是有很多地方不懂,慢慢来!先把今天的成果记录下来!

模块文件: test_module.pm

调用文件: perl_test.pl


先是调用文件:

#!perl

# perl_test.pl

use test_module;

test_1;
tess_2;
# test_4;

下面是模块的定义文件:

#!perl

# test_module.pm 

package test_module;    # must
require Exporter;       # must

@ISA = Exporter;
@EXPORT = qw(test_1 test_2 test_3);   # export these symble

sub test_1 {
	print "call test_1 () rn";
}

sub test_2 {
	print "call test_2 () rn";
}

sub test_3 {
	print "call test_3 () rn";
}

sub test_4 {
	print "hay ! don't wake me!!!! rn";
}

1;

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读