Revision history for Lexical-Types
+0.13 2014-10-04 23:25 UTC
+ + Add : Support for the PERL_OP_PARENT optional feature introduced in
+ perl 5.21.2.
+ + Doc : The CAVEATS section now warns about the global slowdown during
+ compilation caused by this pragma.
+ + Fix : [RT #86112] : Doesn't hook new PADRANGE op in Perl 5.18.
+ The PADRANGE optimization is not fully supported.
+ Thanks Dagfinn Ilmari Mannsåker for reporting.
+ + Fix : Segfaults in eval in an END block of a Win32 pseudo-fork.
+ + Fix : Segfaults during global destruction of a thread or a
+ pseudo-fork.
+ + Fix : Check functions are now replaced and restored in a thread-safe
+ manner, either by using the wrap_op_checker() function from perl
+ when it is available (starting from perl 5.16) or by taking the
+ OP_REFCNT mutex on older perls.
+ + Tst : Author tests are no longer bundled with this distribution.
+ They are only made available to authors in the git repository.
+ + Tst : Test failures of t/81-threads-teardown.t on Cygwin and Android
+ should have been addressed.
+ + Tst : Threads tests will not fail anymore if resources constraints
+ prevent the system from creating all the required threads.
+ + Upd : Metadata overhaul.
+
0.12 2011-08-24 16:30 UTC
+ Fix : The pragma no longer vivifies the "Lexical::Types" entry in the
hints hash %^H on perl 5.8.
"Vincent Pit <perl@profvince.com>"
],
"dynamic_config" : 1,
- "generated_by" : "ExtUtils::MakeMaker version 6.59, CPAN::Meta::Converter version 2.112150",
+ "generated_by" : "ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.142690",
"license" : [
"perl_5"
],
"prereqs" : {
"build" : {
"requires" : {
- "Carp" : 0,
- "ExtUtils::MakeMaker" : 0,
- "Test::More" : 0,
- "XSLoader" : 0,
- "constant" : 0
+ "Carp" : "0",
+ "Config" : "0",
+ "ExtUtils::MakeMaker" : "0",
+ "Test::More" : "0",
+ "XSLoader" : "0",
+ "constant" : "0"
}
},
"configure" : {
"requires" : {
- "ExtUtils::MakeMaker" : 0
+ "Config" : "0",
+ "ExtUtils::MakeMaker" : "0"
}
},
"runtime" : {
"requires" : {
- "Carp" : 0,
- "XSLoader" : 0,
+ "Carp" : "0",
+ "XSLoader" : "0",
"perl" : "5.008003"
}
}
"release_status" : "stable",
"resources" : {
"bugtracker" : {
- "web" : "http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Lexical-Types"
+ "web" : "http://rt.cpan.org/Dist/Display.html?Name=Lexical-Types"
},
"homepage" : "http://search.cpan.org/dist/Lexical-Types/",
"license" : [
"url" : "http://git.profvince.com/?p=perl%2Fmodules%2FLexical-Types.git"
}
},
- "version" : "0.12"
+ "version" : "0.13"
}
author:
- 'Vincent Pit <perl@profvince.com>'
build_requires:
- Carp: 0
- ExtUtils::MakeMaker: 0
- Test::More: 0
- XSLoader: 0
- constant: 0
+ Carp: '0'
+ Config: '0'
+ ExtUtils::MakeMaker: '0'
+ Test::More: '0'
+ XSLoader: '0'
+ constant: '0'
configure_requires:
- ExtUtils::MakeMaker: 0
+ Config: '0'
+ ExtUtils::MakeMaker: '0'
dynamic_config: 1
-generated_by: 'ExtUtils::MakeMaker version 6.59, CPAN::Meta::Converter version 2.112150'
+generated_by: 'ExtUtils::MakeMaker version 6.98, CPAN::Meta::Converter version 2.142690'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
- version: 1.4
+ version: '1.4'
name: Lexical-Types
no_index:
directory:
- t
- inc
requires:
- Carp: 0
- XSLoader: 0
- perl: 5.008003
+ Carp: '0'
+ XSLoader: '0'
+ perl: '5.008003'
resources:
- bugtracker: http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Lexical-Types
+ bugtracker: http://rt.cpan.org/Dist/Display.html?Name=Lexical-Types
homepage: http://search.cpan.org/dist/Lexical-Types/
license: http://dev.perl.org/licenses/
repository: http://git.profvince.com/?p=perl%2Fmodules%2FLexical-Types.git
-version: 0.12
+version: '0.13'
Lexical::Types - Extend the semantics of typed lexicals.
VERSION
- Version 0.12
+ Version 0.13
SYNOPSIS
{ package Str; }
This pragma is not implemented with a source filter.
-FUNCTIONS
- "import [ as => [ $prefix | $mangler ] ]"
- Magically called when writing "use Lexical::Types". All the occurences
- of "my Str $x" in the current lexical scope will be changed to call at
- each run a given method in a given package. The method and package are
- determined by the parameter 'as' :
+METHODS
+ "import"
+ use Lexical::Types;
+ use Lexical::Types as => $prefix;
+ use Lexical::Types as => sub { ... }; # = $mangler
+
+ Magically called when "use Lexical::Types" is encountered. All the
+ occurences of "my Str $x" in the current lexical scope will be changed
+ to call at each run a given method in a given package. The method and
+ package are determined by the parameter 'as' :
* If it's left unspecified, the "TYPEDSCALAR" method in the "Str"
package will be called.
definition will be skipped (thus it won't be altered to trigger
a run-time hook) ;
- use Lexical::Types as => sub { return $_[0] =~ /Str/ ? @_ : () };
+ use Lexical::Types as => sub {
+ return $_[0] =~ /Str/ ? @_ : ()
+ };
my Str $y; # calls Str->TYPEDSCALAR
my Int $x; # nothing special
$_[0].
"unimport"
- Magically called when writing "no Lexical::Types". Turns the pragma off.
+ no Lexical::Types;
+
+ Magically called when "no Lexical::Types" is encountered. Turns the
+ pragma off.
RUN-TIME INITIALIZER METHOD
The initializer method receives an alias to the pad slot of the
perl 5.10.0 and below .
CAVEATS
+ Using this pragma will cause a slight global slowdown of any subsequent
+ compilation phase that happens anywere in your code - even outside of
+ the scope of use of "use Lexical::Types" - which may become noticeable
+ if you rely heavily on numerous calls to "eval STRING".
+
The restrictions on the type (being either a defined package name or a
constant) apply even if you use the 'as' option to redirect to another
package, and are unlikely to find a workaround as this happens deep
Only one mangler or prefix can be in use at the same time in a given
scope.
+ Typed lexicals declarations that appear in code "eval"'d during the
+ global destruction phase of a spawned thread or pseudo-fork (the
+ processes used internally for the "fork" emulation on Windows) are
+ ignored.
+
The implementation was tweaked to work around several limitations of
vanilla "perl" pragmas : it's thread safe, and doesn't suffer from a
"perl 5.8.x-5.10.0" bug that causes all pragmas to propagate into
A C compiler. This module may happen to build with a C++ compiler as
well, but don't rely on it, as no guarantee is made in this regard.
- XSLoader (standard since perl 5.006).
+ XSLoader (standard since perl 5.6.0).
SEE ALSO
fields.
Thanks Florian Ragwitz for suggesting the use of constants for types.
COPYRIGHT & LICENSE
- Copyright 2009,2010,2011 Vincent Pit, all rights reserved.
+ Copyright 2009,2010,2011,2012,2013,2014 Vincent Pit, all rights
+ reserved.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.