perl5120delta — что нового в perl v.5.12.0

Jesse Vincent, “perl5120delta - what is new for perl v5.12.0”, public translation into Russian from English More about this translation.

See also 34 similar translations

Translate into another language.

Participants

perl5doc.ru198 points
dionys68 points
Join Translated.by to translate! If you already have a Translated.by account, please sign in.
If you do not want to register an account, you can sign in with OpenID.
Pages: ← previous Ctrl next next untranslated

perl5120delta - what is new for perl v5.12.0

perl5120delta — что нового в perl v.5.12.0

History of edits (Latest: dionys 1 year, 6 months ago) §

=encoding utf8

=encoding utf8

History of edits (Latest: perl5doc.ru 1 year, 7 months ago) §

=head1 NAME

=head1 НАЗВАНИЕ

History of edits (Latest: perl5doc.ru 1 year, 7 months ago) §

perl5120delta - what is new for perl v5.12.0

perl5120delta — что нового в perl v.5.12.0

History of edits (Latest: dionys 1 year, 6 months ago) §

=head1 DESCRIPTION

=head1 ОПИСАНИЕ

History of edits (Latest: perl5doc.ru 1 year, 7 months ago) §

This document describes differences between the 5.10.0 release and the
5.12.0 release.

В этом документе описываются различия между версиями perl 5.10.0 и perl 5.12.0

History of edits (Latest: perl5doc.ru 1 year, 7 months ago) §

Many of the bug fixes in 5.12.0 are already included in the 5.10.1
maintenance release.

Многие из ошибок, исправленные в 5.12.0 уже включены в perl 5.10.1.

History of edits (Latest: perl5doc.ru 1 year, 7 months ago) §

You can see the list of those changes in the 5.10.1 release notes
(L<perl5101delta>).

Посмотреть список этих изменений можно в документе L<perl5101delta>.

History of edits (Latest: perl5doc.ru 1 year, 6 months ago) §

=head1 Core Enhancements

Коренные изменения

History of edits (Latest: perl5doc.ru 1 year, 7 months ago) §

=head2 New C<package NAME VERSION> syntax

=head2 Новый синтаксис C<package NAME VERSION>

History of edits (Latest: perl5doc.ru 1 year, 7 months ago) §

This new syntax allows a module author to set the $VERSION of a namespace
when the namespace is declared with 'package'. It eliminates the need
for C<our $VERSION = ...> and similar constructs. E.g.

Новый синтасис позволяет автору модуля при объявлении пакета указывать его версию Это устраняет необходимость в C<our $VERSION = ...> и других аналогичных конструкциях.

History of edits (Latest: perl5doc.ru 1 year, 7 months ago) §

package Foo::Bar 1.23;
# $Foo::Bar::VERSION == 1.23

package Foo::Bar 1.23;
# $Foo::Bar::VERSION == 1.23

History of edits (Latest: perl5doc.ru 1 year, 7 months ago) §

There are several advantages to this:

Это дает ряд преимуществ:

History of edits (Latest: perl5doc.ru 1 year, 7 months ago) §

=over

=over

History of edits (Latest: perl5doc.ru 1 year, 7 months ago) §

=item *

=item *

History of edits (Latest: perl5doc.ru 1 year, 7 months ago) §

C<$VERSION> is parsed in exactly the same way as C<use NAME VERSION>

C<$VERSION> анализируется точно так же, как C<use NAME VERSION>

History of edits (Latest: perl5doc.ru 1 year, 7 months ago) §

=item *

=item *

History of edits (Latest: perl5doc.ru 1 year, 7 months ago) §

C<$VERSION> is set at compile time

C<$VERSION> устанавливается во время компиляции

History of edits (Latest: perl5doc.ru 1 year, 7 months ago) §

=item *

=item *

History of edits (Latest: perl5doc.ru 1 year, 7 months ago) §

C<$VERSION> is a version object that provides proper overloading of
comparison operators so comparing C<$VERSION> to decimal (1.23) or
dotted-decimal (v1.2.3) version numbers works correctly.

C<$VERSION> представляет собой версию объекта, который обеспечивает
надлежащую перезагрузку операторов сравнения, таким образом
сравнение C<$VERSION> с числами в десятичном (1.23) или
точечно-десятичным(v.1.2.3) формате работает правильно.

History of edits (Latest: perl5doc.ru 1 year, 7 months ago) §

=item *

=item *

History of edits (Latest: perl5doc.ru 1 year, 7 months ago) §

Eliminates C<$VERSION = ...> and C<eval $VERSION> clutter

Исключает беспорядок C<$VERSION = ...> и C<eval $VERSION>

History of edits (Latest: perl5doc.ru 1 year, 7 months ago) §

=item *

=item *

History of edits (Latest: perl5doc.ru 1 year, 7 months ago) §

As it requires VERSION to be a numeric literal or v-string
literal, it can be statically parsed by toolchain modules
without C<eval> the way MM-E<gt>parse_version does for C<$VERSION = ...>

Как она требует VERSION, которая будет числовым литералом или v-образным строковым литералом, он может статически интерпретироваться средствами компиляции модулей без C<eval> путем MM-E<gt>parse_version для C<$VERSION = ...>

History of edits (Latest: perl5doc.ru 1 year, 7 months ago) §

=back

=back

History of edits (Latest: perl5doc.ru 1 year, 7 months ago) §

It does not break old code with only C<package NAME>, but code that uses
C<package NAME VERSION> will need to be restricted to perl 5.12.0 or newer
This is analogous to the change to C<open> from two-args to three-args.
Users requiring the latest Perl will benefit, and perhaps after several
years, it will become a standard practice.

It does not break old code with only

History of edits (Latest: perl5doc.ru 1 year, 6 months ago) §

However, C<package NAME VERSION> requires a new, 'strict' version
number format. See L<"Version number formats"> for details.

=head2 The C<...> operator

A new operator, C<...>, nicknamed the Yada Yada operator, has been added.
It is intended to mark placeholder code that is not yet implemented.
See L<perlop/"Yada Yada Operator">.

=head2 Implicit strictures

Using the C<use VERSION> syntax with a version number greater or equal
to 5.11.0 will lexically enable strictures just like C<use strict>
would do (in addition to enabling features.) The following:

Pages: ← previous Ctrl next next untranslated