《野人岛3》流程攻略 平原天空关卡怎么过啊?

《天空 》

jessie jessie
回答
  • 北宗文东 北宗文东

    存档为/perl根目录/site/lib/my/module1.pm;package my:module1;sub new {
    bless{
    var1=>"value for var1
    },shift#创建物件及其属性,然后回传到主程序
    }
    sub getvar1 {
    my$class=shift;return$class->{var1}
    }
    1;这句很重要!然后这个模块就可以用了,以上是 perl oo 的典型例子,另一种则是非 oo 的形式
    存档为/perl根目录/site/lib/my/module2.pm;package my:module2;require exporter;our@**a=qw/exporter/;our@export=qw/printitems/;外边要靠这个才能直接呼叫此模块里的涵数
    sub printitems {
    my@items=_;print"@items
    }
    1;这句真的很重要!现在来到你自己的主程序,main.pl
    perl
    use my:module1;use my:module2;object=my:module->new();print$object->getvar1;value for var1
    getvar1()是来自 my:module1 的物件的方法
    printitems('a'.'e');a b c d e
    printitems()是 export 自 my:module2 的涵数

类似问答
精品推荐

友情链接

友链互换QQ:

谷财 备案编号:蜀ICP备11019336号-3商务合作:235-677-2621

Copyright 2009-2020 Chengdu Sanzilewan Technology Co.,Ltd all rights reserve

抵制不良游戏 拒绝盗版游戏 注意自我保护 谨防受骗上当 适度游戏益脑 沉迷游戏伤身 合理安排时间 享受健康生活