Giter VIP home page Giter VIP logo

devel-beginlift's Introduction

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.

  setup_for_cv
      $id = Devel::BeginLift->setup_for_cv(\&code);

    Same as "setup_for", but only registers begin lifting magic for one code
    reference. Returns an id to be used in "teardown_for_cv".

  teardown_for_cv
      Devel::BeginLift->teardown_for_cv($id);

    Deregisters begin lifting magic referred to by $id.

AUTHOR
    Matt S Trout - <[email protected]>

    Company: http://www.shadowcatsystems.co.uk/ Blog:
    http://chainsawblues.vox.com/

LICENSE
    This library is free software under the same terms as perl itself

devel-beginlift's People

Contributors

rafl avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.