File Coverage

blib/lib/Device/Firmata/Constants.pm
Criterion Covered Total %
statement 26 26 100.0
branch n/a
condition n/a
subroutine 8 8 100.0
pod n/a
total 34 34 100.0


line stmt bran cond sub pod time code
1             package Device::Firmata::Constants;
2              
3             =head1 NAME
4              
5             Device::Firmata::Constants - constants used in the Device::Firmata modules
6              
7             =head1 DESCRIPTION
8              
9             Provides several constants to be used with L.
10              
11             Pin modes:
12              
13             =over
14              
15             =item * PIN_INPUT
16              
17             =item * PIN_OUTPUT
18              
19             =item * PIN_ANALOG
20              
21             =item * PIN_PWM
22              
23             =item * PIN_SERVO
24              
25             =item * PIN_SHIFT
26              
27             =item * PIN_I2C
28              
29             =item * PIN_ONEWIRE
30              
31             =item * PIN_STEPPER
32              
33             =item * PIN_ENCODER
34              
35             =item * PIN_SERIAL
36              
37             =item * PIN_PULLUP
38              
39             =back
40              
41             Digital pin states:
42              
43             =over
44              
45             =item * PIN_LOW
46              
47             =item * PIN_HIGH
48              
49             =back
50              
51             =cut
52              
53 1     1   7 use strict;
  1         2  
  1         28  
54 1     1   5 use warnings;
  1         2  
  1         23  
55 1     1   4 use Exporter;
  1         2  
  1         53  
56 1         143 use vars qw/
57             @ISA @EXPORT_OK %EXPORT_TAGS
58             $BASE
59             $COMMANDS $COMMAND_NAMES
60             $COMMAND_LOOKUP
61 1     1   7 /;
  1         2  
62            
63             @ISA = 'Exporter';
64              
65             # Basic commands and constants
66             use constant (
67 1         650 $BASE = {
68             PIN_INPUT => 0,
69             PIN_OUTPUT => 1,
70             PIN_ANALOG => 2,
71             PIN_PWM => 3,
72             PIN_SERVO => 4,
73             PIN_SHIFT => 5,
74             PIN_I2C => 6,
75             PIN_ONEWIRE => 7,
76             PIN_STEPPER => 8,
77             PIN_ENCODER => 9,
78             PIN_SERIAL => 10,
79             PIN_PULLUP => 11,
80             PIN_LOW => 0,
81             PIN_HIGH => 1,
82             }
83 1     1   8 );
  1         2  
