placeholder readme, overwritten by PREOP
[p5sagit/Devel-BeginLift.git] / README
1 NAME
2     Devel::BeginLift - make selected sub calls evaluate at compile time
3
4 SYNOPSIS
5       use Devel::BeginLift qw(foo baz);
6   
7       use vars qw($i);
8   
9       BEGIN { $i = 0 }
10   
11       sub foo { "foo: $_[0]\n"; }
12   
13       sub bar { "bar: $_[0]\n"; }
14   
15       for (1 .. 3) {
16         print foo($i++);
17         print bar($i++);
18       }
19   
20       no Devel::BeginLift;
21   
22       print foo($i++);
23
24     outputs -
25
26     foo: 0 bar: 1 foo: 0 bar: 2 foo: 0 bar: 3 foo: 4
27
28 DESCRIPTION
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.
32
33   import
34       use Devel::BeginLift qw(list of subs);
35
36     Calls Devel::BeginLift->setup_for(__PACKAGE__ => \@list_of_subs);
37
38   unimport
39       no Devel::BeginLift;
40
41     Calls Devel::BeginLift->teardown_for(__PACKAGE__);
42
43   setup_for
44       Devel::BeginLift->setup_for($package => \@subnames);
45
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.
49
50   teardown_for
51       Devel::BeginLift->teardown_for($package);
52
53     Deregisters all subs currently registered for $package and uninstalls
54     begin lifting magic is number of teardown_for calls matches number of
55     setup_for calls.
56
57 AUTHOR
58     Matt S Trout - <mst@shadowcatsystems.co.uk>
59
60     Company: http://www.shadowcatsystems.co.uk/ Blog:
61     http://chainsawblues.vox.com/
62
63 LICENSE
64     This library is free software under the same terms as perl itself
65