1Pipeline::Segment::AsynUcs(e3r)Contributed Perl DocumentPaitpieolnine::Segment::Async(3)
2
3
4
6 Pipeline::Segment::Async - asynchronous pipeline segments
7
9 my $seg = $pipe->store->get( $async_segment_classname );
10 my $ret = $seg->reattach();
11
13 The "Pipeline::Segment::Async" module allows you to write asynchronous
14 pipeline segments. Whenever an asynchronous segment is dispatched it
15 places itself in the store, and splits away from the main process that
16 keeps running. At any point furthe down the pipeline you can request
17 the segment from the store, and then ask it to give you back its return
18 values by calling the reattach() method, or even, throw them away by
19 calling discard() which will simply destroy the segment when it
20 completes. If you call discard() there is no way you can get it back.
21
22 You add any asynchronous segment to the a pipeline in exactly the same
23 manner you would add any other segment. It gets dispatched in the
24 normal way, with the normal arguments supplied to the dispatch method.
25 Getting objects from the store will retrieve them as expected. however
26 altering those objects or setting them back into the store will not do
27 what you expect.
28
29 "Pipeline::Segment::Async" works by indicating to the dispatcher that
30 it wants a different method to be its dispatch method. If you indicate
31 to the dispatcher that you want something to dispatch different at the
32 segment level, then your asynchronous segment will be come decidedly
33 synchronous.
34
35 "Pipeline::Segment::Async" inherits from "Pipeline::Base" and has any
36 methods that it provides.
37
39 init()
40 init() is called by the constructor, and sets up the list of
41 threading models that "Pipeline::Segment::Async" is aware of. See
42 threading_models() for more information.
43
44 threading_models( [ARRAYREF] )
45 threading_models() gets and sets a list of classes that know how to
46 process segements asynchronously.
47
48 predispatch()
49 predispatch() is called by the pipeline dispatcher and prepares the
50 segment for asynchronous execution.
51
52 model( [Pipeline::Segment::Async::*] )
53 model() returns an object that represents the threading model that
54 "Pipeline::Segment::Async" will call. If it does not yet have an
55 object a call to determine_threading_model() is called.
56
57 determine_threading_model()
58 determine_threading_model() will look at all the classes in the
59 list provided by threading_models() and determine if they can
60 operate under the current configuration. It will return an object
61 of one of those classes, provided it can operate.
62
63 reattach()
64 reattach() takes a detached asynchronous segment and joins it back,
65 placing the results in the correct area of the pipeline.
66
67 discard()
68 discard() flags an asynchronous segment as never needing to be
69 reattached.
70
71 dispatch_method()
72 dispatch_method() tells the pipeline dispatch class which method to
73 call in order to dispatch this class. In the case of
74 "Pipeline::Segment::Async" it returns a constant with the value
75 predispatch.
76
78 Pipeline::Segment, Pipeline::Dispatch, Pipeline::Base,
79 Pipeline::Segment::Async::Handler
80
82 James A. Duncan <jduncan@fotango.com>
83
85 Copyright 2003 Fotango Ltd. All Rights Reserved.
86
87 This software is released under the same terms as Perl itself.
88
89
90
91perl v5.36.0 2023-01-20 Pipeline::Segment::Async(3)