84              
85             # We need to apply all the available protocols
86             use constant (
87 1         339 $COMMANDS = {
88              
89             V_2_01 => {
90              
91             MAX_DATA_BYTES => 32, # max number of data bytes in non-Sysex messages
92              
93             # message command bytes (128-255/0x80-0xFF)
94             DIGITAL_MESSAGE => 0x90, # send data for a digital pin
95             ANALOG_MESSAGE => 0xE0, # send data for an analog pin (or PWM)
96             REPORT_ANALOG => 0xC0, # enable analog input by pin #
97             REPORT_DIGITAL => 0xD0, # enable digital input by port pair
98             SET_PIN_MODE => 0xF4, # set a pin to INPUT/OUTPUT/PWM/etc
99             REPORT_VERSION => 0xF9, # report protocol version
100             SYSTEM_RESET => 0xFF, # reset from MIDI
101             START_SYSEX => 0xF0, # start a MIDI Sysex message
102             END_SYSEX => 0xF7, # end a MIDI Sysex message
103              
104             # extended command set using sysex (0-127/0x00-0x7F)
105             SERVO_CONFIG => 0x70, # set max angle, minPulse, maxPulse, freq
106             STRING_DATA => 0x71, # a string message with 14-bits per char
107             SHIFT_DATA => 0x75, # a bitstream to/from a shift register
108             I2C_REQUEST => 0x76, # send an I2C read/write request
109             I2C_REPLY => 0x77, # a reply to an I2C read request
110             I2C_CONFIG => 0x78, # config I2C settings such as delay times and power pins
111             REPORT_FIRMWARE => 0x79, # report name and version of the firmware
112             SAMPLING_INTERVAL => 0x7A, # set the poll rate of the main loop
113             SYSEX_NON_REALTIME => 0x7E, # MIDI Reserved for non-realtime messages
114             SYSEX_REALTIME => 0x7F, # MIDI Reserved for realtime messages
115              
116             # these are DEPRECATED to make the naming more consistent
117             FIRMATA_STRING => 0x71, # same as STRING_DATA
118             SYSEX_I2C_REQUEST => 0x76, # same as I2C_REQUEST
119             SYSEX_I2C_REPLY => 0x77, # same as I2C_REPLY
120             SYSEX_SAMPLING_INTERVAL => 0x7A, # same as SAMPLING_INTERVAL
121              
122             # pin modes
123             INPUT => 0x00, # digital pin in digitalOut mode
124             OUTPUT => 0x01, # digital pin in digitalInput mode
125             ANALOG => 0x02, # analog pin in analogInput mode
126             PWM => 0x03, # digital pin in PWM output mode
127             SERVO => 0x04, # digital pin in Servo output mode
128             SHIFT => 0x05, # shiftIn/shiftOut mode
129             I2C => 0x06, # pin included in I2C setup
130              
131             # Deprecated entries
132             deprecated => [
133             qw( FIRMATA_STRING SYSEX_I2C_REQUEST SYSEX_I2C_REPLY SYSEX_SAMPLING_INTERVAL )
134             ],
135             }, # /Constants for Version 2.1
136              
137             V_2_02 => {
138              
139             MAX_DATA_BYTES => 32, # max number of data bytes in non-Sysex messages
140              
141             # message command bytes (128-255/0x80-0xFF)
142             DIGITAL_MESSAGE => 0x90, # send data for a digital pin
143             ANALOG_MESSAGE => 0xE0, # send data for an analog pin (or PWM)
144             REPORT_ANALOG => 0xC0, # enable analog input by pin #
145             REPORT_DIGITAL => 0xD0, # enable digital input by port pair
146             SET_PIN_MODE => 0xF4, # set a pin to INPUT/OUTPUT/PWM/etc
147             REPORT_VERSION => 0xF9, # report protocol version
148             SYSTEM_RESET => 0xFF, # reset from MIDI
149             START_SYSEX => 0xF0, # start a MIDI Sysex message
150             END_SYSEX => 0xF7, # end a MIDI Sysex message
151              
152             # extended command set using sysex (0-127/0x00-0x7F)
153             RESERVED_COMMAND => 0x00, # 2nd SysEx data byte is a chip-specific command (AVR, PIC, TI, etc).
154             ANALOG_MAPPING_QUERY => 0x69, # ask for mapping of analog to pin numbers
155             ANALOG_MAPPING_RESPONSE => 0x6A, # reply with mapping info
156             CAPABILITY_QUERY => 0x6B, # ask for supported modes and resolution of all pins
157             CAPABILITY_RESPONSE => 0x6C, # reply with supported modes and resolution
158             PIN_STATE_QUERY => 0x6D, # ask for a pin's current mode and value
159             PIN_STATE_RESPONSE => 0x6E, # reply with a pin's current mode and value
160             EXTENDED_ANALOG => 0x6F, # analog write (PWM, Servo, etc) to any pin
161             SERVO_CONFIG => 0x70, # set max angle, minPulse, maxPulse, freq
162             STRING_DATA => 0x71, # a string message with 14-bits per char
163             SHIFT_DATA => 0x75, # shiftOut config/data message (34 bits)
164             I2C_REQUEST => 0x76, # send an I2C read/write request
165             I2C_REPLY => 0x77, # a reply to an I2C read request
166             I2C_CONFIG => 0x78, # config I2C settings such as delay times and power pins
167             REPORT_FIRMWARE => 0x79, # report name and version of the firmware
168             SAMPLING_INTERVAL => 0x7A, # set the poll rate of the main loop
169             SYSEX_NON_REALTIME => 0x7E, # MIDI Reserved for non-realtime messages
170             SYSEX_REALTIME => 0x7F, # MIDI Reserved for realtime messages
171              
172             # pin modes
173             INPUT => 0x00, # digital pin in digitalOut mode
174             OUTPUT => 0x01, # digital pin in digitalInput mode
175             ANALOG => 0x02, # analog pin in analogInput mode
176             PWM => 0x03, # digital pin in PWM output mode
177             SERVO => 0x04, # digital pin in Servo output mode
178             SHIFT => 0x05, # shiftIn/shiftOut mode
179             I2C => 0x06, # pin included in I2C setup
180              
181             # Deprecated entries
182             deprecated => [
183             qw( FIRMATA_STRING SYSEX_I2C_REQUEST SYSEX_I2C_REPLY SYSEX_SAMPLING_INTERVAL )
184             ],
185              
186             }, # /Constants for Version 2.2
187              
188             V_2_03 => {
189              
190             MAX_DATA_BYTES => 32, # max number of data bytes in non-Sysex messages
191              
192             # message command bytes (128-255/0x80-0xFF)
193             DIGITAL_MESSAGE => 0x90, # send data for a digital pin
194             ANALOG_MESSAGE => 0xE0, # send data for an analog pin (or PWM)
195             REPORT_ANALOG => 0xC0, # enable analog input by pin #
196             REPORT_DIGITAL => 0xD0, # enable digital input by port pair
197             SET_PIN_MODE => 0xF4, # set a pin to INPUT/OUTPUT/PWM/etc
198             REPORT_VERSION => 0xF9, # report protocol version
199             SYSTEM_RESET => 0xFF, # reset from MIDI
200             START_SYSEX => 0xF0, # start a MIDI Sysex message
201             END_SYSEX => 0xF7, # end a MIDI Sysex message
202              
203             # extended command set using sysex (0-127/0x00-0x7F)
204             RESERVED_COMMAND => 0x00, # 2nd SysEx data byte is a chip-specific command (AVR, PIC, TI, etc).
205             ANALOG_MAPPING_QUERY => 0x69, # ask for mapping of analog to pin numbers
206             ANALOG_MAPPING_RESPONSE => 0x6A, # reply with mapping info
207             CAPABILITY_QUERY => 0x6B, # ask for supported modes and resolution of all pins
208             CAPABILITY_RESPONSE => 0x6C, # reply with supported modes and resolution
209             PIN_STATE_QUERY => 0x6D, # ask for a pin's current mode and value
210             PIN_STATE_RESPONSE => 0x6E, # reply with a pin's current mode and value
211             EXTENDED_ANALOG => 0x6F, # analog write (PWM, Servo, etc) to any pin
212             SERVO_CONFIG => 0x70, # set max angle, minPulse, maxPulse, freq
213             STRING_DATA => 0x71, # a string message with 14-bits per char
214             SHIFT_DATA => 0x75, # shiftOut config/data message (34 bits)
215             I2C_REQUEST => 0x76, # send an I2C read/write request
216             I2C_REPLY => 0x77, # a reply to an I2C read request
217             I2C_CONFIG => 0x78, # config I2C settings such as delay times and power pins
218             REPORT_FIRMWARE => 0x79, # report name and version of the firmware
219             SAMPLING_INTERVAL => 0x7A, # set the poll rate of the main loop
220             SYSEX_NON_REALTIME => 0x7E, # MIDI Reserved for non-realtime messages
221             SYSEX_REALTIME => 0x7F, # MIDI Reserved for realtime messages
222              
223             # pin modes
224             INPUT => 0x00, # digital pin in digitalOut mode
225             OUTPUT => 0x01, # digital pin in digitalInput mode
226             ANALOG => 0x02, # analog pin in analogInput mode
227             PWM => 0x03, # digital pin in PWM output mode
228             SERVO => 0x04, # digital pin in Servo output mode
229             SHIFT => 0x05, # shiftIn/shiftOut mode
230             I2C => 0x06, # pin included in I2C setup
231              
232             # Deprecated entries
233             deprecated => [
234             qw( FIRMATA_STRING SYSEX_I2C_REQUEST SYSEX_I2C_REPLY SYSEX_SAMPLING_INTERVAL )
235             ],
236              
237             }, # /Constants for Version 2.3 (same as V_2_02)
238              
239             V_2_04 => {
240              
241             MAX_DATA_BYTES => 64, # max number of data bytes in non-Sysex messages
242              
243             # message command bytes (128-255/0x80-0xFF)
244             DIGITAL_MESSAGE => 0x90, # send data for a digital pin
245             ANALOG_MESSAGE => 0xE0, # send data for an analog pin (or PWM)
246             REPORT_ANALOG => 0xC0, # enable analog input by pin #
247             REPORT_DIGITAL => 0xD0, # enable digital input by port pair
248             SET_PIN_MODE => 0xF4, # set a pin to INPUT/OUTPUT/PWM/etc
249             REPORT_VERSION => 0xF9, # report protocol version
250             SYSTEM_RESET => 0xFF, # reset from MIDI
251             START_SYSEX => 0xF0, # start a MIDI Sysex message
252             END_SYSEX => 0xF7, # end a MIDI Sysex message
253              
254             # extended command set using sysex (0-127/0x00-0x7F)
255             RESERVED_COMMAND => 0x00, # 2nd SysEx data byte is a chip-specific command (AVR, PIC, TI, etc).
256             ANALOG_MAPPING_QUERY => 0x69, # ask for mapping of analog to pin numbers
257             ANALOG_MAPPING_RESPONSE => 0x6A, # reply with mapping info
258             CAPABILITY_QUERY => 0x6B, # ask for supported modes and resolution of all pins
259             CAPABILITY_RESPONSE => 0x6C, # reply with supported modes and resolution
260             PIN_STATE_QUERY => 0x6D, # ask for a pin's current mode and value
261             PIN_STATE_RESPONSE => 0x6E, # reply with a pin's current mode and value
262             EXTENDED_ANALOG => 0x6F, # analog write (PWM, Servo, etc) to any pin
263             SERVO_CONFIG => 0x70, # set max angle, minPulse, maxPulse, freq
264             STRING_DATA => 0x71, # a string message with 14-bits per char
265             STEPPER_DATA => 0x72, # control a stepper motor
266             ONEWIRE_DATA => 0x73, # OneWire read/write/reset/select/skip/search request + read/search reply
267             SHIFT_DATA => 0x75, # shiftOut config/data message (34 bits)
268             I2C_REQUEST => 0x76, # send an I2C read/write request
269             I2C_REPLY => 0x77, # a reply to an I2C read request
270             I2C_CONFIG => 0x78, # config I2C settings such as delay times and power pins
271             REPORT_FIRMWARE => 0x79, # report name and version of the firmware
272             SAMPLING_INTERVAL => 0x7A, # set the poll rate of the main loop
273             SCHEDULER_DATA => 0x7B, # createtask/deletetask/addtotask/schedule/querytasks/querytask request and querytasks/querytask reply
274             SYSEX_NON_REALTIME => 0x7E, # MIDI Reserved for non-realtime messages
275             SYSEX_REALTIME => 0x7F, # MIDI Reserved for realtime messages
276              
277             # pin modes
278             INPUT => 0x00, # digital pin in digitalOut mode
279             OUTPUT => 0x01, # digital pin in digitalInput mode
280             ANALOG => 0x02, # analog pin in analogInput mode
281             PWM => 0x03, # digital pin in PWM output mode
282             SERVO => 0x04, # digital pin in Servo output mode
283             SHIFT => 0x05, # shiftIn/shiftOut mode
284             I2C => 0x06, # pin included in I2C setup
285             ONEWIRE => 0x07, # pin configured for 1-Wire commuication
286             STEPPER => 0x08, # pin configured for stepper motor
287              
288             # Deprecated entries
289             deprecated => [
290             qw( FIRMATA_STRING SYSEX_I2C_REQUEST SYSEX_I2C_REPLY SYSEX_SAMPLING_INTERVAL )
291             ],
292             }, # /Constants for Version 2.4
293              
294             V_2_05 => {
295              
296             MAX_DATA_BYTES => 64, # max number of data bytes in non-Sysex messages
297              
298             # message command bytes (128-255/0x80-0xFF)
299             DIGITAL_MESSAGE => 0x90, # send data for a digital pin
300             ANALOG_MESSAGE => 0xE0, # send data for an analog pin (or PWM)
301             REPORT_ANALOG => 0xC0, # enable analog input by pin #
302             REPORT_DIGITAL => 0xD0, # enable digital input by port pair
303             SET_PIN_MODE => 0xF4, # set a pin to INPUT/OUTPUT/PWM/etc
304             REPORT_VERSION => 0xF9, # report protocol version
305             SYSTEM_RESET => 0xFF, # reset from MIDI
306             START_SYSEX => 0xF0, # start a MIDI Sysex message
307             END_SYSEX => 0xF7, # end a MIDI Sysex message
308              
309             # extended command set using sysex (0-127/0x00-0x7F)
310             RESERVED_COMMAND => 0x00, # 2nd SysEx data byte is a chip-specific command (AVR, PIC, TI, etc).
311             SERIAL_DATA => 0x60, # serial port config/write/read/close/flush/listen request and read reply
312             ENCODER_DATA => 0x61, # receive rotary-encoders current positions
313             ANALOG_MAPPING_QUERY => 0x69, # ask for mapping of analog to pin numbers
314             ANALOG_MAPPING_RESPONSE => 0x6A, # reply with mapping info
315             CAPABILITY_QUERY => 0x6B, # ask for supported modes and resolution of all pins
316             CAPABILITY_RESPONSE => 0x6C, # reply with supported modes and resolution
317             PIN_STATE_QUERY => 0x6D, # ask for a pin's current mode and value
318             PIN_STATE_RESPONSE => 0x6E, # reply with a pin's current mode and value
319             EXTENDED_ANALOG => 0x6F, # analog write (PWM, Servo, etc) to any pin
320             SERVO_CONFIG => 0x70, # set max angle, minPulse, maxPulse, freq
321             STRING_DATA => 0x71, # a string message with 14-bits per char
322             STEPPER_DATA => 0x72, # control a stepper motor
323             ONEWIRE_DATA => 0x73, # OneWire read/write/reset/select/skip/search request + read/search reply
324             SHIFT_DATA => 0x75, # shiftOut config/data message (34 bits)
325             I2C_REQUEST => 0x76, # send an I2C read/write request
326             I2C_REPLY => 0x77, # a reply to an I2C read request
327             I2C_CONFIG => 0x78, # config I2C settings such as delay times and power pins
328             REPORT_FIRMWARE => 0x79, # report name and version of the firmware
329             SAMPLING_INTERVAL => 0x7A, # set the poll rate of the main loop
330             SCHEDULER_DATA => 0x7B, # createtask/deletetask/addtotask/schedule/querytasks/querytask request and querytasks/querytask reply
331             SYSEX_NON_REALTIME => 0x7E, # MIDI Reserved for non-realtime messages
332             SYSEX_REALTIME => 0x7F, # MIDI Reserved for realtime messages
333              
334             # pin modes
335             INPUT => 0x00, # digital pin in digitalOut mode
336             OUTPUT => 0x01, # digital pin in digitalInput mode
337             ANALOG => 0x02, # analog pin in analogInput mode
338             PWM => 0x03, # digital pin in PWM output mode
339             SERVO => 0x04, # digital pin in Servo output mode
340             SHIFT => 0x05, # shiftIn/shiftOut mode
341             I2C => 0x06, # pin included in I2C setup
342             ONEWIRE => 0x07, # pin configured for 1-Wire commuication
343             STEPPER => 0x08, # pin configured for stepper motor
344             SERIAL => 0x0A, # pin configured for serial port
345             PULLUP => 0x0B, # digital pin in digitalInput mode with pullup
346              
347             # Deprecated entries
348             deprecated => [
349             qw( FIRMATA_STRING SYSEX_I2C_REQUEST SYSEX_I2C_REPLY SYSEX_SAMPLING_INTERVAL )
350             ],
351              
352             }, # /Constants for Version 2.5
353              
354             V_2_06 => {
355              
356             MAX_DATA_BYTES => 64, # max number of data bytes in non-Sysex messages
357              
358             # message command bytes (128-255/0x80-0xFF)
359             DIGITAL_MESSAGE => 0x90, # send data for a digital pin
360             ANALOG_MESSAGE => 0xE0, # send data for an analog pin (or PWM)
361             REPORT_ANALOG => 0xC0, # enable analog input by pin #
362             REPORT_DIGITAL => 0xD0, # enable digital input by port pair
363             SET_PIN_MODE => 0xF4, # set a pin to INPUT/OUTPUT/PWM/etc
364             REPORT_VERSION => 0xF9, # report protocol version
365             SYSTEM_RESET => 0xFF, # reset from MIDI
366             START_SYSEX => 0xF0, # start a MIDI Sysex message
367             END_SYSEX => 0xF7, # end a MIDI Sysex message
368              
369             # extended command set using sysex (0-127/0x00-0x7F)
370             RESERVED_COMMAND => 0x00, # 2nd SysEx data byte is a chip-specific command (AVR, PIC, TI, etc).
371             SERIAL_DATA => 0x60, # serial port config/write/read/close/flush/listen request and read reply
372             ENCODER_DATA => 0x61, # receive rotary-encoders current positions
373             ANALOG_MAPPING_QUERY => 0x69, # ask for mapping of analog to pin numbers
374             ANALOG_MAPPING_RESPONSE => 0x6A, # reply with mapping info
375             CAPABILITY_QUERY => 0x6B, # ask for supported modes and resolution of all pins
376             CAPABILITY_RESPONSE => 0x6C, # reply with supported modes and resolution
377             PIN_STATE_QUERY => 0x6D, # ask for a pin's current mode and value
378             PIN_STATE_RESPONSE => 0x6E, # reply with a pin's current mode and value
379             EXTENDED_ANALOG => 0x6F, # analog write (PWM, Servo, etc) to any pin
380             SERVO_CONFIG => 0x70, # set max angle, minPulse, maxPulse, freq
381             STRING_DATA => 0x71, # a string message with 14-bits per char
382             STEPPER_DATA => 0x72, # control a stepper motor
383             ONEWIRE_DATA => 0x73, # OneWire read/write/reset/select/skip/search request + read/search reply
384             SHIFT_DATA => 0x75, # shiftOut config/data message (34 bits)
385             I2C_REQUEST => 0x76, # send an I2C read/write request
386             I2C_REPLY => 0x77, # a reply to an I2C read request
387             I2C_CONFIG => 0x78, # config I2C settings such as delay times and power pins
388             REPORT_FIRMWARE => 0x79, # report name and version of the firmware
389             SAMPLING_INTERVAL => 0x7A, # set the poll rate of the main loop
390             SCHEDULER_DATA => 0x7B, # createtask/deletetask/addtotask/schedule/querytasks/querytask request and querytasks/querytask reply
391             SYSEX_NON_REALTIME => 0x7E, # MIDI Reserved for non-realtime messages
392             SYSEX_REALTIME => 0x7F, # MIDI Reserved for realtime messages
393              
394             # pin modes
395             INPUT => 0x00, # digital pin in digitalOut mode
396             OUTPUT => 0x01, # digital pin in digitalInput mode
397             ANALOG => 0x02, # analog pin in analogInput mode
398             PWM => 0x03, # digital pin in PWM output mode
399             SERVO => 0x04, # digital pin in Servo output mode
400             SHIFT => 0x05, # shiftIn/shiftOut mode
401             I2C => 0x06, # pin included in I2C setup
402             ONEWIRE => 0x07, # pin configured for 1-Wire commuication
403             STEPPER => 0x08, # pin configured for stepper motor
404             ENCODER => 0x09, # pin configured for rotary-encoders
405             SERIAL => 0x0A, # pin configured for serial port
406             PULLUP => 0x0B, # digital pin in digitalInput mode with pullup
407              
408             # Deprecated entries
409             deprecated => [
410             qw( FIRMATA_STRING SYSEX_I2C_REQUEST SYSEX_I2C_REPLY SYSEX_SAMPLING_INTERVAL )
411             ],
412              
413             }, # /Constants for Version 2.6
414             }
415 1     1   8 );
  1         2  
