使用父母“出口商”与使用出口商的“进口”;

编程入门 行业动态 更新时间:2024-10-13 16:21:51
本文介绍了使用父母“出口商”与使用出口商的“进口”;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

package Some :: Module; 使用strict; 使用5.10.1; 使用父出口商; 我们的@EXPORT_OK = qw(some_func);

一些::模块; 使用strict; 使用5.10.0; use Exporter'import'; 我们的@EXPORT_OK = qw(some_func);

解决方案

没有,真的。出口商最初被设想为基层工作;之后它被增强,允许你只是导入它的导入方法。现在没有理由继承。

如果您正在编写可能与Perl 5.8.2及更早版本一起使用的代码,则需要足够的出口商版本:

使用出口商5.57'import';

What do I gain if I use the first example instead of the second example?

package Some::Module; use strict; use 5.10.1; use parent 'Exporter'; our @EXPORT_OK = qw(some_func);

package Some::Module; use strict; use 5.10.0; use Exporter 'import'; our @EXPORT_OK = qw(some_func);

解决方案

Nothing, really. Exporter was originally envisioned to work as a base class; later it was enhanced to allow you to just import its import method. There is no reason to inherit from it now.

If you are writing code that may be used with Perl 5.8.2 and earlier, you should require a sufficient version of Exporter:

use Exporter 5.57 'import';

更多推荐

使用父母“出口商”与使用出口商的“进口”;

本文发布于:2023-05-29 03:35:15,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/335838.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:出口商   父母

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!