2 Devel::BeginLift - make selected sub calls evaluate at compile time
5 use Devel::BeginLift qw(foo baz);
11 sub foo { "foo: $_[0]\n"; }
13 sub bar { "bar: $_[0]\n"; }
26 foo: 0 bar: 1 foo: 0 bar: 2 foo: 0 bar: 3 foo: 4
29 Devel::BeginLift 'lifts' arbitrary sub calls to running at compile time
30 - sort of a souped up version of "use constant". It does this via some
31 slightly insane perlguts magic.
34 use Devel::BeginLift qw(list of subs);
36 Calls Devel::BeginLift->setup_for(__PACKAGE__ => \@list_of_subs);
41 Calls Devel::BeginLift->teardown_for(__PACKAGE__);
44 Devel::BeginLift->setup_for($package => \@subnames);
46 Installs begin lifting magic (unless already installed) and registers
47 "${package}::$name" for each member of @subnames to be executed when
48 parsed and replaced with its output rather than left for runtime.
51 Devel::BeginLift->teardown_for($package);
53 Deregisters all subs currently registered for $package and uninstalls
54 begin lifting magic is number of teardown_for calls matches number of
58 Matt S Trout - <mst@shadowcatsystems.co.uk>
60 Company: http://www.shadowcatsystems.co.uk/ Blog:
61 http://chainsawblues.vox.com/
64 This library is free software under the same terms as perl itself