1Net::CLI::Interact::RolUes:e:rEnCgoinnter(i3b)uted PerlNDeotc:u:mCeLnIt:a:tIinotneract::Role::Engine(3)
2
3
4
6 Net::CLI::Interact::Role::Engine - Statement execution engine
7
9 This module is the core of Net::CLI::Interact, and serves to take
10 entries from your loaded Phrasebooks, issue them to connected devices,
11 and gather the returned output.
12
14 cmd( $command_statement, \%options? )
15 Execute a single command statement on the connected device, and consume
16 output until there is a match with the current prompt. The statement is
17 executed verbatim on the device, with a newline appended.
18
19 The following options are supported:
20
21 "timeout => $seconds" (optional)
22 Sets a value of "timeout" for the Transport local to this call of
23 "cmd", that overrides whatever is set in the Transport, or the
24 default of 10 seconds.
25
26 "no_ors => 1" (optional)
27 When passed a true value, a newline character (in fact the value of
28 "ors") will not be appended to the statement sent to the device.
29
30 "match => $name | $regexpref | \@names_and_regexprefs" (optional)
31 Allows this command (only) to complete with a custom match, which
32 must be one or more of either the name of a loaded phrasebook
33 Prompt or your own regular expression reference ("qr//"). The
34 module updates the current prompt to be the same value on a
35 successful match.
36
37 In scalar context the "last_response" is returned (see below). In list
38 context the gathered response is returned as a list of lines. In both
39 cases your local platform's newline character will end all lines.
40
41 macro( $macro_name, \%options? )
42 Execute the commands contained within the named Macro, which must be
43 loaded from a Phrasebook. Options to control the output, including
44 variables for substitution into the Macro, are passed in the %options
45 hash reference.
46
47 The following options are supported:
48
49 "params => \@values" (optional)
50 If the Macro contains commands using "sprintf" Format variables
51 then the corresponding parameters must be passed in this value as
52 an array reference.
53
54 Values are consumed from the provided array reference and passed to
55 the "send" commands in the Macro in order, as needed. An exception
56 will be thrown if there are insufficient parameters.
57
58 "timeout => $seconds" (optional)
59 Sets a value of "timeout" for the Transport local to this call of
60 "macro", that overrides whatever is set in the Transport, or the
61 default of 10 seconds.
62
63 An exception will be thrown if the Match statements in the Macro are
64 not successful against the output returned from the device. This is
65 based on the value of "timeout", which controls how long the module
66 waits for matching output.
67
68 In scalar context the "last_response" is returned (see below). In list
69 context the gathered response is returned as a list of lines. In both
70 cases your local platform's newline character will end all lines.
71
72 last_response
73 Returns the gathered output after issuing the last recent "send"
74 command within the most recent "cmd" or "prompt". That is, you get the
75 output from the last command sent to the connected device.
76
77 In scalar context all data is returned. In list context the gathered
78 response is returned as a list of lines. In both cases your local
79 platform's newline character will end all lines.
80
81 last_actionset
82 Returns the complete ActionSet that was constructed from the most
83 recent "macro" or "cmd" execution. This will be a sequence of Actions
84 that correspond to "send" and "match" statements.
85
86 In the case of a Macro these directly relate to the contents of your
87 Phrasebook, with the possible addition of "match" statements added
88 automatically. In the case of a "cmd" execution, an "anonymous" Macro
89 is constructed which consists of a single "send" and a single "match".
90
92 See the following for further interface details:
93
94 ยท Net::CLI::Interact::Role::Prompt
95
96
97
98perl v5.28.0 2018-07-15Net::CLI::Interact::Role::Engine(3)