+ -
当前位置:首页 → 问答吧 → 自己写的package,要加这句吗our @ISA = qw(Exporter);

自己写的package,要加这句吗our @ISA = qw(Exporter);

时间:2011-02-11

来源:互联网

看到lib下面的package很多都带这一句,自己封装了个package,是不是也应该加上?

作者: yakczh   发布时间: 2011-02-11

In module YourModule.pm:

     package YourModule;
     require Exporter;
     @ISA = qw(Exporter);
     @EXPORT_OK = qw(munge frobnicate);  # symbols to export on request

   or

     package YourModule;
     use Exporter 'import'; # gives you Exporter's import() method directly
     @EXPORT_OK = qw(munge frobnicate);  # symbols to export on request

perldoc中的Exporter的解释

作者: yakczh   发布时间: 2011-02-11