什么版本的 Perl 引入了 try/catch?
What version of Perl introduced try / catch?
我知道 Perl 最近得到了 try
/ catch
。它附带什么版本的 Perl?
- 作为
experimental
feature:Perl 5.34 版是第一个支持本机 try catch 的 Perl 版本。
- 除实验模式外,尚无 Perl 版本支持它。 There is an open issue tracking the development and maturation of the feature until it is released as stable.
最常被忽略的 perlexperiment 页面列出了添加的功能以及(有时)后来从实验类别中毕业的功能。您还可以查看功能何时被删除。
如果你使用 perldoc.perl.org 的版本,你可能总是在阅读最新版本的稳定文档(可能在发布后几天就关闭),所以你不需要依赖您的本地文档。但是,如果它不在您的本地文档中,则说明您的 Perl 没有它。 :)
同样,feature.pm docs 显示每个功能的名称、适当时的实验性警告名称,以及每个功能显示在哪个版本捆绑包中。也就是说,当您包含 use v5.x
,自动包含哪些功能。
experimental pragma(从 v5.18 开始)以同样的方式有用,也许是对所有内容的更好总结。而不是这两行:
use feature qw(try);
no warnings qw(experimental::try);
你有这一行:
use experimental qw(try);
当您关闭多个功能警告时,这会更加方便,因为您无需在每个警告之前键入 experimental::
:
use experimental qw(signatures try);
我知道 Perl 最近得到了 try
/ catch
。它附带什么版本的 Perl?
- 作为
experimental
feature:Perl 5.34 版是第一个支持本机 try catch 的 Perl 版本。 - 除实验模式外,尚无 Perl 版本支持它。 There is an open issue tracking the development and maturation of the feature until it is released as stable.
最常被忽略的 perlexperiment 页面列出了添加的功能以及(有时)后来从实验类别中毕业的功能。您还可以查看功能何时被删除。
如果你使用 perldoc.perl.org 的版本,你可能总是在阅读最新版本的稳定文档(可能在发布后几天就关闭),所以你不需要依赖您的本地文档。但是,如果它不在您的本地文档中,则说明您的 Perl 没有它。 :)
同样,feature.pm docs 显示每个功能的名称、适当时的实验性警告名称,以及每个功能显示在哪个版本捆绑包中。也就是说,当您包含 use v5.x
,自动包含哪些功能。
experimental pragma(从 v5.18 开始)以同样的方式有用,也许是对所有内容的更好总结。而不是这两行:
use feature qw(try);
no warnings qw(experimental::try);
你有这一行:
use experimental qw(try);
当您关闭多个功能警告时,这会更加方便,因为您无需在每个警告之前键入 experimental::
:
use experimental qw(signatures try);