view release on metacpan or search on metacpan
lib/Acme/AllThePerlIsAStage.pm view on Meta::CPAN
$my_set_at_begin = $$;
$our_set_at_begin = $$;
_say_stage("BEGIN 1");
}
UNITCHECK {
$my_set_at_unitcheck = $$;
$our_set_at_unitcheck = $$;
_say_stage("UNITCHECK 1");
}
CHECK {
$my_set_at_check = $$;
$our_set_at_check = $$;
lib/Acme/AllThePerlIsAStage.pm view on Meta::CPAN
CHECK {
_say_stage("CHECK 2");
}
UNITCHECK {
_say_stage("UNITCHECK 2");
}
BEGIN {
_say_stage("BEGIN 2");
}
lib/Acme/AllThePerlIsAStage.pm view on Meta::CPAN
TODO v0.02 â fill me out (sorry, ran our of time)
=head1 INTERFACE
Just use or require the module. It outputs info you can use to visualize and study in order to grok L<perlmod/"BEGIN, UNITCHECK, CHECK, INIT and END">.
If the environment variable 'AllThePerlIsAStage_verbose' is true it outputs info on various symbols at each point in the process.
=head2 use()/require() compiled/uncompiled
view all matches for this distribution
view release on metacpan or search on metacpan
Revision history for Acme-SafetyGoggles
0.06 2013-01-24
- remove useless UNITCHECK block breaks in inhibits Perl <=v5.8.
- removing other useless special blocks
0.05 2013-01-19
- Including Text::Diff dependency in Makefile.PL. No code changes.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Acme/W.pm view on Meta::CPAN
s/([^\$\w\d])quotemeta([^\w\d])/$1WWwwwWw$2/g;
s/([^\$\w\d])prototype([^\w\d])/$1WWwwwwW$2/g;
s/([^\$\w\d])localtime([^\w\d])/$1WWwwwww$2/g;
s/([^\$\w\d])getnetent([^\w\d])/$1WwWWWWW$2/g;
s/([^\$\w\d])endnetent([^\w\d])/$1WwWWWWw$2/g;
s/([^\$\w\d])UNITCHECK([^\w\d])/$1WwWWWwW$2/g;
s/([^\$\w\d])truncate([^\w\d])/$1WwWWWww$2/g;
s/([^\$\w\d])syswrite([^\w\d])/$1WwWWwWW$2/g;
s/([^\$\w\d])shutdown([^\w\d])/$1WwWWwWw$2/g;
s/([^\$\w\d])shmwrite([^\w\d])/$1WwWWwwW$2/g;
s/([^\$\w\d])setpwent([^\w\d])/$1WwWWwww$2/g;
lib/Acme/W.pm view on Meta::CPAN
s/([^\$\w\d])WWwwwWw([^\w\d])/$1quotemeta$2/g;
s/([^\$\w\d])WWwwwwW([^\w\d])/$1prototype$2/g;
s/([^\$\w\d])WWwwwww([^\w\d])/$1localtime$2/g;
s/([^\$\w\d])WwWWWWW([^\w\d])/$1getnetent$2/g;
s/([^\$\w\d])WwWWWWw([^\w\d])/$1endnetent$2/g;
s/([^\$\w\d])WwWWWwW([^\w\d])/$1UNITCHECK$2/g;
s/([^\$\w\d])WwWWWww([^\w\d])/$1truncate$2/g;
s/([^\$\w\d])WwWWwWW([^\w\d])/$1syswrite$2/g;
s/([^\$\w\d])WwWWwWw([^\w\d])/$1shutdown$2/g;
s/([^\$\w\d])WwWWwwW([^\w\d])/$1shmwrite$2/g;
s/([^\$\w\d])WwWWwww([^\w\d])/$1setpwent$2/g;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Adapter/Async/Model.pm view on Meta::CPAN
collection => 'OrderedList',
type => '::Thing',
}
};
Note that methods are applied via a UNITCHECK block by default.
=cut
use Log::Any qw($log);
lib/Adapter/Async/Model.pm view on Meta::CPAN
=head2 import
=over 4
=item * defer_methods - if true (default), this will delay creation of methods such as C<new> using a UNITCHECK block, pass defer_methods => 0 to disable this and create the methods immediately
=item * model_base - the base class to prepend when types are specified with a leading ::
=back
view all matches for this distribution
view release on metacpan or search on metacpan
KEY_truncate|5.003007||Viu
KEY_uc|5.003007||Viu
KEY_ucfirst|5.003007||Viu
KEY_umask|5.003007||Viu
KEY_undef|5.003007||Viu
KEY_UNITCHECK|5.009005||Viu
KEY_unless|5.003007||Viu
KEY_unlink|5.003007||Viu
KEY_unpack|5.003007||Viu
KEY_unshift|5.003007||Viu
KEY_untie|5.003007||Viu
view all matches for this distribution
view release on metacpan or search on metacpan
KEY_try|5.033007||Viu
KEY_uc|5.003007||Viu
KEY_ucfirst|5.003007||Viu
KEY_umask|5.003007||Viu
KEY_undef|5.003007||Viu
KEY_UNITCHECK|5.009005||Viu
KEY_unless|5.003007||Viu
KEY_unlink|5.003007||Viu
KEY_unpack|5.003007||Viu
KEY_unshift|5.003007||Viu
KEY_untie|5.003007||Viu
view all matches for this distribution
view release on metacpan or search on metacpan
KEY_try|5.033007||Viu
KEY_uc|5.003007||Viu
KEY_ucfirst|5.003007||Viu
KEY_umask|5.003007||Viu
KEY_undef|5.003007||Viu
KEY_UNITCHECK|5.009005||Viu
KEY_unless|5.003007||Viu
KEY_unlink|5.003007||Viu
KEY_unpack|5.003007||Viu
KEY_unshift|5.003007||Viu
KEY_untie|5.003007||Viu
view all matches for this distribution
view release on metacpan or search on metacpan
KEY_try|5.033007||Viu
KEY_uc|5.003007||Viu
KEY_ucfirst|5.003007||Viu
KEY_umask|5.003007||Viu
KEY_undef|5.003007||Viu
KEY_UNITCHECK|5.009005||Viu
KEY_unless|5.003007||Viu
KEY_unlink|5.003007||Viu
KEY_unpack|5.003007||Viu
KEY_unshift|5.003007||Viu
KEY_untie|5.003007||Viu
view all matches for this distribution
view release on metacpan or search on metacpan
t/04_phases.t view on Meta::CPAN
}
BEGIN { check_not_global('BEGIN') }
BEGIN {
if (eval 'UNITCHECK {}; 1') {
eval q[ UNITCHECK { check_not_global('UNITCHECK') }; 1 ]
or die $@;
}
else {
print "ok # UNITCHECK not supported in perl < 5.10\n" x 2;
}
}
CHECK { check_not_global('CHECK') }
sub CLONE { check_not_global('CLONE') };
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/Pod.pm view on Meta::CPAN
- my ($s) = @_; # class or object
- my $ref = ref $s;
- my $class = $ref ? $ref : $s; # myClass
- my $pkg = $class . "::"; # MyClass::
- my @keys_raw;
- my $is_special_block = qr/^ (?:BEGIN|UNITCHECK|INIT|CHECK|END|import|DESTROY) $/x;
-
- no strict 'refs';
-
- while( my($key,$stash) = each %$pkg){
- # next if $key =~ /$is_special_block/; # Not a special block
view all matches for this distribution
view release on metacpan or search on metacpan
KEY_try|5.033007||Viu
KEY_uc|5.003007||Viu
KEY_ucfirst|5.003007||Viu
KEY_umask|5.003007||Viu
KEY_undef|5.003007||Viu
KEY_UNITCHECK|5.009005||Viu
KEY_unless|5.003007||Viu
KEY_unlink|5.003007||Viu
KEY_unpack|5.003007||Viu
KEY_unshift|5.003007||Viu
KEY_untie|5.003007||Viu
view all matches for this distribution
view release on metacpan or search on metacpan
use Getopt::Std ;
use List::Util qw[ minstr maxstr all any min max ] ;
use Term::ANSIColor qw [ :constants ] ; ${Term::ANSIColor::AUTORESET} = 1 ;
use Time::HiRes qw[gettimeofday tv_interval] ;
my $time_start ;# = [ gettimeofday ] ;
BEGIN { $time_start = [ gettimeofday ] }; # BEGIN UNITCHECK CHECK INIT # å使éã®æ£ç¢ºæ¸¬å®ã®ããBEGINã§å²ãã ã
getopts 'a:c:i:I:C:1:' , \my%o ;
$o{a} ||= 1 ; # æä½éãä½åã®åããåºåè¡ã«å
¥ããã
$o{c} //= '#n#'; # ä½åãªæ¹è¡æåããã©ããªæååã«ç½®ãæããããã
$o{i} //= "\t" ; # å
¥åã®åã®åºåãæå
view all matches for this distribution
view release on metacpan or search on metacpan
bin/denomfind view on Meta::CPAN
use Term::ANSIColor qw[ :constants color ] ; $Term::ANSIColor::AUTORESET = 1 ;
use Math::BigInt qw[ bgcd ] ; # -Qã®æå®æã«å¿
è¦ã¨ãªãã
use List::Util qw [ reduce min max ] ;
use FindBin qw[ $Script ] ;
my $mpu ; # Math::Prime::Util ã®ã¢ã¸ã¥ã¼ã«ãã¤ã³ã¹ãã¼ã«ããã¦ãããç¹æ¤ã
CHECK {$mpu = eval 'use Math::Prime::Util qw[ factor factor_exp ]; 1 ' || 0 } # ä»ã«BEGIN INIT UNITCHECK ã使ããã
& test if exists $o{T} ;
HELP_MESSAGE () unless @ARGV ;
### ãã¹ããã¿ã¼ã³
sub test () {
view all matches for this distribution
view release on metacpan or search on metacpan
use List::Util qw[ minstr maxstr all any max ] ;
use Term::ANSIColor qw [ :constants ] ; ${Term::ANSIColor::AUTORESET} = 1 ;
use Time::HiRes qw[gettimeofday tv_interval] ;
my $time_start ;# = [ gettimeofday ] ;
BEGIN { $time_start = [ gettimeofday ] }; # BEGIN UNITCHECK CHECK INIT # å使éã®æ¸¬å®ãã§ããã ãæ£ç¢ºã«ããããBEGINã§å²ãã ã
my $I = catfile '', '' ; # OSæ¯ã«ç°ãªãå¯è½æ§ã®ããããã¡ã¤ã«ãã¹ã®åºåãæåãåå¾ã
getopts '.:adv' , \my%o ;
$o{'.'} //= '' ;
@ARGV = ( "." ) unless @ARGV ; # & HELP_MESSAGE unless @ARGV ;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/App/perlfind.pm view on Meta::CPAN
perlfind PERL5OPT
perlfind :mmap
perlfind __WARN__
perlfind __PACKAGE__
perlfind head4
perlfind UNITCHECK
If C<perlfind> doesn't know about a search term, it will delegate the
search to L<Pod::Cpandoc> and ultimately C<Pod::Perldoc>.
=head1 FUNCTIONS
view all matches for this distribution
view release on metacpan or search on metacpan
xs/ppport.h view on Meta::CPAN
KEY_try|5.033007||Viu
KEY_uc|5.003007||Viu
KEY_ucfirst|5.003007||Viu
KEY_umask|5.003007||Viu
KEY_undef|5.003007||Viu
KEY_UNITCHECK|5.009005||Viu
KEY_unless|5.003007||Viu
KEY_unlink|5.003007||Viu
KEY_unpack|5.003007||Viu
KEY_unshift|5.003007||Viu
KEY_untie|5.003007||Viu
view all matches for this distribution
view release on metacpan or search on metacpan
xs/ppport.h view on Meta::CPAN
KEY_truncate|5.003007||Viu
KEY_uc|5.003007||Viu
KEY_ucfirst|5.003007||Viu
KEY_umask|5.003007||Viu
KEY_undef|5.003007||Viu
KEY_UNITCHECK|5.009005||Viu
KEY_unless|5.003007||Viu
KEY_unlink|5.003007||Viu
KEY_unpack|5.003007||Viu
KEY_unshift|5.003007||Viu
KEY_untie|5.003007||Viu
view all matches for this distribution
view release on metacpan or search on metacpan
KEY_try|5.033007||Viu
KEY_uc|5.003007||Viu
KEY_ucfirst|5.003007||Viu
KEY_umask|5.003007||Viu
KEY_undef|5.003007||Viu
KEY_UNITCHECK|5.009005||Viu
KEY_unless|5.003007||Viu
KEY_unlink|5.003007||Viu
KEY_unpack|5.003007||Viu
KEY_unshift|5.003007||Viu
KEY_untie|5.003007||Viu
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Assert/Conditional.pm view on Meta::CPAN
exit !dump_exports(@ARGV) unless his_is_require(-1);
# This can't execute at the "normal" time or else
# namespace::autoclean's call Sub::Identify freaks:
UNITCHECK { close(DATA) if defined fileno(DATA) }
1;
# This has to be __DATA__ not __END__ for the self-executing
lib/Assert/Conditional.pm view on Meta::CPAN
0.009 Tue Aug 21 06:29:56 MDT 2018
- Delay slow calls to uca_sort till you really need them, credit Larry Leszczynski.
0.010 Sun Jul 19 13:52:00 MDT 2020
- Fix coredump in perl 5.12 by replacing UNITCHECK in Assert::Conditional::Util with normal execution at botton.
- Make perls below 5.18 work again by setting Hash::Util prereq in Makefile.PL to 0 because it's in the core only, never cpan.
- Only provide assert_locked and assert_unlocked if core Hash::Util v0.15 is there (starting perl v5.17).
- Bump version req of parent class Exporter::ConditionalSubs to v1.11.1 so we don't break Devel::Cover.
- Normalize Export sub attribute tracing so either $Exporter::Verbose=1 or env ASSERT_CONDITIONAL_DEBUG=1 work for both Assert::Conditional{,::Utils}.
- Mentioned $Exporter::Verbose support.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Attribute/Handlers/Clean.pm view on Meta::CPAN
Variables and subroutines subsequently defined in your package, or in packages
derived from that package may be given attributes with the same names as
the attribute handler subroutines, which will then be called in one of
the compilation phases (i.e. in a C<BEGIN>, C<CHECK>, C<INIT>, or C<END>
block). (C<UNITCHECK> blocks don't correspond to a global compilation
phase, so they can't be specified here.)
To create a handler, define it as a subroutine with the same name as
the desired attribute, and declare the subroutine itself with the
attribute C<:ATTR>. For example:
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Attribute/Handlers.pm view on Meta::CPAN
define attribute handler subroutines for specific attributes. Variables
and subroutines subsequently defined in that package, or in packages
derived from that package may be given attributes with the same names as
the attribute handler subroutines, which will then be called in one of
the compilation phases (i.e. in a C<BEGIN>, C<CHECK>, C<INIT>, or C<END>
block). (C<UNITCHECK> blocks don't correspond to a global compilation
phase, so they can't be specified here.)
To create a handler, define it as a subroutine with the same name as
the desired attribute, and declare the subroutine itself with the
attribute C<:ATTR>. For example:
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AutoXS/Accessor.pm view on Meta::CPAN
my $sym = $selfclass->get_symbol($edit_pkg);
my @to_be_replaced;
foreach my $function (sort keys %$sym) {
next if $function =~ /^BEGIN|END|CHECK|UNITCHECK|INIT|import$/;
warn "Scanning function '${edit_pkg}::$function'" if $AutoXS::Debug;
local *symbol = $sym->{$function};
my $coderef = *symbol{CODE} or next;
view all matches for this distribution
view release on metacpan or search on metacpan
# my $gv = $cv->GV;
# return (!$gv or ref($gv) eq 'B::SPECIAL')) ? 1 : 0;
}
sub is_phase_name {
$_[0] =~ /^(BEGIN|INIT|UNITCHECK|CHECK|END)$/ ? 1 : 0;
}
sub B::CV::save {
my ($cv, $origname) = @_;
my $sym = objsym($cv);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/B/CompilerPhase/Hook.pm view on Meta::CPAN
package B::CompilerPhase::Hook;
# ABSTRACT: Programatically install BEGIN/CHECK/INIT/UNITCHECK/END blocks
use strict;
use warnings;
our $VERSION;
lib/B/CompilerPhase/Hook.pm view on Meta::CPAN
# now set up the DWIM methods ...
*enqueue_BEGIN = \&append_BEGIN;
*enqueue_CHECK = \&prepend_CHECK;
*enqueue_INIT = \&append_INIT;
*enqueue_UNITCHECK = \&prepend_UNITCHECK;
*enqueue_END = \&prepend_END;
}
sub import {
shift;
lib/B/CompilerPhase/Hook.pm view on Meta::CPAN
=pod
=head1 NAME
B::CompilerPhase::Hook - Programatically install BEGIN/CHECK/INIT/UNITCHECK/END blocks
=head1 VERSION
version 0.02
lib/B/CompilerPhase/Hook.pm view on Meta::CPAN
use B::CompilerPhase::Hook qw[
enqueue_BEGIN
enqueue_CHECK
enqueue_INIT
enqueue_UNITCHECK
enqueue_END
];
# We call these functions within BEGIN
# blocks so that we can be assured they
lib/B/CompilerPhase/Hook.pm view on Meta::CPAN
print "10. Ordinary code runs at runtime.\n";
BEGIN {
enqueue_END { print "16. So this is the end of the tale.\n" };
enqueue_INIT { print " 7. INIT blocks run FIFO just before runtime.\n" };
enqueue_UNITCHECK { print " 4. And therefore before any CHECK blocks.\n" };
enqueue_CHECK { print " 6. So this is the sixth line.\n" }
}
print "11. It runs in order, of course.\n";
BEGIN {
enqueue_BEGIN { print " 1. BEGIN blocks run FIFO during compilation.\n" }
lib/B/CompilerPhase/Hook.pm view on Meta::CPAN
}
print "12. This is anti-obfuscated code.\n";
BEGIN {
enqueue_END { print "14. END blocks run LIFO at quitting time.\n" }
enqueue_BEGIN { print " 2. So this line comes out second.\n" }
enqueue_UNITCHECK { print " 3. UNITCHECK blocks run LIFO after each file is compiled.\n" }
enqueue_INIT { print " 9. You'll see the difference right away.\n" }
}
print "13. It only _looks_ like it should be confusing.\n";
# With apologies to the `BEGIN-UNITCHECK-CHECK-INIT-and-END` section of `perlmod`
=head1 DESCRIPTION
This module makes it possible to enqueue callbacks to be run during
the various Perl compiler phases, with the aim of doing multi-phase
lib/B/CompilerPhase/Hook.pm view on Meta::CPAN
=head2 C<enqueue_INIT( $cb )>
This will C<push> the C<$cb> onto the end of the internal
C<INIT> array.
=head2 C<enqueue_UNITCHECK( $cb )>
This will C<unshift> the C<$cb> onto the end of the internal
C<UNITCHECK> array.
=head2 C<enqueue_END( $cb )>
This will C<unshift> the C<$cb> onto the end of the internal
C<END> array.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/B/Debugger.pm view on Meta::CPAN
Planned:
-exec switch to exec order
-root start at main_root, not main_start
-check hook into CHECK block (Default, at B)
-unit hook into UNITCHECK block (after B)
-init hook into INIT block (before B)
-begin hook into BEGIN block (before compilation)
-d debug, be verbose in the internal recursion steps
=head1 COMMANDS
view all matches for this distribution
view release on metacpan or search on metacpan
lib/B/DeparseTree/TreeMain.pm view on Meta::CPAN
my $fs = perlstring($/) || 'undef';
my $bs = perlstring($O::savebackslash) || 'undef';
print qq(BEGIN { \$/ = $fs; \$\\ = $bs; }\n);
}
my @BEGINs = B::begin_av->isa("B::AV") ? B::begin_av->ARRAY : ();
my @UNITCHECKs = B::unitcheck_av->isa("B::AV")
? B::unitcheck_av->ARRAY
: ();
my @CHECKs = B::check_av->isa("B::AV") ? B::check_av->ARRAY : ();
my @INITs = B::init_av->isa("B::AV") ? B::init_av->ARRAY : ();
my @ENDs = B::end_av->isa("B::AV") ? B::end_av->ARRAY : ();
if ($] < 5.020) {
for my $block (@BEGINs, @UNITCHECKs, @CHECKs, @INITs, @ENDs) {
$self->B::Deparse::todo($block, 0);
}
} else {
my @names = qw(BEGIN UNITCHECK CHECK INIT END);
my @blocks = (\@BEGINs, \@UNITCHECKs, \@CHECKs, \@INITs, \@ENDs);
while (@names) {
my ($name, $blocks) = (shift @names, shift @blocks);
for my $block (@$blocks) {
$self->todo($block, 0, $name);
}
view all matches for this distribution
view release on metacpan or search on metacpan
KEY_try|5.033007||Viu
KEY_uc|5.003007||Viu
KEY_ucfirst|5.003007||Viu
KEY_umask|5.003007||Viu
KEY_undef|5.003007||Viu
KEY_UNITCHECK|5.009005||Viu
KEY_unless|5.003007||Viu
KEY_unlink|5.003007||Viu
KEY_unpack|5.003007||Viu
KEY_unshift|5.003007||Viu
KEY_untie|5.003007||Viu
view all matches for this distribution
view release on metacpan or search on metacpan
lib/B/Keywords.pm view on Meta::CPAN
# removed with 855a8c432447
($] < 5.007003 ? qw(
EQ GE GT LE LT NE
) : ()),
($] >= 5.009005 ? qw(
UNITCHECK
) : ()), qw(
abs
accept
alarm
atan2
view all matches for this distribution
view release on metacpan or search on metacpan
lib/BEGIN/Lift.pm view on Meta::CPAN
BEGIN::Lift::Util::install_keyword_handler(
$cv, sub { $handler->( $_[0] ? $_[0]->() : () ) }
);
# clean things up ...
Devel::Hook->unshift_UNITCHECK_hook(sub {
no strict 'refs';
# NOTE:
# this is safe only because we
# confirmed above that there was
# no other use of this typeglob
view all matches for this distribution
view release on metacpan or search on metacpan
share/PerlCritic/Critic/Policy/ControlStructures/ProhibitLabelsWithSpecialBlockNames.pm view on Meta::CPAN
use base 'Perl::Critic::Policy';
our $VERSION = '1.108';
Readonly::Hash my %SPECIAL_BLOCK_NAMES =>
hashify( qw< BEGIN END INIT CHECK UNITCHECK > );
#-----------------------------------------------------------------------------
Readonly::Scalar my $DESC => q<Special block name used as label.>;
Readonly::Scalar my $EXPL =>
q<Use a label that cannot be confused with BEGIN, END, CHECK, INIT, or UNITCHECK blocks.>;
#-----------------------------------------------------------------------------
sub supported_parameters { return () }
sub default_severity { return $SEVERITY_HIGH }
share/PerlCritic/Critic/Policy/ControlStructures/ProhibitLabelsWithSpecialBlockNames.pm view on Meta::CPAN
=head1 DESCRIPTION
When using one of the special Perl blocks C<BEGIN>, C<END>, C<CHECK>,
C<INIT>, and C<UNITCHECK>, it is easy to mistakenly add a colon to the
end of the block name. E.g.:
# a BEGIN block that gets executed at compile time.
BEGIN { <...code...> }
view all matches for this distribution