From: Matt S Trout Date: Wed, 27 Jun 2007 03:48:36 +0000 (+0000) Subject: placeholder readme, overwritten by PREOP X-Git-Tag: 0.001000~4 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=178c2fec698990ae068438f2cfb772f6ac2bbf13;p=p5sagit%2FDevel-BeginLift.git placeholder readme, overwritten by PREOP --- diff --git a/README b/README new file mode 100644 index 0000000..adacb76 --- /dev/null +++ b/README @@ -0,0 +1,65 @@ +NAME + Devel::BeginLift - make selected sub calls evaluate at compile time + +SYNOPSIS + use Devel::BeginLift qw(foo baz); + + use vars qw($i); + + BEGIN { $i = 0 } + + sub foo { "foo: $_[0]\n"; } + + sub bar { "bar: $_[0]\n"; } + + for (1 .. 3) { + print foo($i++); + print bar($i++); + } + + no Devel::BeginLift; + + print foo($i++); + + outputs - + + foo: 0 bar: 1 foo: 0 bar: 2 foo: 0 bar: 3 foo: 4 + +DESCRIPTION + Devel::BeginLift 'lifts' arbitrary sub calls to running at compile time + - sort of a souped up version of "use constant". It does this via some + slightly insane perlguts magic. + + import + use Devel::BeginLift qw(list of subs); + + Calls Devel::BeginLift->setup_for(__PACKAGE__ => \@list_of_subs); + + unimport + no Devel::BeginLift; + + Calls Devel::BeginLift->teardown_for(__PACKAGE__); + + setup_for + Devel::BeginLift->setup_for($package => \@subnames); + + Installs begin lifting magic (unless already installed) and registers + "${package}::$name" for each member of @subnames to be executed when + parsed and replaced with its output rather than left for runtime. + + teardown_for + Devel::BeginLift->teardown_for($package); + + Deregisters all subs currently registered for $package and uninstalls + begin lifting magic is number of teardown_for calls matches number of + setup_for calls. + +AUTHOR + Matt S Trout - + + Company: http://www.shadowcatsystems.co.uk/ Blog: + http://chainsawblues.vox.com/ + +LICENSE + This library is free software under the same terms as perl itself +