416              
417             # Handle the reverse lookups of the protocol
418             $COMMAND_LOOKUP = {};
419             while ( my ( $protocol_version, $protocol_commands ) = each %$COMMANDS ) {
420             my $protocol_lookup = $COMMAND_LOOKUP->{$protocol_version} = {};
421             my $deprecated = $protocol_lookup->{deprecated} || [];
422             my $deprecated_lookup = { map { ( $_ => 1 ) } @$deprecated };
423             while ( my ( $protocol_command, $command_value ) = each %$protocol_commands ) {
424             next if $protocol_command eq 'deprecated';
425             next if $deprecated_lookup->{$protocol_command};
426             $protocol_lookup->{$command_value} = $protocol_command;
427             }
428             }
429              
430             # Now we consolidate all the string keynames into a single master list.
431 1     1   7 use constant ( $COMMAND_NAMES = { map { map { ( $_ => $_ ) } keys %$_ } values %$COMMANDS } );
  1         2  
  1         17  
  6         42  
  236         827  
432 1     1   8 use constant { COMMAND_NAMES => [ $COMMAND_NAMES = [ keys %$COMMAND_NAMES ] ] };
  1         2  
  1         127  
433              
434             @EXPORT_OK = (
435             @$COMMAND_NAMES, keys %$BASE,
436             keys %$COMMANDS,
437             qw( $COMMANDS $COMMAND_NAMES $COMMAND_LOOKUP ),
438             );
439              
440             %EXPORT_TAGS = ( all => \@EXPORT_OK );
441              
442             1;