1Padre::Task::PPI(3) User Contributed Perl Documentation Padre::Task::PPI(3)
2
3
4
6 Padre::Task::PPI - Generic PPI background processing task
7
9 package Padre::Task::MyFancyTest;
10
11 use strict;
12 use base 'Padre::Task::PPI';
13
14 # Will be called after ppi-parsing:
15 sub process {
16 my $self = shift;
17 my $ppi = shift or return;
18 my $result = ...expensive_calculation_using_ppi...
19 $self->{result} = $result;
20 return;
21 }
22
23 1;
24
25 # elsewhere:
26
27 Padre::Task::MyFancyTest->new(
28 text => 'parse-this!',
29 )->schedule;
30
32 This is a base class for all tasks that need to do expensive
33 calculations using PPI. The class will setup a PPI::Document object
34 from a given piece of code and then call the "process_ppi" method on
35 the task object and pass the PPI::Document as first argument.
36
37 You can either let "Padre::Task::PPI" fetch the Perl code for parsing
38 from the current document or specify it as the ""text"" parameter to
39 the constructor.
40
41 Note: If you don't supply the document text and there is no currently
42 open document to fetch it from, "new()" will simply return the empty
43 list instead of a "Padre::Task::PPI" object.
44
46 This class inherits from "Padre::Task" and its instances can be
47 scheduled using "Padre::TaskManager".
48
49 The transfer of the objects to and from the worker threads is
50 implemented with Storable.
51
53 Steffen Mueller "smueller@cpan.org"
54
56 Copyright 2008-2011 The Padre development team as listed in Padre.pm.
57
58 This program is free software; you can redistribute it and/or modify it
59 under the same terms as Perl 5 itself.
60
61
62
63perl v5.30.0 2019-07-26 Padre::Task::PPI(3)