The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Sub::Genius::Util - Helper module for dumping Perl code

SYNOPSIS

This is implemented for use with stubby, please look at that script to see how it's used.

DESCRIPTION

Useful for dumping a Perl code for starting a module or script that implements the subroutines that are involved in the execution of a plan.

Given a PRE, dumps a Perl script with the subroutines implied by the symbols in the PREs as subroutines. It might be most effective when called as a one liner,

This could get unweildy if you have a concurrent model in place, but anyone reviewing this POD should be able to figure out the best way to leverage plan2perl.

Each subroutine takes the approximate form,

    sub C {
      my $scope      = shift;    # execution context passed by Sub::Genius::run_once
      state $mystate = {};       # sticks around on subsequent calls
      my    $myprivs = {};       # reaped when execution is out of sub scope
    
      #-- begin subroutine implementation here --#
      print qq{Sub C: ELOH! Replace me, I am just placeholder!\n};
    
      # return $scope, which will be passed to next subroutine
      return $scope;
    }

METHODS

subs2perl

Implemented to support the accompanying utility used for initialing a script with Sub::Genius.

plan2nodeps

Given a PRE, dumps a Perl script that can be run without loading Sub::Genius by providing explicit calls, that also pass along a $scope variable.

    $ perl -MSub::Genius::Util -e 'print Sub::Genius::Util->plan2nodeps(plan => q{A&B&C&D&E&F&G})' > my-script.pl
    
    # does explicitly what Sub::Genius::run_once does, give a sequentialized plan
    # generated from the PRE, 'A&B&C&D&E&F&G'
    
    my $scope = { };
    $scope    = G($scope);
    $scope    = D($scope);
    $scope    = F($scope);
    $scope    = B($scope);
    $scope    = E($scope);
    $scope    = H($scope);
    $scope    = C($scope);
    $scope    = A($scope);

SEE ALSO

Sub::Genius

COPYRIGHT AND LICENSE

Same terms as perl itself.

AUTHOR

OODLER 577 <oodler@cpan.org>