perl
view release on metacpan or search on metacpan
cpan/CPAN-Meta-YAML/t/lib/TestML/Tiny.pm view on Meta::CPAN
package TestML::Tiny;
; # original $VERSION removed by Doppelgaenger
use Carp();
use Test::More 0.88 ();
# use XXX;
sub import {
strict->import;
warnings->import;
}
sub new {
my $self = bless { @_[1..$#_] }, $_[0];
my $testml = $self->_get_testml;
my $bridge = $self->_get_bridge;
$self->{runtime} ||= TestML::Tiny::Runtime->new(
bridge => $bridge,
);
cpan/Pod-Simple/t/perlvar.pod view on Meta::CPAN
bar->baz($boon);
}
Consider what happens during execution of the BEGIN block. At this point
the BEGIN block has already been compiled, but the body of foo() is still
being compiled. The new value of $^H will therefore be visible only while
the body of foo() is being compiled.
Substitution of the above BEGIN block with:
BEGIN { require strict; strict->import('vars') }
demonstrates how C<use strict 'vars'> is implemented. Here's a conditional
version of the same lexical pragma:
BEGIN { require strict; strict->import('vars') if $condition }
=item %^H
WARNING: This variable is strictly for internal use only. Its availability,
behavior, and contents are subject to change without notice.
The %^H hash provides the same scoping semantic as $^H. This makes it
useful for implementation of lexically scoped pragmas.
=item $INPLACE_EDIT
cpan/Pod-Simple/t/perlvaro.txt view on Meta::CPAN
When perl begins to parse any block construct that provides a lexical scope (e.g., eval body, required file, subroutine body, loop body, or conditional block), the existing value of $^H is saved, but its value is left unchanged. When the compilation ...
This behavior provides the semantic of lexical scoping, and is used in, for instance, the use strict pragma.
The contents should be an integer; different bits of it are used for different pragmatic flags. Here's an example:
sub add_100 { $^H |= 0x100 }
sub foo {
BEGIN { add_100() }
bar->baz($boon);
}
Consider what happens during execution of the BEGIN block. At this point the BEGIN block has already been compiled, but the body of foo() is still being compiled. The new value of $^H will therefore be visible only while the body of foo() is being co...
Substitution of the above BEGIN block with:
BEGIN { require strict; strict->import('vars') }
demonstrates how use strict 'vars' is implemented. Here's a conditional version of the same lexical pragma:
BEGIN { require strict; strict->import('vars') if $condition }
%^H
WARNING: This variable is strictly for internal use only. Its availability, behavior, and contents are subject to change without notice.
The %^H hash provides the same scoping semantic as $^H. This makes it useful for implementation of lexically scoped pragmas.
$INPLACE_EDIT
$^I
The current value of the inplace-edit extension. Use undef to disable inplace editing. (Mnemonic: value of -i switch.)
$^M
By default, running out of memory is an untrappable, fatal error. However, if suitably built, Perl can use the contents of $^M as an emergency memory pool after die()ing. Suppose that your Perl were compiled with -DPERL_EMERGENCY_SBRK and used Perl's...
$^M = 'a' x (1 << 16);
would allocate a 64K buffer for use in an emergency. See the INSTALL file in the Perl distribution for information on how to enable this option. To discourage casual use of this advanced feature, there is no English long name for this variable.
cpan/Test-Simple/lib/Test2/V0.pm view on Meta::CPAN
if ( !$no_srand ) {
Test2::Plugin::SRand->import($srand ? $srand : ()) if defined($srand) || !$SRAND++;
}
# Pragmas
my $no_pragmas = delete $options{'-no_pragmas'};
my $no_strict = delete $options{'-no_strict'} || $no_pragmas;
my $no_warnings = delete $options{'-no_warnings'} || $no_pragmas;
my $no_utf8 = delete $options{'-no_utf8'} || $no_pragmas;
strict->import() unless $no_strict;
'warnings'->import() unless $no_warnings;
Test2::Plugin::UTF8->import() unless $no_utf8;
my $target = delete $options{'-target'};
Test2::Tools::Target->import_into($caller, $target)
if $target;
croak "Unknown option(s): " . join(', ', sort keys %options) if keys %options;
Test2::Util::Importer->import_into($class, $caller, @exports);
cpan/Test-Simple/t/modules/Bundle/Extended.t view on Meta::CPAN
ok(Test2::Plugin::ExitSummary->active, "Exit Summary is loaded");
ok(defined(Test2::Plugin::SRand->seed), "SRand is loaded");
subtest strictures => sub {
local $^H;
my $hbefore = $^H;
Test2::Bundle::Extended->import;
my $hafter = $^H;
my $strict = do { local $^H; strict->import(); $^H };
ok($strict, 'sanity, got $^H value for strict');
ok(!($hbefore & $strict), "strict is not on before loading Test2::Bundle::Extended");
ok(($hafter & $strict), "strict is on after loading Test2::Bundle::Extended");
};
subtest warnings => sub {
local ${^WARNING_BITS};
my $wbefore = ${^WARNING_BITS} || '';
Test2::Bundle::Extended->import;
cpan/Test-Simple/t/modules/V0.t view on Meta::CPAN
ok(Test2::Plugin::ExitSummary->active, "Exit Summary is loaded");
ok(defined(Test2::Plugin::SRand->seed), "SRand is loaded");
subtest strictures => sub {
local $^H;
my $hbefore = $^H;
Test2::V0->import;
my $hafter = $^H;
my $strict = do { local $^H; strict->import(); $^H };
ok($strict, 'sanity, got $^H value for strict');
ok(!($hbefore & $strict), "strict is not on before loading Test2::V0");
ok(($hafter & $strict), "strict is on after loading Test2::V0");
};
subtest warnings => sub {
local ${^WARNING_BITS};
my $wbefore = ${^WARNING_BITS} || '';
Test2::V0->import;
ext/Pod-Html/corpus/perlvar-copy.pod view on Meta::CPAN
bar->baz($boon);
}
Consider what happens during execution of the BEGIN block. At this point
the BEGIN block has already been compiled, but the body of foo() is still
being compiled. The new value of $^H will therefore be visible only while
the body of foo() is being compiled.
Substitution of the above BEGIN block with:
BEGIN { require strict; strict->import('vars') }
demonstrates how C<use strict 'vars'> is implemented. Here's a conditional
version of the same lexical pragma:
BEGIN { require strict; strict->import('vars') if $condition }
=item %^H
The %^H hash provides the same scoping semantic as $^H. This makes it
useful for implementation of lexically scoped pragmas. See L<perlpragma>.
=item $INPLACE_EDIT
=item $^I
X<$^I> X<$INPLACE_EDIT>
pod/perlvar.pod view on Meta::CPAN
}
Consider what happens during execution of the BEGIN block. At this point
the BEGIN block has already been compiled, but the body of C<foo()> is still
being compiled. The new value of C<$^H>
will therefore be visible only while
the body of C<foo()> is being compiled.
Substitution of C<BEGIN { add_100() }> block with:
BEGIN { require strict; strict->import('vars') }
demonstrates how C<use strict 'vars'> is implemented. Here's a conditional
version of the same lexical pragma:
BEGIN {
require strict; strict->import('vars') if $condition
}
This variable was added in Perl 5.003.
=item %^H
X<%^H>
The C<%^H> hash provides the same scoping semantics as L<C<$^H>|/$^H>. This
makes it useful for implementing lexically scoped pragmas. See L<perlpragma>.
All the entries are stringified when accessed at runtime, so only simple values
t/op/coreamp.t view on Meta::CPAN
);
test_proto 'evalbytes';
$tests += 4;
{
my $U_100_bytes = byte_utf8a_to_utf8n("\xc4\x80");
chop(my $upgraded = "use utf8; $U_100_bytes" . chr 256);
is &myevalbytes($upgraded), chr 256, '&evalbytes';
# Test hints
require strict;
strict->import;
&myevalbytes('
is someone, "someone", "run-time hint bits do not leak into &evalbytes"
');
use strict;
BEGIN { $^H{coreamp} = 42 }
$^H{coreamp} = 75;
&myevalbytes('
BEGIN {
is $^H{coreamp}, 42, "compile-time hh propagates into &evalbytes";
}
( run in 0.531 second using v1.01-cache-2.11-cpan-299005ec8e3 )