Padre::Task::Eval - Task for executing arbitrary code via a string eval


Padre documentation  | view source Contained in the Padre distribution.

Index


NAME

Top

Padre::Task::Eval - Task for executing arbitrary code via a string eval

SYNOPSIS

Top

  my $task = Padre::Task::Eval->new(
      prepare => '1 + 1',
      run     => 'my $foo = sub { 2 + 3 }; $foo->();',
      finish  => '$_[0]->{prepare}',
  );

  $task->prepare;
  $task->run;
  $task->finish;

DESCRIPTION

Top

Padre::Task::Eval is a stub class used to implement testing and other miscellaneous functionality.

It takes three named string parameters matching each of the three execution phases. When each phase of the task is run, the string will be eval'ed and the result will be stored in the same has key as the source string.

If the key does not exist at all, nothing will be executed for that phase.

Regardless of the execution result (or the non-execution of the phase) each phase will always return true. However, if the string eval throws an exception it will escape the task object (although when run properly inside of a task handle it should be caught by the handle).

METHODS

Top

This class contains now additional methods beyond the defaults provided by the Padre::Task API.

COPYRIGHT & LICENSE

Top


Padre documentation  | view source Contained in the Padre distribution.