1Padre::Task::PPI(3)   User Contributed Perl Documentation  Padre::Task::PPI(3)
2
3
4

NAME

6       Padre::Task::PPI - Generic PPI background processing task
7

SYNOPSIS

9         package Padre::Task::PPI::MyFancyTest;
10         use base 'Padre::Task::PPI';
11
12         # will be called after ppi-parsing:
13         sub process_ppi  {
14                 my $self = shift;
15                 my $ppi  = shift or return;
16                 my $result = ...expensive_calculation_using_ppi...
17                 $self->{result} = $result;
18                 return();
19         },
20
21         sub finish {
22                 my $self = shift;
23                 my $result = $self->{result};
24                 # update GUI here...
25         };
26
27         1;
28
29         # elsewhere:
30
31         # by default, the text of the current document
32         # will be fetched.
33         my $task = Padre::Task::PPI::MyFancyTest->new();
34         $task->schedule;
35
36         my $task2 = Padre::Task::PPI::MyFancyTest->new(
37           text => 'parse-this!',
38         );
39         $task2->schedule;
40

DESCRIPTION

42       This is a base class for all tasks that need to do expensive
43       calculations using PPI. The class will setup a PPI::Document object
44       from a given piece of code and then call the "process_ppi" method on
45       the task object and pass the PPI::Document as first argument.
46
47       You can either let "Padre::Task::PPI" fetch the Perl code for parsing
48       from the current document or specify it as the ""text"" parameter to
49       the constructor.
50
51       Note: If you don't supply the document text and there is no currently
52       open document to fetch it from, "new()" will simply return the empty
53       list instead of a "Padre::Task::PPI" object.
54

SEE ALSO

56       This class inherits from "Padre::Task" and its instances can be
57       scheduled using "Padre::TaskManager".
58
59       The transfer of the objects to and from the worker threads is
60       implemented with Storable.
61

AUTHOR

63       Steffen Mueller "smueller@cpan.org"
64
66       Copyright 2008-2010 The Padre development team as listed in Padre.pm.
67
68       This program is free software; you can redistribute it and/or modify it
69       under the same terms as Perl 5 itself.
70
71
72
73perl v5.12.1                      2010-06-11               Padre::Task::PPI(3)
Impressum