1Net::CLI::Interact::ActUisoenrSeCto(n3t)ributed Perl DocNuemte:n:tCaLtIi:o:nInteract::ActionSet(3)
2
3
4
6 Net::CLI::Interact::ActionSet - Conversation of Send and Match Actions
7
9 This class is used internally by Net::CLI::Interact and it's unlikely
10 that an end-user will need to make use of ActionSet objects directly.
11 The interface is documented here as a matter of record.
12
13 An ActionSet comprises a sequence (usefully, two or more) of Actions
14 which describe a conversation with a connected network device. Actions
15 will alternate between type "send" and "match", perhaps not in their
16 original Phrasebook definition, but certainly by the time they are
17 used.
18
19 If the first Action is of type "send" then the ActionSet is a normal
20 sequence of "send a command" then "match a response", perhaps repeated.
21 If the first Action is of type "match" then the ActionSet represents a
22 "continuation", which is the method of dealing with paged output.
23
25 default_continuation
26 An ActionSet ("match" then "send") which will be available for use on
27 all commands sent from this ActionSet. An alternative to explicitly
28 describing the Continuation sequence within the Phrasebook.
29
30 current_match
31 A stash for the current Prompt (regular expression reference) which
32 Net::CLI::Interact expects to see after each command. This is passed
33 into the constructor and is used when padding Match Actions into the
34 ActionSet (see "execute", below).
35
36 clone
37 Returns a new ActionSet which is a shallow clone of the existing one.
38 All the reference based slots will share data, but you can add (for
39 example) a "current_match" without affecting the original ActionSet.
40 Used when preparing to execute an ActionSet which has been retrieved
41 from the Phrasebook.
42
43 apply_params
44 Accepts a list of parameters which will be used when "sprintf" is
45 called on each Send Action in the set. You must supply sufficient
46 parameters as a list for all Send Actions in the set, and they will be
47 popped off and stashed with the Action(s) according to how many are
48 required.
49
50 register_callback
51 Allows the Transport to be registered such that when the ActionSet is
52 executed, commands are sent to the registered callback subroutine. May
53 be called more than once, and on execution each of the callbacks will
54 be run, in turn and in order.
55
56 execute
57 The business end of this class, where the sequence of Actions is
58 prepared for execution and then control passed to the Transport. This
59 process is split into a number of phases:
60
61 Pad "send" with "match"
62 The Phrasebook allows missing out of the Match statements between
63 Send statements, when they are expected to be the same as the
64 "current_match". This phase inserts Match statements to restore a
65 complete ActionSet definition.
66
67 Forward "continuation" to "match"
68 In the Phrasebook a user defines a Continuation ("match", then
69 "send") following a Send statement (because it deals with the
70 response to the sent command). However they are actually used by
71 the Match, as it's the Match which captures output.
72
73 This phase copies Continuation ActionSets from Send statements to
74 following Match statements in the ActionSet. It also performs a
75 similar action using the "default_continuation" if one is set and
76 there's no existing Continuation configured.
77
78 Callback(s)
79 Here the registered callbacks are executed (i.e. data is sent to
80 the Transport).
81
82 Marshall Responses
83 Finally, responses which are stashed in the Match Actions are
84 copied back to the Send actions, as more logically they are
85 responses to commands sent. The ActionSet is now ready for access
86 to retrieve the "last_response" from the device.
87
89 See the following for further interface details:
90
91 ยท Net::CLI::Interact::Role::Iterator
92
93
94
95perl v5.32.0 2020-07-28 Net::CLI::Interact::ActionSet(3)