.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.29) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Devel::BeginLift 3pm" .TH Devel::BeginLift 3pm "2012-04-21" "perl v5.22.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Devel::BeginLift \- make selected sub calls evaluate at compile time .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Devel::BeginLift qw(foo baz); \& \& use vars qw($i); \& \& BEGIN { $i = 0 } \& \& sub foo { "foo: $_[0]\en"; } \& \& sub bar { "bar: $_[0]\en"; } \& \& for (1 .. 3) { \& print foo($i++); \& print bar($i++); \& } \& \& no Devel::BeginLift; \& \& print foo($i++); .Ve .PP outputs \- .PP foo: 0 bar: 1 foo: 0 bar: 2 foo: 0 bar: 3 foo: 4 .SH "DESCRIPTION" .IX Header "DESCRIPTION" Devel::BeginLift 'lifts' arbitrary sub calls to running at compile time \&\- sort of a souped up version of \*(L"use constant\*(R". It does this via some slightly insane perlguts magic. .SS "import" .IX Subsection "import" .Vb 1 \& use Devel::BeginLift qw(list of subs); .Ve .PP Calls Devel::BeginLift\->setup_for(_\|_PACKAGE_\|_ => \e@list_of_subs); .SS "unimport" .IX Subsection "unimport" .Vb 1 \& no Devel::BeginLift; .Ve .PP Calls Devel::BeginLift\->teardown_for(_\|_PACKAGE_\|_); .SS "setup_for" .IX Subsection "setup_for" .Vb 1 \& Devel::BeginLift\->setup_for($package => \e@subnames); .Ve .PP Installs begin lifting magic (unless already installed) and registers \&\*(L"${package}::$name\*(R" for each member of \f(CW@subnames\fR to be executed when parsed and replaced with its output rather than left for runtime. .SS "teardown_for" .IX Subsection "teardown_for" .Vb 1 \& Devel::BeginLift\->teardown_for($package); .Ve .PP Deregisters all subs currently registered for \f(CW$package\fR and uninstalls begin lifting magic is number of teardown_for calls matches number of setup_for calls. .SS "setup_for_cv" .IX Subsection "setup_for_cv" .Vb 1 \& $id = Devel::BeginLift\->setup_for_cv(\e&code); .Ve .PP Same as \f(CW\*(C`setup_for\*(C'\fR, but only registers begin lifting magic for one code reference. Returns an id to be used in \f(CW\*(C`teardown_for_cv\*(C'\fR. .SS "teardown_for_cv" .IX Subsection "teardown_for_cv" .Vb 1 \& Devel::BeginLift\->teardown_for_cv($id); .Ve .PP Deregisters begin lifting magic referred to by \f(CW$id\fR. .SH "AUTHOR" .IX Header "AUTHOR" Matt S Trout \- .PP Company: http://www.shadowcatsystems.co.uk/ Blog: http://chainsawblues.vox.com/ .SH "LICENSE" .IX Header "LICENSE" This library is free software under the same terms as perl itself