File Coverage

blib/lib/Term/Menus.pm
Criterion Covered Total %
statement 66 3720 1.7
branch 4 2262 0.1
condition 2 1908 0.1
subroutine 20 51 39.2
pod 3 24 12.5
total 95 7965 1.1


line stmt bran cond sub pod time code
1             package Term::Menus;
2            
3             # Menus.pm
4             #
5             # Copyright (C) 2000-2024
6             #
7             # by Brian M. Kelly.
8             #
9             # You may distribute under the terms of the GNU Affero General
10             # Public License, as specified in the LICENSE file.
11             # .
12             #
13             # http://www.fullautosoftware.net/
14            
15             ## See user documentation at the end of this file. Search for =head
16            
17             BEGIN {
18 1 50   1   8276 *NEW_PERL = ($] >= 5.010) ? sub(){1} : sub(){0};
19             }
20            
21             our $VERSION = '3.041';
22            
23            
24 1     1   25 use 5.006;
  1         5  
25            
26             my $menu_return_debug=0;
27            
28 1     1   6 use strict;
  1         2  
  1         29  
29 1     1   4 use warnings;
  1         2  
  1         1185  
30             ## Module export.
31             require Exporter;
32             our @ISA = qw(Exporter);
33 1         4966 use vars qw(@EXPORT @EXPORT_OK %term_input %test %Dump %tosspass %b
34             %blanklines %parent_menu %Hosts %fa_code %canload %setsid
35             %VERSION %SetTerminalSize %SetControlChars %find_Selected
36             %clearpath %noclear %ReadKey %local_hostname %BEGIN %ISA
37             %editor %__ANON__ %data_dump_streamer %ReadMode %filechk
38             %fa_conf %transform_pmsi %termwidth %a %tm_menu %fa_code
39             %DumpVars %DumpLex %fullauto %delete_Selected %timeout
40             %pick %termheight %EXPORT_OK %ReadLine %fa_login %Menu
41             %fa_host %fa_menu %abs_path $fa_code %log %FH %AUTOLOAD
42             %get_all_hosts %hostname %GetSpeed %get_subs_from_menu
43             %passwd_file_loc %run_sub %GetTerminalSize %escape_quotes
44             %GetControlChars %numerically %rawInput %transform_sicm
45             %return_result $MenuMap %get_Menu_map_count %MenuMap %facall
46             %get_Menu_map %check_for_dupe_menus %EXPORT_FAIL %EXPORT
47             %import $new_user_flag %new_user_flag %DB_ENV_DSYNC_LOG
48             %DB_LOCK_PUT %DB_ST_IS_RECNO &DB_JOINENV %DB_LOCK_INHERIT
49             %DB_VERB_REP_SYSTEM %DB_VERSION_MISMATCH %DB_ENV_STANDALONE
50             %DB_LOG_VERIFY_ERR %DB_EVENT_REG_ALIVE %DB_XA_CREATE
51             %DB_VERB_REP_ELECT %DB_REP_JOIN_FAILURE %DB_DELIMITER
52             %DB_ENV_TXN %DB_ENV_RPCCLIENT %DB_MPOOL_CLEAN %DB_BTREEOLDVER
53             %DB_TEMPORARY %DB_REPMGR_ACKS_ONE %DB_OLD_VERSION %padwalker
54             %DB_TEST_POSTLOGMETA %DB_SET_RECNO %DB_SA_UNKNOWNKEY
55             %DB_MAX_RECORDS %DB_LOCK_CONFLICT %DB_REP_NEWMASTER %banner
56             %DB_LOCK_FREE_LOCKER %DB_POSITIONI %DB_VERB_FILEOPS
57             %DB_LOCK_DEFAULT %DB_REP_ANYWHERE %DB_REPMGR_CONF_2SITE_STRICT
58             %DB_AUTO_COMMIT %DB_TXN_NOWAIT %DB_STAT_LOCK_PARAMS %pw
59             %DB_REP_CONF_NOWAIT %DB_OK_RECNO %DB_SEQ_WRAPPED %test_hashref
60             %DB_MUTEX_LOCKED %DB_BEFORE %DB_EVENT_REP_MASTER_FAILURE
61             %DB_QUEUE %DB_TXN_LOCK_OPTIMISTIC %DB_REP_UNAVAIL %eval_error
62             %DB_FOREIGN_CASCADE %DB_NOOVERWRITE %DB_REP_CONF_AUTOINIT
63             %LOGREC_OP %DB_RUNRECOVERY %DB_UNREF %DB_REPMGR_ISPEER
64             %DB_VERIFY_BAD %DB_STAT_NOERROR %DB_ENV_LOG_AUTOREMOVE
65             %DB_REP_PAGELOCKED %DB_ST_RECNUM %DB_ORDERCHKONLY %DB_JOINENV
66             %DB_PRIORITY_VERY_LOW %DB_BTREEMAGIC %DB_LOCK_NOTHELD
67             %DB_QAMOLDVER %DB_TEST_POSTSYNC %DB_LOG_AUTO_REMOVE
68             %DB_BTREEVERSION %DB_GET_BOTHC %DB_ENV_RPCCLIENT_GIVEN
69             %DB_CREATE %DB_ARCH_DATA %DB_VERB_WAITSFOR %DB_INIT_REP
70             %DB_ENV_RECOVER_FATAL %DB_LOCK_GET_TIMEOUT %DB_STAT_CLEAR
71             %DB_REP_FULL_ELECTION %DB_VERB_REP_LEASE %DB_REGISTERED
72             %DB_APPLY_LOGREG %DB_REP_HANDLE_DEAD %DB_NOORDERCHK
73             %DB_HEAP_RID_SZ %DB_VERIFY_PARTITION %DB_THREADID_STRLEN
74             %DB_FIRST %DB_REPMGR_CONF_ELECTIONS %DB_SEQ_DEC
75             %DB_REP_CONF_INMEM %DB_MUTEX_ALLOCATED %DB_JOIN_ITEM
76             %DB_REP_CONF_NOAUTOINIT %DB_REPMGR_DISCONNECTED
77             %DB_DUPSORT %DB_TXN_POPENFILES %DB_LOCK_RW_N %NEW_PERL
78             %DB_TXN_NOT_DURABLE %DB_LOCK_NORUN %DB_REP_CONF_BULK
79             %DB_STAT_SUBSYSTEM %DB_USERCOPY_GETDATA %DB_LOCK_TRADE
80             %DB_COMMIT %DB_LOG_AUTOREMOVE %DB_MPOOL_TRY %DB_WRITEOPEN
81             %DB_STAT_LOCK_CONF %DB_CLIENT %DB_ENV_TIME_NOTGRANTED
82             %DB_REPFLAGS_MASK %DB_ENV_NOPANIC %DB_DUPCURSOR
83             %DB_ENV_APPINIT %DB_LOGFILEID_INVALID %DB_LOCKMAGIC
84             %DB_STAT_MEMP_HASH %DB_REP_FULL_ELECTION_TIMEOUT
85             %DB_TXN_CKP %DB_QAMVERSION %DB_EVENT_REP_CLIENT
86             %DB_NOCOPY %DB_TXNVERSION %LOGREC_PGLIST %DB_RENAMEMAGIC
87             %DB_REP_DUPMASTER %DB_OPEN_CALLED %DB_PAGE_NOTFOUND
88             %DB_VERB_DEADLOCK %DB_TXN_FORWARD_ROLL %DB_MULTIVERSION
89             %DB_LOCK_TIMEOUT %DB_JOIN_NOSORT %DB_NEEDSPLIT
90             %DB_SET_TXN_NOW %DB_TXN_OPENFILES %DB_TEST_POSTOPEN
91             %DB_RECORD_LOCK %DB_TEST_PREOPEN %DB_RPC_SERVERVERS
92             %DB_PRINTABLE %DB_VERB_REPLICATION %DB_MULTIPLE
93             %DB_COMPACT_FLAGS %DB_KEYEXIST %DB_PRIORITY_VERY_HIGH
94             %DB_NOERROR %DB_VERSION_RELEASE %DB_USE_ENVIRON
95             %DB_LOG_VERIFY_DBFILE %DB_TEST_ELECTSEND %DB_TXN_REDO
96             %DB_DURABLE_UNKNOWN %DB_ARCH_LOG %DB_QAMMAGIC
97             %DB_TIMEOUT %DB_VERB_REPMGR_MISC %DB_REP_PAGEDONE
98             %DB_LOCK_PUT_OBJ %DB_VERSION_FAMILY %DB_OK_BTREE
99             %DB_MAX_PAGES %DB_RDONLY %DB_CACHED_COUNTS
100             %DB_CKP_INTERNAL %DB_LOG_IN_MEMORY %DB_LOCK_GET
101             %DB_AGGRESSIVE %DB_STAT_LOCK_LOCKERS %DB_LOCKVERSION
102             %DB_PRIORITY_DEFAULT %DB_ENV_REP_MASTER %DB_FAILCHK
103             %DB_ENV_LOG_INMEMORY %DB_LOG_VERIFY_FORWARD
104             %DB_LOG_VERIFY_WARNING %DB_IGNORE_LEASE %DB_BACKUP_CLEAN
105             %DB_ENV_DBLOCAL %DB_GET_BOTH_RANGE %DB_FOREIGN_ABORT
106             %DB_REP_PERMANENT %DB_MPOOL_NOFILE %DB_LOG_BUFFER_FULL
107             %DB_ENV_MULTIVERSION %DB_RPC_SERVERPROG %DB_MPOOL_DIRTY
108             %DB_REP_NOBUFFER %DB_USE_ENVIRON_ROOT %DB_LOCK_CHECK
109             %DB_PREV_NODUP %DB_ST_TOPLEVEL %DB_PAGEYIELD %DB_EXCL
110             %DB_UPGRADE %DB_INORDER %DB_YIELDCPU %DB_ENV_DSYNC_DB
111             %DB_REP_ELECTION %DB_LOCK_RIW_N %DB_PAGE_LOCK
112             %DB_TXN_SYNC %DB_ST_DUPSORT %DB_LOG_SILENT_ERR
113             %DB_MPOOL_UNLINK %LOGREC_PGDBT %DB_DIRECT %DB_CHKSUM
114             %DB_ENV_OVERWRITE %DB_TXN_LOG_UNDO %DB_INIT_TXN
115             %DB_REP_CHECKPOINT_DELAY %DB_TEST_ELECTVOTE2
116             %DB_TEST_ELECTINIT %DB_EID_BROADCAST %DB_DELETED
117             %DB_REPMGR_ACKS_QUORUM %DB_ENV_LOCKDOWN
118             %DB_MUTEXDEBUG %DB_FREE_SPACE %DB_VERB_REGISTER
119             %DB_MPOOL_EDIT %DB_NORECURSE %DB_TEST_ELECTVOTE1
120             %DB_PRIORITY_LOW %DB_EVENT_REP_PERM_FAILED
121             %DB_SET_RANGE %DB_FORCE %LOGREC_LOCKS %DB_RENUMBER
122             %DB_REP_CONNECTION_RETRY %DB_MPOOL_PRIVATE
123             %DB_SEQUENCE_OLDVER %DB_LOG_CHKPNT %DB_FREELIST_ONLY
124             %DB_VERB_REP_MISC %DB_ENV_REGION_INIT %DB_RENUMBER
125             %DB_TXN_BACKWARD_ROLL %DB_LOCK_ABORT %DB_LOG_RESEND
126             %DB_ENV_REF_COUNTED %DB_DONOTINDEX %DB_NOMMAP
127             %DB_LOCK_UPGRADE %DB_REP_STARTUPDONE %DB_NEXT_DUP
128             %DB_ENV_OPEN_CALLED %DB_LOGVERSION_LATCHING
129             %DB_REP_ELECTION_RETRY %DB_VERB_REP_TEST
130             %DB_VERB_REP_MSGS %DB_debug_FLAG %DB_LOG_DSYNC
131             %DB_DSYNC_LOG %DB_GET_BOTH_LTE %DB_TXN_LOG_VERIFY
132             %DB_LOCK_RANDOM %DB_KEYEMPTY %DB_DIRECT_LOG
133             %DB_LOG_ZERO %DB_ENV_REP_LOGSONLY %DB_NOSYNC
134             %DB_LOG_VERIFY_INTERR %DB_SHALLOW_DUP %DB_SET
135             %DB_LOCK_SET_TIMEOUT %DB_UPDATE_SECONDARY
136             %DB_THREAD %DB_USERCOPY_SETDATA %DB_ASSOC_CREATE
137             %DB_MUTEXLOCKS %DB_LOGOLDVER %DB_TXN_LOCK_MASK
138             %DB_REGION_NAME %DB_NOLOCKING %DB_MPOOL_CREATE
139             %DB_INIT_MPOOL %DB_CURLSN %DB_LOG_PERM %DB_WRITELOCK
140             %DB_ENV_FAILCHK %DB_EVENT_REP_NEWMASTER
141             %DB_JAVA_CALLBACK %DB_OVERWRITE_DUP %DB_RPCCLIENT
142             %DB_ENV_CREATE %DB_ENV_THREAD %DB_PR_HEADERS
143             %DB_TXN_APPLY %DB_WRITELOCK %DB_VRFY_FLAGMASK
144             %DB_REP_LOCKOUT %DB_EVENT_NOT_HANDLED %DB_NEXT
145             %DB_TIME_NOTGRANTED %DB_LOG_INMEMORY %LOGREC_Done
146             %DB_LOG_DIRECT %DB_ALREADY_ABORTED %DB_INCOMPLETE
147             %DB_MUTEX_LOGICAL_LOCK %DB_TXN_LOG_MASK %DB_PREV
148             %DB_STAT_MEMP_NOERROR %DB_CL_WRITER %DB_DSYNC_DB
149             %DB_ENV_TXN_NOWAIT %DB_REGISTER %DB_ODDFILESIZE
150             %DB_FAST_STAT %DB_LOG_NOT_DURABLE %DB_CDB_ALLDB
151             %DB_LOG_NOCOPY %DB_INIT_CDB %DB_RECORDCOUNT
152             %LOGREC_DATA %DB_NEXT_DUP %DB_SET_LOCK_TIMEOUT
153             %DB_PERMANENT %DB_TXN_LOG_REDO %DB_CHECKPOINT
154             %DB_ENV_CDB_ALLDB %DB_EVENT_REP_JOIN_FAILURE
155             %DB_LOG_VERIFY_VERBOSE %DB_LOGCHKSUM %DB_BTREE
156             %DB_LOG_VERIFY_PARTIAL %DB_KEYFIRST %DB_EXTENT
157             %DB_TXN_SNAPSHOT %DB_REP_ISPERM %DB_NOPANIC
158             %DB_LOCK_UPGRADE_WRITE %DB_FOREIGN_CONFLICT
159             %DB_MPOOL_NEW %DB_TXN_UNDO %DB_REGION_MAGIC
160             %DB_PRIORITY_HIGH %DB_ENV_DIRECT_DB %LOGREC_HDR
161             %DB_RECOVER_FATAL %DB_LOCK_REMOVE %DB_LOGVERSION
162             %DB_GID_SIZE %DB_PRIORITY_UNCHANGED %LOGREC_HDR
163             %DB_LOGC_BUF_SIZE %DB_REVSPLITOFF %DB_LOCK_NOWAIT
164             %DB_SEQUENTIAL %DB_REGION_ANON %DB_ENV_NOMMAP
165             %DB_SEQUENCE_VERSION %DB_SYSTEM_MEM %DB_AFTER
166             %DB_REP_ELECTION_TIMEOUT %DB_STAT_ALL %DB_APPEND
167             %DB_HASHVERSION %DB_LOCK_OLDEST %DB_XIDDATASIZE
168             %DB_VERIFY_FATAL %DB_ASSOC_IMMUTABLE_KEY
169             %DB_SEQ_RANGE_SET %DB_REGION_INIT %DB_RECOVER
170             %DB_LOCK_MAXLOCKS %DB_REP_CONF_DELAYCLIENT
171             %DB_EVENT_REP_ELECTION_FAILED %DB_ENV_YIELDCPU
172             %DB_OK_QUEUE %DB_MULTIPLE_KEY %DB_DIRECT_DB
173             %DB_LOCK_DUMP %DB_TEST_PREDESTROY %DB_ENCRYPT
174             %DB_EID_INVALID %DB_LOCK_MINLOCKS %LOGREC_TIME
175             %LOGREC_DBOP %DB_ENV_REP_CLIENT %DB_SPARE_FLAG
176             %DB_TXNMAGIC %DB_LOCK_NOTEXIST %DB_REP_REREQUEST
177             %DB_VERB_REP_SYNC %DB_NO_AUTO_COMMIT %DB_PR_PAGE
178             %DB_EVENT_REP_DUPMASTER %DB_GET_BOTH %DB_HASH
179             %DB_TXN_BULK %DB_TEST_POSTLOG %DB_REP_LOGSONLY
180             %DB_ENV_TXN_NOT_DURABLE %DB_POSITION %DB_RECNUM
181             %DB_LOCKDOWN %DB_LOG_NO_DATA %DB_ST_DUPSET
182             %DB_REP_HEARTBEAT_SEND %DB_SET_TXN_TIMEOUT
183             %DB_REPMGR_ACKS_ALL_PEERS %DB_TEST_ELECTWAIT2
184             %DB_ENV_DATABASE_LOCKING %DB_GET_RECNO
185             %DB_ARCH_REMOVE %DB_LOCK_RECORD %DB_EVENT_PANIC
186             %DB_LOG_LOCKED %DB_LOCK_NOTGRANTED %DB_RMW
187             %DB_ENV_AUTO_COMMIT %DB_NEXT_NODUP %DB_SEQ_WRAP
188             %DB_LOCK_PUT_READ %DB_REP_ACK_TIMEOUT
189             %DB_VERB_CHKPOINT %DB_LOG_DISK %DB_HASHMAGIC
190             %DB_HASHOLDVER %DB_OK_HASH %DB_REP_NEWSITE
191             %DB_TEST_POSTRENAME %DB_ST_RELEN %DB_TXN_LOCK
192             %DB_NOSERVER_ID %DB_UNKNOWN %DB_ENV_LOGGING
193             %DB_EVENT_NO_SUCH_EVENT %DB_NODUPDATA
194             %DB_BUFFER_SMALL %DB_APP_INIT %DB_TXN_FAMILY
195             %DB_ENV_SYSTEM_MEM %DB_READ_UNCOMMITTED
196             %DB_MPOOL_DISCARD %DB_SNAPSHOT %DB_NOSERVER
197             %DB_REPMGR_CONNECTED %DB_VERSION_FULL_STRING
198             %DB_SWAPBYTES %DB_REP_MASTER %DB_SECONDARY_BAD
199             %DB_TXN_LOCK_2PL %DB_TXN_LOG_UNDOREDO
200             %DB_LOG_WRNOSYNC %DB_ENV_FATAL %DB_TRUNCATE
201             %DB_LOCK_PUT_ALL %DB_MUTEX_SELF_BLOCK
202             %DB_CURSOR_BULK %DB_VERSION_PATCH %DB_ENV_CDB
203             %DB_DATABASE_LOCK %DB_HANDLE_LOCK %DB_SET_LTE
204             %DB_LOG_VERIFY_BAD %DB_OPFLAGS_MASK %DB_PAD
205             %DB_SET_REG_TIMEOUT %DB_REP_BULKOVF
206             %DB_REP_CONF_LEASE %DB_INIT_LOCK %DB_NOTFOUND
207             %DB_TXN_PRINT %DB_INIT_LOG %DB_TEST_SUBDB_LOCKS
208             %DB_ARCH_ABS %DB_ST_DUPOK %DB_REP_IGNORE
209             %DB_REPMGR_PEER %DB_REPMGR_ACKS_NONE %LOGREC_DBT
210             %DB_WRNOSYNC %DB_VERSION_STRING %DB_ST_OVFL_LEAF
211             %DB_ENV_TXN_NOSYNC %DB_SA_SKIPFIRSTKEY %DB_FLUSH
212             %DB_REP_EGENCHG %DB_MPOOL_NEW_GROUP %DB_LOGMAGIC
213             %LOGREC_PGDDBT %DB_MPOOL_FREE %DB_READ_COMMITTED
214             %DB_ENV_NOLOCKING %DB_EVENT_REG_PANIC
215             %DB_TXN_NOSYNC %DB_CONSUME_WAIT %DB_CURRENT
216             %DB_REPMGR_ACKS_ALL %DB_REP_NOTPERM %DB_DEGREE_2
217             %LOGREC_POINTER %DB_REP_OUTDATED %DB_RDWRMASTER
218             %DB_ENV_USER_ALLOC %DB_CURSOR_TRANSIENT
219             %DB_FOREIGN_NULLIFY %DB_LOCK_SWITCH %DB_VERIFY
220             %DB_EVENT_REP_MASTER %DB_DIRTY_READ %LOGREC_DB
221             %DB_MPOOL_LAST %DB_CONSUME %DB_KEYLAST
222             %DB_LOCK_MINWRITE %DB_REP_HEARTBEAT_MONITOR
223             %DB_LOG_COMMIT %DB_VERB_RECOVERY %DB_TXN_WAIT
224             %DB_EVENT_REP_ELECTED %DB_FILE_ID_LEN
225             %DB_TEST_ELECTWAIT1 %DB_LOCK_EXPIRE %DB_LAST
226             %DB_DATABASE_LOCKING %DB_FCNTL_LOCKING
227             %DB_TXN_WRITE_NOSYNC %DB_ENV_NO_OUTPUT_SET
228             %DB_user_BEGIN %DB_EVENT_WRITE_FAILED
229             %DB_MPOOL_NOLOCK %DB_VERSION_MINOR %transform_mbii
230             %DB_REP_CREATE %DB_REP_DEFAULT_PRIORITY
231             %DB_REP_LEASE_TIMEOUT %DB_REP_CLIENT
232             %DB_TXN_LOCK_OPTIMIST %DB_LOCK_DEADLOCK
233             %DB_ENCRYPT_AES %DB_LOCK_MAXWRITE %DB_GETREC
234             %DB_MUTEX_THREAD %DB_ENV_PRIVATE %DB_PREV_DUP
235             %DB_TEST_PRERENAME %DB_PR_RECOVERYTEST
236             %DB_MPOOL_EXTENT %DB_FILEOPEN %DB_SALVAGE
237             %DB_CXX_NO_EXCEPTIONS %DB_LOCK_YOUNGEST
238             %DB_VERB_REPMGR_CONNFAIL %DB_REP_LOGREADY
239             %DB_ENV_TXN_WRITE_NOSYNC %DB_ENV_LOCKING
240             %DB_IMMUTABLE_KEY %DB_MUTEX_SHARED %DB_HEAP
241             %DB_CHKSUM_SHA1 %DB_ENV_TXN_SNAPSHOT
242             %DB_VERSION_MAJOR %DB_ENV_HOTBACKUP %transform_mboi
243             %DB_TEST_POSTDESTROY %DB_FORCESYNC %DB_DUP
244             %DB_NOSERVER_HOME %DB_SEQ_INC %DB_FIXEDLEN
245             %DB_LOG_VERIFY_CAF %DB_TXN_TOKEN_SIZE
246             %DB_VERB_FILEOPS_ALL %LOGREC_ARG %DB_RECNO
247             %DB_REP_LEASE_EXPIRED %DB_HOTBACKUP_IN_PROGRESS
248             %DB_ENV_DIRECT_LOG %DB_REPMGR_ACKS_ALL_AVAILABLE
249             %DB_WRITECURSOR %DB_STAT_LOCK_OBJECTS
250             %DB_TEST_RECYCLE %DB_TXN_ABORT %DB_PRIVATE
251             %DB_PANIC_ENVIRONMENT %DB_OVERWRITE
252             %DB_EVENT_REP_STARTUPDONE %DB_SURPRISE_KID
253             %DB_REPMGR_ACKS_ONE_PEER %DB_REP_HOLDELECTION
254             %DB_EVENT_REP_SITE_ADDED %DB_EVENT_REP_INIT_DONE
255             %DB_MEM_THREAD %DB_EVENT_REP_CONNECT_ESTD
256             %DB_ENV_NOFLUSH %DB_EVENT_REP_LOCAL_SITE_REMOVED
257             %DB_LEGACY %DB_GROUP_CREATOR %DB_EID_MASTER
258             %DB_HEAPVERSION %DB_OK_HEAP %DB_MEM_TRANSACTION
259             %DB_EVENT_REP_CONNECT_TRY_FAILED %DB_NOFLUSH
260             %DB_STAT_SUMMARY %DB_MEM_TRANSACTION %CARP_NOT
261             %DB_HEAPMAGIC %DB_REPMGR_NEED_RESPONSE
262             %DB_MEM_LOCKOBJECT %DB_MEM_LOGID %DB_MEM_LOCKER
263             %DB_INTERNAL_DB %DB_MEM_LOCK %DB_HEAPOLDVER
264             %DB_FAILCHK_ISALIVE %DB_BOOTSTRAP_HELPER
265             %DB_HEAP_FULL %DB_STAT_ALLOC %DB_LOCAL_SITE
266             %DB_NO_CHECKPOINT %DB_EVENT_REP_SITE_REMOVED
267             %DB_EVENT_REP_CONNECT_BROKEN %DB_INIT_MUTEX
268             %DB_VERB_BACKUP %DB_INTERNAL_PERSISTENT_DB
269             %DB_REP_CONF_AUTOROLLBACK %DB2_AM_INTEXCL
270             %DB2_AM_EXCL %DB_INTERNAL_TEMPORARY_DB
271             %DB_BACKUP_UPDATE %DB2_AM_NOWAIT %DB_BACKUP_SIZE
272             %DB_BACKUP_FILES %DB_BACKUP_WRITE_DIRECT
273             %DB_EVENT_REP_WOULD_ROLLBACK &DB_BACKUP_CLEAN
274             %DB_BACKUP_READ_COUNT %DB_BACKUP_SINGLE_DIR
275             %DB_LOCK_IGNORE_REC %DB_BACKUP_READ_SLEEP
276             %DB_BACKUP_NO_LOGS %DB_REP_WOULDROLLBACK
277             %DB_STREAM_WRITE %DB_REP_CONF_ELECT_LOGLENGTH
278             %list_module %DB_STREAM_READ %DB_LOG_BLOB
279             %DB_STREAM_SYNC_WRITE %DB_CHKSUM_FAIL
280             %DB_EVENT_REP_AUTOTAKEOVER_FAILED %DB_VERB_MVCC
281             %DB_REPMGR_ISVIEW %DB_MUTEX_PROCESS_ONLY
282             %transform_mbir %DB_EVENT_REP_INQUEUE_FULL
283             %DB_MUTEX_DESCRIBE_STRLEN %DB_FAILURE_SYMPTOM_SIZE
284             %DB_LOG_NOSYNC %DB_REPMGR_CONF_PREFMAS_CLIENT
285             %DB_SET_MUTEX_FAILCHK_TIMEOUT %DB_INTERNAL_BLOB_DB
286             %DB_EVENT_FAILCHK_PANIC %DB_EXIT_FAILCHK
287             %LOGREC_LONGARG %DB_EVENT_MUTEX_DIED
288             %DB_MUTEX_OWNER_DEAD %DB_STREAM_WRITE
289             %DB_REPMGR_CONF_PREFMAS_MASTER %DB_EXIT_FILE_EXISTS
290             %DB_MEM_EXTFILE_DATABASE %DB_EVENT_REP_AUTOTAKEOVER
291             %DB_FORCESYNCENV %SELECT %DB_REPMGR_CONF_FORWARD_WRITES
292             %DB_REPMGR_CONF_ENABLE_EPOLL %DB2_AM_MPOOL_OPENED
293             %DB_REP_WRITE_FORWARD_TIMEOUT %DB_META_CHKSUM_FAIL
294             %DB_MEM_REP_SITE %DB_LOG_EXT_FILE %DB_OFF_T_MAX
295             %DB_REPMGR_ISELECTABLE %DB_SLICE_CORRUPT
296             %DB_VERB_SLICE %DB_REPMGR_CONF_DISABLE_POLL
297             %DB_TXN_DISPATCH %DB_CONVERT %EPOLL %POLL
298             %DB_SYSTEM_MEM_MISSING %DB_REP_INELECT %DB_SLICED
299             %DB_REGION_MAGIC_RECOVER %DB_NOINTMP %HAVE_EPOLL
300 1     1   12 %DB_MEM_DATABASE %DB_MEM_DATABASE_LENGTH);
  1         2  
301            
302             @EXPORT = qw(pick Menu get_Menu_map);
303            
304             #####################################################################
305             #### ###
306             #### DEFAULT MODULE OF Term::Menus $tm_menu IS: ###
307             #### ###
308             #### ==> *NONE* <== If you want a different ###
309             #### ###
310             #### module to be the default, change $tm_menu variable below or ###
311             #### set the $tm_menu variable in the BEGIN { } block ###
312             #### of the top level script invoking &Menu(). (Advised) ###
313             #### ###
314             #####################################################################
315            
316             our $tm_menu='';
317            
318             # Example: our $tm_menu='my_menus.pm'; ###
319             ###
320             # See documentation for more info ###
321             ###
322             #################################################################
323            
324 1     1   10 use Config ();
  1         2  
  1         53  
325 1     1   7 use Cwd 'abs_path';
  1         3  
  1         119  
326 1     1   919 use Capture::Tiny;
  1         43466  
  1         436  
327             BEGIN {
328             our $filechk = sub {
329             package filechk;
330 0         0 eval { die };
  0         0  
331 0         0 my $path=$@;
332 0         0 $path=~s/Died at (.*)Term\/Menus.pm.*$/$1/s;
333 0         0 chomp($path);
334 0 0       0 return 0 unless -e "$path$_[0]";
335 0         0 return 1;
336 1     1   8 };
337             our $canload = sub {
338             package canloadone;
339 0         0 eval { die };
  0         0  
340 0         0 my $path=$@;
341 0         0 $path=~s/Died at (.*)Term\/Menus.pm.*$/$1/s;
342 0         0 chomp($path);
343 0         0 my $cwd=Cwd::cwd();
344 0 0 0     0 return 0 if (!(-e "$path$_[0]") and !(-e "$cwd/$INC[0]/$_[0]"));
345 0         0 eval { require $_[0] };
  0         0  
346 0 0       0 unless ($@) {
347 0         0 return 1;
348             } else {
349 0         0 return 0;
350             }
351 1         1041 };
352             }
353            
354             unless (defined caller(2) && -1
355            
356             ### NOTE: $tm_menu will *NOT* be used when Term::Menus
357             ### is used with Net::FullAuto. Set $fa_menu (below)
358             ### or $main::fa_menu when using Net::FullAuto.
359            
360             if ($tm_menu) {
361             unless ($Term::Menus::canload->($tm_menu)) {
362             my $die="\n FATAL ERROR: The variable \$tm_menu is defined,\n".
363             " in the module file:\n\n".
364             " $INC{'Term/Menus.pm'}\n\n".
365             " but the value: $tm_menu does not\n".
366             " reference a module that can be loaded";
367             die $die;
368             }
369             } elsif (defined $main::tm_menu) {
370             if ($Term::Menus::canload->($main::tm_menu)) {
371             $tm_menu=$main::tm_menu;
372             } else {
373             my $die="\n FATAL ERROR: The variable \$tm_menu is defined,\n".
374             " but the value: $tm_menu does not\n".
375             " reference a module that can be loaded";
376             die $die;
377             }
378             }
379             if ($tm_menu) {
380             require $tm_menu;
381             my $tm=substr($tm_menu,
382             (rindex $tm_menu,'/')+1,-3);
383             import $tm;
384             }
385            
386             }
387            
388             ##############################################################
389             ##############################################################
390             #
391             # THIS BLOCK MARKED BY TWO LINES OF POUND SYMBOLS IS FOR
392             # SETTINGS NEEDED BY THE MODULE Net::FullAuto. IF YOU ARE
393             # USING Term::Menus OUTSIDE OF Net::FullAuto, YOU CAN
394             # SAFELY IGNORE THIS SECTION. (That's 'ignore' - not 'remove')
395             #
396            
397             our $data_dump_streamer=0;
398             eval { require Data::Dump::Streamer };
399             unless ($@) {
400             $data_dump_streamer=1;
401             import Data::Dump::Streamer;
402             }
403            
404             #our $io_interactive=0;
405             #eval { require IO::Interactive };
406             #unless ($@) {
407             # $io_interactive=1;
408             # import IO::Interactive;
409             #}
410            
411             BEGIN { ## Begin Net::FullAuto Settings
412            
413 1     1   5 eval { require Data::Dump::Streamer };
  1         1238  
414 1 50       88246 unless ($@) {
415 1         3 $data_dump_streamer=1;
416 1         10 import Data::Dump::Streamer;
417             }
418 1 50       190 unless (exists $INC{'Term/Menus.pm'}) {
419 0         0 foreach my $fpath (@INC) {
420 0         0 my $f=$fpath;
421 0 0       0 if (-e $f.'/Term/Menus.pm') {
422 0         0 $INC{'Term/Menus.pm'}=$f.'/Term/Menus.pm';
423 0         0 last;
424             }
425             }
426             }
427 1         11 my $vlin=__LINE__;
428             #####################################################################
429             #### ###
430             #### DEFAULT MODULE OF Net::FullAuto $fa_code IS: ###
431             #### ###
432             #### ==> Distro/fa_code_demo.pm <== If you want a different ###
433             #### ###
434             #### module to be the default, change $fa_code variable below or ###
435             #### set the $fa_code variable in the BEGIN { } block ###
436             #### of the top level script invoking Net::FullAuto. (Advised) ###
437             #### ###
438             #####################################################################
439             ###
440 1         11 our $fa_code=['Distro/fa_code_demo.pm', #<== Change Location Here ###
441             "From $INC{'Term/Menus.pm'}, Line: ".($vlin+13)]; ###
442             ###
443             #####################################################################
444            
445             #####################################################################
446             #### ###
447             #### DEFAULT MODULE OF Net::FullAuto $fa_conf IS: ###
448             #### ###
449             #### ==> Distro/fa_conf.pm <== If you want a differnet ###
450             #### ###
451             #### module to be the default, change $fa_conf variable below or ###
452             #### set the $fa_conf variable in the BEGIN { } block ###
453             #### of the top level script invoking Net::FullAuto. (Advised) ###
454             #### ###
455             #####################################################################
456             ###
457 1         6 our $fa_conf=['Distro/fa_conf.pm', #<== Change Location Here ###
458             "From $INC{'Term/Menus.pm'}, Line: ".($vlin+30)]; ###
459             ###
460             #####################################################################
461            
462             #####################################################################
463             #### ###
464             #### DEFAULT MODULE OF Net::FullAuto $fa_host IS: ###
465             #### ###
466             #### ==> Distro/fa_host.pm <== If you want a different ###
467             #### ###
468             #### module to be the default, change $fa_host variable below or ###
469             #### set the $fa_hosts_config variable in the BEGIN { } block ###
470             #### of the top level script invoking Net::FullAuto. (Advised) ###
471             #### ###
472             #####################################################################
473             ###
474 1         5 our $fa_host=['Distro/fa_host.pm', #<== Change Location Here ###
475             "From $INC{'Term/Menus.pm'}, Line: ".($vlin+47)]; ###
476             ###
477             #####################################################################
478            
479             #####################################################################
480             #### ###
481             #### DEFAULT MODULE OF Net::FullAuto $fa_menu IS: ###
482             #### ###
483             #### ==> Distro/fa_menu_demo.pm <== If you want a different ###
484             #### ###
485             #### module to be the default, change $fa_menu variable below or ###
486             #### set the $fa_menu variable in the BEGIN { } block ###
487             #### of the top level script invoking Net::FullAuto. (Advised) ###
488             #### ###
489             #####################################################################
490             ###
491 1         6 our $fa_menu=['Distro/fa_menu_demo.pm', #<== Change Location Here ###
492             "From $INC{'Term/Menus.pm'}, Line ".($vlin+81)]; ###
493             ###
494             #####################################################################
495            
496 1         3 our $fullauto=0;$new_user_flag=1;
  1         3  
497 1 50 33     380 if (defined caller(2) && -1
498 0         0 $fullauto=1;
499 0         0 my $default_modules='';
500 0 0 0     0 unless ($main::fa_code && $main::fa_conf && $main::fa_host
      0        
      0        
501             && $main::fa_menu) {
502 0 0       0 unless (exists $INC{'Net/FullAuto.pm'}) {
503 0         0 foreach my $fpath (@INC) {
504 0         0 my $f=$fpath;
505 0 0       0 if (-e $f.'/Net/FullAuto.pm') {
506 0         0 $INC{'Net/FullAuto.pm'}=$f.'/Net/FullAuto.pm';
507 0         0 last;
508             }
509             }
510             }
511 0         0 my $fa_path=$INC{'Net/FullAuto.pm'};
512 0         0 my $progname=substr($0,(rindex $0,'/')+1,-3);
513 0         0 substr($fa_path,-3)='';
514 0   0     0 my $username=getlogin || getpwuid($<);
515 0 0       0 if (-f $fa_path.'/fa_global.pm') {
516 0 0       0 if (-r $fa_path.'/fa_global.pm') {
517             {
518 1     1   10 no strict 'subs';
  1         2  
  1         179  
  0         0  
519 0         0 require $fa_path.'/fa_global.pm';
520 0   0     0 $fa_global::berkeley_db_path||='';
521 0   0     0 $fa_global::FA_Sudo||={};
522 0 0       0 if (exists $fa_global::FA_Sudo->{$username}) {
523 0         0 $username=$fa_global::FA_Sudo->{$username};
524             }
525 0 0 0     0 if ($fa_global::berkeley_db_path &&
526             -d $fa_global::berkeley_db_path.'Defaults') {
527 1     1   13 BEGIN { $Term::Menus::facall=caller(2);
528 1   50     65 $Term::Menus::facall||='' };
529 1         2318 use if (-1
530 1     1   8 "BerkeleyDB";
  1         2  
531 0 0       0 my $dbenv = BerkeleyDB::Env->new(
532             -Home => $fa_global::berkeley_db_path.'Defaults',
533             -Flags => DB_CREATE|DB_INIT_CDB|DB_INIT_MPOOL
534             ) or die(
535             "cannot open environment for DB: ".
536             $BerkeleyDB::Error."\n",'','');
537 0 0       0 my $kind=(grep { /^--test$/ } @ARGV)?'test':'prod';
  0         0  
538 0         0 my $bdb = BerkeleyDB::Btree->new(
539             -Filename => "${progname}_${kind}_defaults.db",
540             -Flags => DB_CREATE,
541             -Env => $dbenv
542             );
543 0 0       0 unless ($BerkeleyDB::Error=~/Successful/) {
544 0         0 $bdb = BerkeleyDB::Btree->new(
545             -Filename => "${progname}_${kind}_defaults.db",
546             -Flags => DB_CREATE|DB_RECOVER_FATAL,
547             -Env => $dbenv
548             );
549 0 0       0 unless ($BerkeleyDB::Error=~/Successful/) {
550 0         0 die "Cannot Open DB ${progname}_${kind}_defaults.db:".
551             " $BerkeleyDB::Error\n";
552             }
553             }
554 0 0 0     0 if (exists $ENV{'SSH_CONNECTION'} &&
    0 0        
    0 0        
      0        
555             exists $ENV{'USER'} && ($ENV{'USER'}
556             ne $username)) {
557 0         0 $username=$ENV{'USER'};
558             } elsif ($username eq 'SYSTEM' &&
559             exists $ENV{'IWUSER'} && ($ENV{'IWUSER'}
560             ne $username)) {
561 0         0 my $login_flag=0;
562 0         0 foreach (@ARGV) {
563 0         0 my $argv=$_;
564 0 0       0 if ($login_flag) {
    0          
565 0         0 $username=$argv;
566 0         0 last;
567             } elsif (lc($argv) eq '--login') {
568 0         0 $login_flag=1;
569             }
570             }
571 0 0       0 $username=$ENV{'IWUSER'} unless $login_flag;
572 0         0 } elsif (grep { /--login/ } @ARGV) {
573 0         0 my $login_flag=0;
574 0         0 foreach (@ARGV) {
575 0         0 my $argv=$_;
576 0 0       0 if ($login_flag) {
    0          
577 0         0 $username=$argv;
578 0         0 last;
579             } elsif (lc($argv) eq '--login') {
580 0         0 $login_flag=1;
581             }
582             }
583             }
584 0 0       0 my $status=$bdb->db_get(
585             $username,$default_modules) if $bdb;
586 0   0     0 $default_modules||='';
587 0 0       0 $default_modules=~s/\$HASH\d*\s*=\s*//s
588             if -1
589 0         0 $default_modules=eval $default_modules;
590 0   0     0 $default_modules||={};
591 0         0 my $save_defaults_for_user_flag=0;
592 0 0       0 if ($data_dump_streamer) {
593 0         0 foreach my $mod (keys %{$default_modules}) {
  0         0  
594 0 0       0 if ($mod eq 'set') {
595 0 0       0 if ($default_modules->{set} ne 'none') {
596 0         0 $save_defaults_for_user_flag=1;
597 0         0 next;
598 0         0 } else { next }
599             }
600 0 0       0 unless ($Term::Menus::filechk->(
601             $default_modules->{$mod})) {
602 0         0 delete $default_modules->{$mod};
603 0         0 next;
604             }
605 0         0 $save_defaults_for_user_flag=1;
606             }
607 0 0       0 if ($save_defaults_for_user_flag) {
608 0         0 my $def_modules=Data::Dump::Streamer::Dump(
609             $default_modules)->Out();
610 0 0       0 my $status=$bdb->db_put(
611             $username,$def_modules) if $bdb;
612             } else {
613 0 0       0 my $status=$bdb->db_del(
614             $username) if $bdb;
615             }
616             }
617 0         0 undef $bdb;
618 0         0 $dbenv->close();
619 0         0 undef $dbenv;
620 0 0       0 unless (keys %{$default_modules}) {
  0 0       0  
621 0         0 $default_modules->{'set'}='none';
622 0         0 $default_modules->{'fa_code'}=
623             'Net/FullAuto/Distro/fa_code_demo.pm';
624 0         0 $default_modules->{'fa_conf'}=
625             'Net/FullAuto/Distro/fa_conf.pm';
626 0         0 $default_modules->{'fa_host'}=
627             'Net/FullAuto/Distro/fa_host.pm';
628 0         0 $default_modules->{'fa_menu'}=
629             'Net/FullAuto/Distro/fa_menu_demo.pm';
630 0 0       0 } elsif (exists $default_modules->{'set'} &&
631             $default_modules->{'set'} ne 'none') {
632 0         0 $new_user_flag=0;
633 0         0 my $setname=$default_modules->{'set'};
634 0 0       0 my $stenv = BerkeleyDB::Env->new(
635             -Home => $fa_global::berkeley_db_path.'Sets',
636             -Flags => DB_CREATE|DB_INIT_CDB|DB_INIT_MPOOL
637             ) or die(
638             "cannot open environment for DB: ".
639             $BerkeleyDB::Error."\n",'','');
640 0         0 my $std = BerkeleyDB::Btree->new(
641             -Filename => "${progname}_sets.db",
642             -Flags => DB_CREATE,
643             -Env => $stenv
644             );
645 0 0       0 unless ($BerkeleyDB::Error=~/Successful/) {
646 0         0 $std = BerkeleyDB::Btree->new(
647             -Filename => "${progname}_sets.db",
648             -Flags => DB_CREATE|DB_RECOVER_FATAL,
649             -Env => $stenv
650             );
651 0 0       0 unless ($BerkeleyDB::Error=~/Successful/) {
652 0         0 die "Cannot Open DB ${progname}_sets.db:".
653             " $BerkeleyDB::Error\n";
654             }
655             }
656             #my $username=getlogin || getpwuid($<);
657 0         0 my $set='';
658 0         0 my $status=$std->db_get(
659             $username,$set);
660 0   0     0 $set||='';
661 0 0       0 $set=~s/\$HASH\d*\s*=\s*//s
662             if -1
663 0         0 $set=eval $set;
664 0   0     0 $set||={};
665 0         0 undef $std;
666 0         0 $stenv->close();
667 0         0 undef $stenv;
668 0         0 $fa_code=[$set->{$setname}->{'fa_code'},
669             "From Default Set $setname ".
670             "(Change with fa --set)"];
671 0         0 $fa_conf=[$set->{$setname}->{'fa_conf'},
672             "From Default Set $setname ".
673             "(Change with fa --set)"];
674 0         0 $fa_host=[$set->{$setname}->{'fa_host'},
675             "From Default Set $setname ".
676             "(Change with fa --set)"];
677 0         0 $fa_menu=[$set->{$setname}->{'fa_menu'},
678             "From Default Set $setname ".
679             "(Change with fa --set)"];
680             } else {
681 0         0 $new_user_flag=0;
682 0 0       0 if (exists $default_modules->{'fa_code'}) {
683 0         0 $fa_code=[$default_modules->{'fa_code'},
684             "From Default Setting ".
685             "(Change with fa --defaults)"];
686             }
687 0 0       0 if (exists $default_modules->{'fa_conf'}) {
688 0         0 $fa_conf=[$default_modules->{'fa_conf'},
689             "From Default Setting ".
690             "(Change with fa --defaults)"];
691             }
692 0 0       0 if (exists $default_modules->{'fa_host'}) {
693 0         0 $fa_host=[$default_modules->{'fa_host'},
694             "From Default Setting ".
695             "(Change with fa --defaults)"];
696             }
697 0 0       0 if (exists $default_modules->{'fa_menu'}) {
698 0         0 $fa_menu=[$default_modules->{'fa_menu'},
699             "From Default Setting ".
700             "(Change with fa --defaults)"];
701             }
702             }
703             }
704             }
705             } else {
706 0         0 warn("WARNING: Cannot read defaults file $fa_path/fa_global.pm".
707             " - permission denied (Hint: Perhaps you need to 'Run as ".
708             "administrator'?)");
709             }
710             }
711 0         0 my @A=();my %A=();
  0         0  
712 0         0 push @A,@ARGV;
713 0         0 my $acnt=0;
714 0         0 foreach my $a (@A) {
715 0         0 $acnt++;
716 0         0 my $aa=$a;
717 0 0       0 if (-1
    0          
718 0         0 my $k=unpack('x5a*',$aa);
719 0   0     0 my $v=$A[$acnt]||'';
720 0 0       0 unless (-1
721 0         0 $A{$k}=$v;
722             } else {
723 0         0 @A=();
724 0         0 last;
725             }
726             } elsif (-1
727 0   0     0 my $v=$A[$acnt]||'';
728 0 0       0 unless (-1
729 0         0 $A{set}=$v;
730             } else {
731 0         0 @A=();
732 0         0 last;
733             }
734             }
735             }
736 0         0 foreach my $e (('set','code','conf','host','maps','menu')) {
737 0 0       0 if (exists $A{$e}) {
738 0         0 $new_user_flag=0;
739 0 0       0 if ($e eq 'set') {
    0          
    0          
    0          
    0          
740 1     1   10 no strict 'subs';
  1         2  
  1         3795  
741 0         0 my $setname=$A{$e};
742 0         0 my $fa_path=$INC{'Net/FullAuto.pm'};
743 0         0 my $progname=substr($0,(rindex $0,'/')+1,-3);
744 0         0 substr($fa_path,-3)='';
745 0 0       0 if (-f $fa_path.'/fa_global.pm') {
746 0 0       0 my $stenv = BerkeleyDB::Env->new(
747             -Home => $fa_global::berkeley_db_path.'Sets',
748             -Flags => DB_CREATE|DB_INIT_CDB|DB_INIT_MPOOL
749             ) or die(
750             "cannot open environment for DB: ".
751             $BerkeleyDB::Error."\n",'','');
752 0         0 my $std = BerkeleyDB::Btree->new(
753             -Filename => "${progname}_sets.db",
754             -Flags => DB_CREATE,
755             -Env => $stenv
756             );
757 0 0       0 unless ($BerkeleyDB::Error=~/Successful/) {
758 0         0 $std = BerkeleyDB::Btree->new(
759             -Filename => "${progname}_sets.db",
760             -Flags => DB_CREATE|DB_RECOVER_FATAL,
761             -Env => $stenv
762             );
763 0 0       0 unless ($BerkeleyDB::Error=~/Successful/) {
764 0         0 die "Cannot Open DB ${progname}_sets.db:".
765             " $BerkeleyDB::Error\n";
766             }
767             }
768             #my $username=getlogin || getpwuid($<);
769 0         0 my $set='';
770 0         0 my $status=$std->db_get(
771             $username,$set);
772 0   0     0 $set||='';
773 0 0       0 $set=~s/\$HASH\d*\s*=\s*//s
774             if -1
775 0         0 $set=eval $set;
776 0   0     0 $set||={};
777 0         0 undef $std;
778 0         0 $stenv->close();
779 0         0 undef $stenv;
780 0         0 $fa_code=[$set->{$setname}->{'fa_code'},
781             "From CMD arg fa --set $setname line ".__LINE__];
782 0         0 $fa_conf=[$set->{$setname}->{'fa_conf'},
783             "From CMD arg fa --set $setname line ".__LINE__];
784 0         0 $fa_host=[$set->{$setname}->{'fa_host'},
785             "From CMD arg fa --set $setname line ".__LINE__];
786 0         0 $fa_menu=[$set->{$setname}->{'fa_menu'},
787             "From CMD arg fa --set $setname line ".__LINE__];
788             } else {
789 0         0 my $die="\n FATAL ERROR: The Set indicated from".
790             " the CMD arg:\n\n".
791             " ==> fa --set $A{$e}n\n".
792             " does not exist. To create this\n".
793             " set, run fa --set without any\n".
794             " other arguments";
795 0         0 die $die;
796             }
797             } elsif ($e eq 'code') {
798 0         0 $fa_code=$A{$e};
799 0         0 $fa_code=[$fa_code,
800             "From CMD arg: fa --fa_code $A{$e}"];
801             } elsif ($e eq 'menu') {
802 0         0 $fa_menu=$A{$e};
803 0         0 $fa_menu=[$fa_menu,
804             "From CMD arg: fa --fa_menu $A{$e}"];
805             } elsif ($e eq 'host') {
806 0         0 $fa_host=$A{$e};
807 0         0 $fa_host=[$fa_host,
808             "From CMD arg: fa --fa_host $A{$e}"];
809             } elsif ($e eq 'conf') {
810 0         0 $fa_conf=$A{$e};
811 0         0 $fa_conf=[$fa_conf,
812             "From CMD arg: fa --fa_conf $A{$e}"];
813             }
814             }
815 0   0     0 my $abspath=abs_path($0)||'';
816 0         0 $abspath=~s/\.exe$//;
817 0         0 $abspath.='.pl';
818 0 0 0     0 if (defined $main::fa_code && $main::fa_code) {
819 0         0 $new_user_flag=0;
820 0         0 $fa_code=$main::fa_code;
821 0   0     0 my $p=abs_path($0)||'';
822 0         0 $fa_code=[$fa_code,
823             "From \$fa_code variable in $abspath"];
824             }
825 0 0 0     0 if (defined $main::fa_conf && $main::fa_conf) {
826 0         0 $new_user_flag=0;
827 0         0 $fa_conf=$main::fa_conf;
828 0         0 $fa_conf=[$fa_conf,
829             "From \$fa_conf variable in $abspath"];
830             }
831 0 0 0     0 if (defined $main::fa_host && $main::fa_host) {
832 0         0 $new_user_flag=0;
833 0         0 $fa_host=$main::fa_host;
834 0         0 $fa_host=[$fa_host,
835             "From \$fa_host variable in $abspath"];
836             }
837 0 0 0     0 if (defined $main::fa_menu && $main::fa_menu) {
838 0         0 $new_user_flag=0;
839 0         0 $fa_menu=$main::fa_menu;
840 0         0 $fa_menu=[$fa_menu,
841             "From \$fa_menu variable in $abspath"];
842             }
843             }
844             } else {
845 0         0 $new_user_flag=0;
846 0   0     0 my $abspath=abs_path($0)||'';
847 0         0 $abspath=~s/\.exe$//;
848 0         0 $abspath.='.pl';
849 0         0 $fa_code=[$fa_code,
850             "From \$fa_code variable in $abspath"];
851 0         0 $fa_conf=[$fa_conf,
852             "From \$fa_conf variable in $abspath"];
853 0         0 $fa_host=[$fa_host,
854             "From \$fa_host variable in $abspath"];
855 0         0 $fa_menu=[$fa_menu,
856             "From \$fa_menu variable in $abspath"];
857             }
858 0 0 0     0 $fa_code->[0]='Net/FullAuto/'.$fa_code->[0]
859             if $fa_code->[0] && -1==index $fa_code->[0],'Net/FullAuto';
860 0   0     0 $fa_code->[0]||='';
861 0         0 my $argv=join " ",@ARGV;
862 0         0 my $rx='^--edi*t* *|^-e[a-z]|^--admin|^-V|^-v|^--VE*R*S*I*O*N*|'.
863             '^--users|^--ve*r*s*i*o*n*|^--cat|^--tutorial|^--figlet';
864 0 0       0 if (!map { /$rx/ } @ARGV) {
  0         0  
865 0 0       0 if ($fa_code->[0]) {
866 0 0       0 if ($Term::Menus::canload->($fa_code->[0])) {
867 0         0 require $fa_code->[0];
868 0         0 my $mod=substr($fa_code->[0],(rindex $fa_code->[0],'/')+1,-3);
869 0         0 import $mod;
870 0         0 $fa_code=$mod.'.pm';
871             } else {
872 0         0 my $ln=__LINE__;
873 0         0 $ln-=5;
874             die "Cannot load module $fa_code->[0]".
875             "\n $fa_code->[1]\n".
876             "\"require $fa_code->[0];\"".
877 0         0 "--failed at ".$INC{'Term/Menus.pm'}." line $ln\.\n$@\n";
878             }
879             } else {
880 0         0 require 'Net/FullAuto/Distro/fa_code.pm';
881 0         0 import fa_code;
882 0         0 $fa_code='fa_code.pm';
883             }
884             }
885 0 0 0     0 $fa_conf->[0]='Net/FullAuto/'.$fa_conf->[0]
886             if $fa_conf->[0] && -1==index $fa_conf->[0],'Net/FullAuto';
887 0   0     0 $fa_conf->[0]||='';
888 0 0       0 if ($argv!~/--edit |^-e[a-z]|--cat /) {
889 0 0       0 if ($fa_conf->[0]) {
890 0 0       0 if ($Term::Menus::canload->($fa_conf->[0])) {
891 0         0 require $fa_conf->[0];
892 0         0 my $mod=substr($fa_conf->[0],(rindex $fa_conf->[0],'/')+1,-3);
893 0         0 import $mod;
894 0         0 $fa_conf=$mod.'.pm';
895             } else {
896 0         0 my $ln=__LINE__;
897 0         0 $ln-=5;
898             die "Cannot load module $fa_conf->[0]".
899             "\n $fa_conf->[1]\n".
900             "\"require $fa_conf->[0];\"".
901 0         0 "--failed at ".$INC{'Term/Menus.pm'}." line $ln\.\n$@\n";
902             }
903             } else {
904 0         0 require 'Net/FullAuto/Distro/fa_conf.pm';
905 0         0 import fa_conf;
906 0         0 $fa_conf='fa_conf.pm';
907             }
908             }
909 0 0 0     0 $fa_host->[0]='Net/FullAuto/'.$fa_host->[0]
910             if $fa_host->[0] && -1==index $fa_host->[0],'Net/FullAuto';
911 0   0     0 $fa_host->[0]||='';
912 0 0       0 if ($argv!~/--edit |^-e[a-z]/) {
913 0 0       0 if ($fa_host->[0]) {
914 0 0       0 if ($Term::Menus::canload->($fa_host->[0])) {
915 0         0 require $fa_host->[0];
916 0         0 my $mod=substr($fa_host->[0],(rindex $fa_host->[0],'/')+1,-3);
917 0         0 import $mod;
918 0         0 $fa_host=$mod.'.pm';
919             } else {
920 0         0 my $ln=__LINE__;
921 0         0 $ln-=5;
922             die "Cannot load module $fa_host->[0]".
923             "\n $fa_host->[1]\n".
924             "\"require $fa_host->[0];\"".
925 0         0 "--failed at ".$INC{'Term/Menus.pm'}." line $ln\.\n$@\n";
926             }
927             } else {
928 0         0 require 'Net/FullAuto/Distro/fa_host.pm';
929 0         0 import fa_host;
930 0         0 $fa_host='fa_host.pm';
931             }
932             }
933 0 0 0     0 $fa_menu->[0]='Net/FullAuto/'.$fa_menu->[0]
934             if $fa_menu->[0] && -1==index $fa_menu->[0],'Net/FullAuto';
935 0   0     0 $fa_menu->[0]||='';
936 0 0       0 if ($argv!~/--edit |^-e[a-z]/) {
937 0 0       0 if ($fa_menu->[0]) {
938 0 0       0 if ($Term::Menus::canload->($fa_menu->[0])) {
939 0         0 require $fa_menu->[0];
940 0         0 my $mod=substr($fa_menu->[0],(rindex $fa_menu->[0],'/')+1,-3);
941 0         0 import $mod;
942 0         0 $fa_menu=$mod.'.pm';
943             } else {
944 0         0 my $ln=__LINE__;
945 0         0 $ln-=5;
946             die "Cannot load module $fa_menu->[0]".
947             "\n $fa_menu->[1]\n".
948             "\"require $fa_menu->[0];\"".
949 0         0 "--failed at ".$INC{'Term/Menus.pm'}." line $ln\.\n$@\n";
950             }
951             } else {
952 0         0 require 'Net/FullAuto/Distro/fa_menu_demo.pm';
953 0         0 import fa_menu_demo;
954 0         0 $fa_menu='fa_menu_demo.pm';
955             }
956             }
957            
958             }
959            
960             }
961            
962             our %email_defaults=();
963             if (%fa_code::email_defaults) {
964             %email_defaults=%fa_code::email_defaults;
965             }
966             our %email_addresses=();
967             if (%fa_code::email_addresses) {
968             %email_addresses=%fa_code::email_addresses;
969             }
970             our $passwd_file_loc='';
971             if (defined $fa_code::passwd_file_loc && $fa_code::passwd_file_loc) {
972             $passwd_file_loc=$fa_code::passwd_file_loc;
973             }
974             our $test=0;
975             if (defined $fa_code::test && $fa_code::test) {
976             $test=$fa_code::test;
977             }
978             our $timeout=30;
979             if (defined $fa_code::timeout && $fa_code::timeout) {
980             $timeout=$fa_code::timeout;
981             }
982             our $log=0;
983             if (defined $fa_code::log && $fa_code::log) {
984             $log=$fa_code::log;
985             }
986             our $tosspass=0;
987             if (defined $fa_code::tosspass && $fa_code::tosspass) {
988             $tosspass=$fa_code::tosspass;
989             }
990            
991             ## End Net::FullAuto Settings
992            
993             ##############################################################
994             ##############################################################
995            
996             ## Begin Term::Menus
997            
998             our $termwidth=0;
999             our $termheight=0;
1000             our $padwalker=0;
1001             our $term_input=0;
1002             eval { require Term::ReadKey };
1003             unless ($@) {
1004             import Term::ReadKey;
1005             ($termwidth,$termheight)=eval {
1006 1     1   10 no strict 'subs';
  1         3  
  1         1406  
1007             my ($termwidth,$termheight)=('','');
1008             my ($stdout_capture,$stderr_capture)=
1009             Capture::Tiny::capture {
1010             ($termwidth, $termheight) =
1011             Term::ReadKey::GetTerminalSize();
1012             $termwidth||='';$termheight||='';
1013             }; return $termwidth,$termheight;
1014             };
1015             if ($@) {
1016             $termwidth='';$termheight='';
1017             }
1018             } else {
1019             $termwidth='';$termheight='';
1020             }
1021             if ($termwidth) {
1022             eval { require Term::RawInput };
1023             unless ($@) {
1024             $term_input=1;
1025             import Term::RawInput;
1026             }
1027             }
1028             eval { require PadWalker };
1029             unless ($@) {
1030             $padwalker=1;
1031             import PadWalker;
1032             }
1033             eval { require Devel::Symdump };
1034             unless ($@) {
1035             #$devel_symdump=1;
1036             import Devel::Symdump;
1037             }
1038             our $clearpath='';
1039             if ($^O ne 'MSWin32' && $^O ne 'MSWin64') {
1040             if (-e '/usr/bin/clear') {
1041             $clearpath='/usr/bin/';
1042             } elsif (-e '/bin/clear') {
1043             $clearpath='/bin/';
1044             } elsif (-e '/usr/local/bin/clear') {
1045             $clearpath='/usr/local/bin/';
1046             }
1047             }
1048            
1049             our %LookUpMenuName=();
1050             our $MenuMap=[];
1051            
1052             our $noclear=1; # set to one to turn off clear for debugging
1053            
1054             sub check_for_dupe_menus {
1055            
1056 0     0 0   my $m_flag=0;
1057 0           my $s_flag=0;
1058 0           foreach my $dir (@INC) {
1059 0 0 0       if (!$m_flag && -f "$dir/$Term::Menus::fa_menu") {
1060 0           $m_flag=1;
1061 0           open(FH,"<$dir/$Term::Menus::fa_menu");
1062 0           my $line='';my %menudups=();
  0            
1063 0           while ($line=) {
1064 0 0         if ($line=~/^[ \t]*\%(.*)\s*=/) {
1065 0 0         if (!exists $menudups{$1}) {
1066 0           $menudups{$1}='';
1067             } else {
1068 0           my $mcmf=$Term::Menus::fa_menu;my $die='';
  0            
1069 0           $die="\n FATAL ERROR! - Duplicate Hash Blocks:"
1070             ."\n -> \"%$1\" is defined more than once\n"
1071             ." in the $dir/$mcmf file.\n\n"
1072             ." Hint: delete or comment-out all duplicates\n\n";
1073 0 0         if ($Term::Menus::fullauto) {
1074 0 0         print $die if !$Net::FullAuto::FA_Core::cron;
1075 0           &Net::FullAuto::FA_Core::handle_error($die,'__cleanup__');
1076 0           } else { die $die }
1077             }
1078             }
1079             }
1080             }
1081 0 0 0       if (!$s_flag && -f "$dir/$Term::Menus::fa_code") {
1082 0           $s_flag=1;
1083 0           open(FH,"<$dir/$Term::Menus::fa_code");
1084 0           my $line='';my %dups=();
  0            
1085 0           while ($line=) {
1086 0 0         if ($line=~/^[ \t]*\%(.*)\s*=/) {
1087 0 0         if (!exists $dups{$1}) {
1088 0           $dups{$1}='';
1089             } else {
1090 0           my $die="\n FATAL ERROR! - Duplicate Hash Blocks:"
1091             ."\n -> \"%$1\" is defined more "
1092             ."than once\n in the $dir/"
1093             .$Term::Menus::fa_code
1094             ." file.\n\n Hint: delete "
1095             ."or comment-out all duplicates\n\n";
1096 0 0         if ($Term::Menus::fullauto) {
1097 0 0         print $die if !$Net::FullAuto::FA_Core::cron;
1098 0           &Net::FullAuto::FA_Core::handle_error($die,'__cleanup__');
1099 0           } else { die $die }
1100             }
1101             }
1102             }
1103             }
1104             }
1105            
1106 0 0         if ($Term::Menus::fullauto) {
1107 0           foreach my $symname (keys %Term::Menus::) {
1108 0 0         if (eval "\\%$symname") {
1109 0           my $hashref=eval "\\%$symname";
1110 0           HF: foreach my $key (keys %{$hashref}) {
  0            
1111 0 0         if (ref $hashref->{$key} eq 'HASH') {
1112 0           foreach my $ky (keys %{$hashref->{$key}}) {
  0            
1113 0 0         if (lc($ky) eq 'text') {
1114 0           $LookUpMenuName{$hashref}=$symname;
1115 0           last HF;
1116             }
1117             }
1118             }
1119             }
1120             }
1121             }
1122             }
1123            
1124             }
1125            
1126             &check_for_dupe_menus() if defined $main::fa_menu
1127             && $main::fa_menu;
1128            
1129             {
1130 1     1   809 use Sys::Hostname;
  1         1958  
  1         1005  
1131             our $local_hostname=&Sys::Hostname::hostname();
1132             }
1133            
1134             my $count=0;
1135             our $blanklines='';
1136             if ($Term::Menus::termheight) {
1137             $count=$Term::Menus::termheight;
1138             } else { $count=30 }
1139             while ($count--) { $blanklines.="\n" }
1140             our $parent_menu='';
1141            
1142             sub fa_login
1143             {
1144 0     0 0   my $code='';my $menu_args='';my $to='';my $die='';
  0            
  0            
  0            
1145 0           my $start_menu_ref='';my $cache='';
  0            
1146 0           my $returned='';
1147 0           eval {
1148 0           ($code,$menu_args,$to,$cache)=
1149             &Net::FullAuto::FA_Core::fa_login(@_);
1150 0 0         $main::cache=$cache if $cache;
1151 0 0         undef $main::cache unless $cache;
1152 0           my $mc=substr($Term::Menus::fa_menu,
1153             (rindex $Term::Menus::fa_menu,'/')+1,-3);
1154 0           $start_menu_ref=eval '$'.$mc.'::start_menu_ref';
1155 0   0       $to||=0;
1156 0 0         $timeout=$to if $to;
1157 0 0         if ($code) {
    0          
    0          
1158 0           &run_sub($code,$menu_args);
1159             } elsif (ref $start_menu_ref eq 'HASH') {
1160 0 0         unless (keys %LookUpMenuName) {
1161 0           &check_for_dupe_menus();
1162             }
1163 0 0         if ($Net::FullAuto::FA_Core::plan) {
1164 0           my $plann=shift @{$Net::FullAuto::FA_Core::plan};
  0            
1165 0           my $return=eval $plann->{Item};
1166 0 0         &Net::FullAuto::FA_Core::handle_error($@,'-1') if $@;
1167 0           return $return;
1168             }
1169 0           $returned=&Menu($start_menu_ref);
1170             } elsif ($start_menu_ref) {
1171 0           my $mcmf=$Term::Menus::fa_menu;
1172 0           my $die="\n FATAL ERROR! - The top level menu "
1173             ."block indicated\n by the "
1174             ."\$start_menu_ref variable in the\n "
1175             ." $mcmf file, does not exist as"
1176             ."\n a properly constructed and"
1177             ."\\or named hash\n block in the"
1178             ." ".__PACKAGE__.".pm file\n\n Hint: "
1179             ."our \$start_menu_ref=\\%Menu_1\;\n\n "
1180             ."\[ Menu_1 is example - name you choose is"
1181             ." optional \]\n\n %Menu_1=\(\n"
1182             ." Item_1 => { ... },\n "
1183             ."...\n \)\;\n";
1184 0           &Net::FullAuto::FA_Core::handle_error($die);
1185             } else {
1186 0           my $mcmf=$Term::Menus::fa_menu;
1187 0           my $die="\n FATAL ERROR! - The \$start_menu_ref\n"
1188             ." variable in the $mcmf\n"
1189             ." file, is not defined or properly"
1190             ."\n initialized with the name of "
1191             ."the\n menu hash block designated"
1192             ." for the\n top level menu.\n\n"
1193             ." Hint: our \$start_menu_ref"
1194             ."=\\%Menu_1\;\n\n \[ Menu_1 is example - "
1195             ."name you choose is optional \]\n\n "
1196             ."%Menu_1=\(\n Item_1 => { ... },\n"
1197             ." ...\n \)\;\n";
1198 0           &Net::FullAuto::FA_Core::handle_error($die);
1199             }
1200             };
1201 0 0         if ($@) {
1202 0           my $cmdlin=52;
1203 0 0         $cmdlin=47 if $code;
1204 0           my $errr=$@;
1205 0           $errr=~s/^\s*/\n /s;
1206 0           print $errr;
1207             }
1208 0 0         &Net::FullAuto::FA_Core::cleanup(1,$returned) if $returned;
1209 0           &Net::FullAuto::FA_Core::cleanup(0,'');
1210            
1211             }
1212            
1213             sub run_sub
1214             {
1215 1     1   9 use if $Term::Menus::fullauto, "IO::Handle";
  1         4  
  1         59  
1216 1     1   6 use if $Term::Menus::fullauto, POSIX => qw(setsid);
  1         3  
  1         9988  
1217            
1218 0 0 0 0 0   if ($Term::Menus::fullauto && defined $Net::FullAuto::FA_Core::service
      0        
1219             && $Net::FullAuto::FA_Core::service) {
1220 0           print "\n\n ##### TRANSITIONING TO SERVICE ######".
1221             "\n\n FullAuto will now continue running as".
1222             "\n as a Service/Daemon. Now exiting".
1223             "\n interactive mode ...\n\n";
1224 0 0         chdir '/' or die "Can't chdir to /: $!";
1225 0           umask 0;
1226 0 0         open STDIN, '/dev/null' or die "Can't read /dev/null: $!";
1227 0 0         open STDOUT, '>/dev/null' or die "Can't write to /dev/null: $!";
1228 0 0         open STDERR, '>/dev/null' or die "Can't write to /dev/null: $!";
1229 0 0         defined(my $pid = fork) or die "Can't fork: $!";
1230 0 0         exit if $pid;
1231 0 0         $pid = &setsid or die "Can't start a new session: $!";
1232             }
1233            
1234 0           my $code=$_[0];
1235 0           $code=~s/^[&]//;
1236 0 0         my $menu_args= (defined $_[1]) ? $_[1] : '';
1237 0 0         my $subfile=substr($Term::Menus::fa_code,0,-3).'::'
1238             if $Term::Menus::fa_code;
1239 0   0       $subfile||='';
1240 0           my $return=
1241             eval "\&$subfile$code\(\@{\$menu_args}\)";
1242 0 0         &Net::FullAuto::FA_Core::handle_error($@,'-1') if $@;
1243 0           return $return;
1244             }
1245            
1246             sub get_all_hosts
1247             {
1248 0     0 0   return Net::FullAuto::FA_Core::get_all_hosts(@_);
1249             }
1250            
1251             sub get_Menu_map_count
1252             {
1253 0     0 0   my $map_count=0;$count=0;
  0            
1254 0           foreach my $map (@{$_[0]}) {
  0            
1255 0           $count=$map->[0];
1256 0 0         $map_count=$count if $map_count<$count;
1257             }
1258 0           return $map_count;
1259             }
1260            
1261             sub get_Menu_map
1262             {
1263 0     0 1   my %tmphash=();my @menu_picks=();
  0            
1264 0           foreach my $map (@{$MenuMap}) {
  0            
1265 0           $tmphash{$map->[0]}=$map->[1];
1266             }
1267 0           foreach my $number (sort numerically keys %tmphash) {
1268 0           push @menu_picks, $tmphash{$number};
1269             }
1270 0           return @menu_picks;
1271             }
1272            
1273             sub eval_error
1274             {
1275            
1276 0   0 0 0   my $log_handle=$_[1]||'';
1277 0 0 0       if (10
1278 0 0 0       if (defined $log_handle &&
1279             -1
1280 0           print $log_handle $@;
1281 0           close($log_handle);
1282             }
1283 0           die $_[0];
1284             } else {
1285 0           my $die="\n FATAL ERROR! - The Local "
1286             ."System $Term::Menus::local_hostname "
1287             ."Conveyed\n"
1288             ." the Following "
1289             ."Unrecoverable Error Condition :\n\n"
1290             ." $_[0]\n line ".__LINE__;
1291 0 0 0       if (defined $log_handle &&
1292             -1
1293 0           print $log_handle $die;
1294 0           close($log_handle);
1295             }
1296 0 0         if ($Term::Menus::fullauto) {
1297 0           &Net::FullAuto::FA_Core::handle_error($die);
1298 0           } else { die $die }
1299             }
1300             }
1301            
1302             sub banner
1303             {
1304            
1305 0   0 0 0   my $banner=$_[0]||'';
1306 0 0         return '' unless $banner;
1307 0   0       my $Conveyed=$_[1]||{};
1308 0   0       my $SaveMMap=$_[2]||'';
1309 0   0       my $picks_from_parent=$_[3]||'';
1310 0 0         my $numbor=(defined $_[4])?$_[4]:'';
1311 0   0       my $ikey=$_[5]||'';
1312 0   0       my $input=$_[6]||{};
1313 0   0       my $MenuUnit_hash_ref=$_[7]||{};
1314 0   0       my $log_handle=$_[8]||'';
1315 0   0       $banner||='';
1316 0 0 0       if (ref $banner eq 'CODE') {
    0          
1317 0           my $banner_code=$banner;
1318 0 0         if ($Term::Menus::data_dump_streamer) {
1319 0           $banner_code=
1320             &Data::Dump::Streamer::Dump($banner_code)->Out();
1321 0           $banner_code=&transform_pmsi($banner_code,
1322             $Conveyed,$SaveMMap,$picks_from_parent);
1323             }
1324             #print "WHAT IS CDNOW2=$banner_code<==\n";;
1325 0           $banner_code=~s/\$CODE\d*\s*=\s*//s;
1326             #print "WHAT IS CDREALLYNOW=$banner_code<==\n";;
1327 0           my $eval_banner_code=eval $banner_code;
1328 0   0 0     $eval_banner_code||=sub {};
1329 0           my $die="\n"
1330             ." FATAL ERROR! - Error in Banner => sub{ *CONTENT* },\n"
1331             ." code block. To find error, copy the\n"
1332             ." *CONTENT* to a separate script, and\n"
1333             ." test for the error there. Use the\n"
1334             ." 'use strict;' pragma.\n\n";
1335 0           eval {
1336 0           $banner=$eval_banner_code->();
1337             };
1338 0 0         if ($@) {
1339 0 0 0       if (10
1340 0 0         if (wantarray) {
1341 0           return '',$@
1342             }
1343 0 0 0       if (defined $log_handle &&
1344             -1
1345 0           print $log_handle $@;
1346 0           close($log_handle);
1347             }
1348 0 0         if ($Term::Menus::fullauto) {
1349 0           &Net::FullAuto::FA_Core::handle_error($@);
1350 0           } else { die $@ }
1351             } else {
1352 0 0         if (wantarray) {
1353 0           return '',$die.' '.$@
1354             }
1355 0 0 0       if (defined $log_handle &&
1356             -1
1357 0           print $log_handle $die.' '.$@;
1358 0           close($log_handle);
1359             }
1360 0 0         if ($Term::Menus::fullauto) {
1361 0           &Net::FullAuto::FA_Core::handle_error(
1362             $die.' '.$@);
1363 0           } else { die $die.' '.$@ }
1364             }
1365             }
1366 0           } elsif (keys %{$Conveyed} || $picks_from_parent) {
1367 0           $banner=&transform_pmsi($banner,
1368             $Conveyed,$SaveMMap,$picks_from_parent);
1369             } else {
1370 0           chomp($banner);
1371             }
1372 0 0 0       if ($banner && ($banner=~/^&?(?:.*::)*(\w+)\s*[(]?.*[)]?\s*$/
      0        
      0        
      0        
1373 0           && grep { $1 eq $_ } list_module('main',$Term::Menus::fa_code)) &&
1374             defined $picks_from_parent &&
1375             !ref $picks_from_parent) {
1376 0           my @banner=();
1377 0 0         if ($banner!~/::/) {
1378 0           $banner=~s/^[&]//;
1379 0           eval "\@banner=main::$banner";
1380             } else {
1381 0           eval "\@banner=$banner";
1382             }
1383 0           $banner=join '',@banner;
1384             }
1385 0           return transform_mboi(transform_mbii(transform_mbir(
1386             $banner,$Conveyed,$MenuUnit_hash_ref,
1387             $log_handle),$numbor,$ikey,$input,
1388             $MenuUnit_hash_ref,$Conveyed,$log_handle),$MenuUnit_hash_ref,
1389             $Conveyed,$SaveMMap,$picks_from_parent,$log_handle);
1390            
1391             }
1392            
1393             sub Menu
1394             {
1395             #print "MENUCALLER=",(caller)[0]," and ",__PACKAGE__,"\n";;
1396             #print "MENUCALLER=",caller,"\n";
1397 0     0 1   my $MenuUnit_hash_ref=$_[0];
1398             #print "WHAT IS THIS=",&Data::Dump::Streamer::Dump($MenuUnit_hash_ref)->Out(),"\n";
1399 0           $MenuUnit_hash_ref->{Name}=&pw($MenuUnit_hash_ref);
1400 0           my $select_many=0;
1401 0 0         if (exists $MenuUnit_hash_ref->{Select}) {
1402 0 0 0       if (exists $MenuUnit_hash_ref->{Select} &&
    0 0        
      0        
      0        
1403             $MenuUnit_hash_ref->{Select} &&
1404             $MenuUnit_hash_ref->{Select}=~/many/i) {
1405 0           $select_many='Many';
1406 0           $MenuUnit_hash_ref->{Select}={};
1407             } elsif (exists $MenuUnit_hash_ref->{Select} &&
1408             $MenuUnit_hash_ref->{Select} &&
1409             $MenuUnit_hash_ref->{Select}=~/one/i) {
1410 0           $MenuUnit_hash_ref->{Select}={};
1411             }
1412             } else {
1413 0           $MenuUnit_hash_ref->{Select}={};
1414             }
1415 0   0       my $picks_from_parent=$_[1]||'';
1416 0           my $log_handle='';
1417 0 0 0       if ($picks_from_parent && -1
1418 0           $log_handle=$picks_from_parent;
1419 0           $picks_from_parent='';
1420             }
1421 0           my $unattended=0;
1422 0 0         if ($picks_from_parent=~/\](Cron|Batch|Unattended|FullAuto)\[/i) {
1423 0           $unattended=1;
1424 0           undef $picks_from_parent;
1425             }
1426 0 0         my $recurse = (defined $_[2]) ? $_[2] : 0;
1427 0 0         my $FullMenu= (defined $_[3]) ? $_[3] : {};
1428 0 0         my $Selected= (defined $_[4]) ? $_[4] : {};
1429 0 0         my $Conveyed= (defined $_[5]) ? $_[5] : {};
1430 0 0         my $SavePick= (defined $_[6]) ? $_[6] : {};
1431 0 0         my $SaveMMap= (defined $_[7]) ? $_[7] : {};
1432 0 0         my $SaveNext= (defined $_[8]) ? $_[8] : {};
1433 0 0         my $Persists= (defined $_[9]) ? $_[9] : {};
1434 0 0         my $parent_menu= (defined $_[10]) ? $_[10] : '';
1435 0           my $no_wantarray=0;
1436            
1437 0 0 0       if ((defined $_[11] && $_[11]) ||
      0        
      0        
1438             ((caller)[0] ne __PACKAGE__ && !wantarray)) {
1439 0           $no_wantarray=1;
1440             }
1441 0 0 0       if (defined $_[12] && $_[12]) {
1442 0           return '','','','','','','','','','','',$_[12];
1443             }
1444 0 0 0       if (defined $_[13] && $_[13]) {
1445 0           $log_handle=$_[13];
1446             }
1447 0           my %Items=();my %negate=();my %result=();my %convey=();
  0            
  0            
  0            
1448 0           my %chosen=();my %default=();my %select=();my %mark=();
  0            
  0            
  0            
1449 0           my $pick='';my $picks=[];my %num__=();
  0            
  0            
1450 0           my $display_this_many_items=10;my $die_err='';
  0            
1451 0           my $master_substituted='';my $convey='';$mark{BLANK}=1;
  0            
  0            
1452 0           my $show_banner_only=0;
1453 0           my $num=0;my @convey=();my $filtered=0;my $sorted='';
  0            
  0            
  0            
1454 0           foreach my $key (keys %{$MenuUnit_hash_ref}) {
  0            
1455 0 0 0       if (4
1456 0           $Items{substr($key,5)}=$MenuUnit_hash_ref->{$key};
1457             }
1458             }
1459 0 0         $Persists->{unattended}=$unattended if $unattended;
1460             my $start=($FullMenu->{$MenuUnit_hash_ref}[11])?
1461 0 0         $FullMenu->{$MenuUnit_hash_ref}[11]:0;
1462            
1463             ############################################
1464             # Breakdown the MenuUnit into its Components
1465             ############################################
1466            
1467             # Breakdown Each Item into its Components
1468             #########################################
1469            
1470 0           my $got_item_flag=0;
1471 0           while (++$num) {
1472 0   0       $start=$FullMenu->{$MenuUnit_hash_ref}[11]||0;
1473 0           @convey=();
1474 0 0         unless (exists $Items{$num}) {
1475 0 0 0       if (exists $MenuUnit_hash_ref->{Banner} && !$got_item_flag) {
1476 0           $show_banner_only=1;
1477 0           } else { last }
1478             } else {
1479 0           $got_item_flag=1;
1480             }
1481 0 0 0       if (exists $Items{$num}->{Negate} &&
1482 0           !(keys %{$MenuUnit_hash_ref->{Select}})) {
1483 0           my $die="Can Only Use \"Negate =>\""
1484             ."\n\t\tElement in ".__PACKAGE__.".pm when the"
1485             ."\n\t\t\"Select =>\" Element is set to \'Many\'\n\n";
1486 0 0         &Net::FullAuto::FA_Core::handle_error($die)
1487             if $Term::Menus::fullauto;
1488 0           die $die;
1489             }
1490 0           my $con_regex=qr/\]c(o+nvey)*\[/i;
1491 0 0         if (exists $Items{$num}->{Convey}) {
    0          
1492 0           my $convey_test=$Items{$num}->{Convey};
1493 0 0 0       if (ref $Items{$num}->{Convey} eq 'ARRAY') {
    0          
    0          
1494 0           foreach my $line (@{$Items{$num}->{Convey}}) {
  0            
1495 0           push @convey, $line;
1496             }
1497             } elsif (ref $Items{$num}->{Convey} eq 'CODE') {
1498 0           my $convey_code=$Items{$num}->{Convey};
1499 0 0         if ($Term::Menus::data_dump_streamer) {
1500 0           $convey_code=
1501             &Data::Dump::Streamer::Dump($convey_code)->Out();
1502             #print "PICKSFROMPARENTXX=$picks_from_parent AND CONVEY_CODE=$convey_code\n";
1503 0           $convey_code=&transform_pmsi($convey_code,
1504             $Conveyed,$SaveMMap,$picks_from_parent);
1505             }
1506             #print "WHAT IS CDNOW1=$convey_code<==\n";
1507 0           $convey_code=~s/\$CODE\d*\s*=\s*//s;
1508             #print "WHAT IS CDREALLYNOW=$convey_code<==\n";;
1509 0           my $eval_convey_code=eval $convey_code;
1510 0   0 0     $eval_convey_code||=sub {};
1511 0           @convey=$eval_convey_code->();
1512 0 0         @convey=@{$convey[0]} if ref $convey[0] eq 'ARRAY';
  0            
1513 0 0         if ($@) {
1514 0 0 0       if (10
1515 0 0 0       if ($parent_menu && wantarray && !$no_wantarray) {
      0        
1516 0           return '',$FullMenu,$Selected,$Conveyed,
1517             $SavePick,$SaveMMap,$SaveNext,
1518             $Persists,$parent_menu,$@;
1519             }
1520 0 0 0       if (defined $log_handle &&
1521             -1
1522 0           print $log_handle $@;
1523 0           close($log_handle);
1524             }
1525 0 0         if ($Term::Menus::fullauto) {
1526 0           &Net::FullAuto::FA_Core::handle_error($@);
1527 0           } else { die $@ }
1528             } else {
1529 0           my $die="\n FATAL ERROR! - The Local "
1530             ."System $Term::Menus::local_hostname "
1531             ."Conveyed\n"
1532             ." the Following "
1533             ."Unrecoverable Error Condition :\n\n"
1534             ." $@\n line ".__LINE__;
1535 0 0 0       if ($parent_menu && wantarray && !$no_wantarray) {
      0        
1536 0           return '',$FullMenu,$Selected,$Conveyed,
1537             $SavePick,$SaveMMap,$SaveNext,
1538             $Persists,$parent_menu,$die;
1539             }
1540 0 0 0       if (defined $log_handle &&
1541             -1
1542 0           print $log_handle $die;
1543 0           close($log_handle);
1544             }
1545 0 0         if ($Term::Menus::fullauto) {
1546 0           &Net::FullAuto::FA_Core::handle_error($die);
1547 0           } else { die $die }
1548             }
1549             }
1550 0 0 0       if (0==$#convey && $convey[0]=~/^(?:[{](.*)[}])?[<]$/) {
1551 0           return \@convey;
1552             }
1553             } elsif ($convey_test=~/^&?(?:.*::)*(\w+)\s*[(]?.*[)]?\s*$/ &&
1554 0           grep { $1 eq $_ } list_module('main',$Term::Menus::fa_code)) {
1555 0 0 0       if (defined $picks_from_parent &&
1556             !ref $picks_from_parent) {
1557             my $transformed_convey=
1558             &transform_pmsi($Items{$num}->{Convey},
1559 0           $Conveyed,$SaveMMap,
1560             $picks_from_parent);
1561 0 0         if ($transformed_convey!~/::/) {
1562 0           $transformed_convey=~s/^[&]//;
1563 0           eval "\@convey=main::$transformed_convey";
1564             } else {
1565 0           eval "\@convey=$transformed_convey";
1566             }
1567             }
1568             } else {
1569 0           push @convey, $Items{$num}->{Convey};
1570             }
1571 0           foreach my $item (@convey) {
1572 0 0         next if $item=~/^\s*$/s;
1573 0           my $text=$Items{$num}->{Text};
1574 0           $text=~s/$con_regex/$item/g;
1575 0           $text=&transform_pmsi($text,
1576             $Conveyed,$SaveMMap,
1577             $picks_from_parent);
1578 0 0         if (-1
1579 0           $text=~
1580             s/__Master_${$}__/Local-Host: $Term::Menus::local_hostname/sg;
1581 0           $master_substituted="Local-Host: $Term::Menus::local_hostname";
1582             }
1583 0 0 0       if (exists $Items{$num}->{Include}) {
    0          
1584 0 0         if ($text=~/$Items{$num}->{Include}/s) {
1585             next if exists $Items{$num}->{Exclude} &&
1586 0 0 0       $text=~/$Items{$num}->{Exclude}/;
1587 0           push @{$picks}, $text;
  0            
1588             } else {
1589 0           next;
1590             }
1591             } elsif (exists $Items{$num}->{Exclude} &&
1592             $text=~/$Items{$num}->{Exclude}/) {
1593 0           next;
1594             } else {
1595 0           push @{$picks}, $text;
  0            
1596             }
1597 0 0 0       if (exists $Items{$num}->{Convey} &&
    0          
1598             $Items{$num}->{Convey} ne '') {
1599 0           $convey{$text}=[$item,$Items{$num}->{Convey}];
1600             } elsif (!exists $Items{$num}->{Convey}) {
1601 0           $convey{$text}=[$item,''];
1602             }
1603             $default{$text}=$Items{$num}->{Default}
1604 0 0         if exists $Items{$num}->{Default};
1605             #print "WHAT IS THIS=$text and NEGATE=",$Items{$num}->{Negate}," and KEYS=",keys %{$Items{$num}},"\n";
1606             $negate{$text}=$Items{$num}->{Negate}
1607 0 0         if exists $Items{$num}->{Negate};
1608 0 0         if (exists $FullMenu->{$MenuUnit_hash_ref}[2]{$text}) {
    0          
1609             $result{$text}=
1610 0           $FullMenu->{$MenuUnit_hash_ref}[2]{$text};
1611             } elsif (exists $Items{$num}->{Result}) {
1612             $result{$text}=$Items{$num}->{Result}
1613 0           }
1614 0           my $tsttt=$Items{$num}->{Select};
1615             $select{$text}=$Items{$num}->{Select}
1616             if exists $Items{$num}->{Select}
1617 0 0 0       && $tsttt=~/many/i;
1618 0 0         if (exists $Items{$num}->{Mark}) {
1619 0           $mark{$text}=$Items{$num}->{Mark};
1620 0           my $lmt=length $mark{$text};
1621 0 0         $mark{BLANK}=$lmt if $mark{BLANK}<$lmt;
1622             }
1623 0 0         $filtered=1 if exists $Items{$num}->{Filter};
1624             $sorted=$Items{$num}->{Sort}
1625 0 0         if exists $Items{$num}->{Sort};
1626 0           $chosen{$text}="Item_$num";
1627             }
1628             } elsif ($show_banner_only) {
1629 0 0         if (exists $MenuUnit_hash_ref->{Result}) {
1630 0           $result{'__FA_Banner__'}=$MenuUnit_hash_ref->{Result};
1631 0           } last;
1632             } else {
1633             my $text=&transform_pmsi($Items{$num}->{Text},
1634 0           $Conveyed,$SaveMMap,
1635             $picks_from_parent);
1636 0 0         if (-1{Text},"__Master_${$}__") {
1637 0           $text=~
1638             s/__Master_${$}__/Local-Host: $Term::Menus::local_hostname/sg;
1639 0           $master_substituted=
1640             "Local-Host: $Term::Menus::local_hostname";
1641             }
1642 0 0 0       if (exists $Items{$num}->{Include}) {
    0          
1643 0 0         if ($Items{$num}->{Text}=~/$Items{$num}->{Include}/) {
1644             next if exists $Items{$num}->{Exclude} &&
1645 0 0 0       $Items{$num}->{Text}=~/$Items{$num}->{Exclude}/;
1646 0           push @{$picks}, $text;
  0            
1647 0           } else { next }
1648             } elsif (exists $Items{$num}->{Exclude} &&
1649             $Items{$num}->{Text}=~/$Items{$num}->{Exclude}/) {
1650 0           next;
1651 0           } else { push @{$picks}, $text }
  0            
1652             $convey{$Items{$num}->{Text}}=['',$Items{$num}->{Convey}]
1653 0 0         if exists $Items{$num}->{Convey};
1654             $default{$text}=$Items{$num}->{Default}
1655 0 0         if exists $Items{$num}->{Default};
1656             $negate{$text}=$Items{$num}->{Negate}
1657 0 0         if exists $Items{$num}->{Negate};
1658 0 0         if (exists $FullMenu->{$MenuUnit_hash_ref}[2]{$text}) {
    0          
1659             $result{$text}=
1660 0           $FullMenu->{$MenuUnit_hash_ref}[2]{$text};
1661             } elsif (exists $Items{$num}->{Result}) {
1662             $result{$text}=$Items{$num}->{Result}
1663 0           }
1664 0   0       my $tsttt=$Items{$num}->{Select}||'';
1665             $select{$text}=$Items{$num}->{Select}
1666             if exists $Items{$num}->{Select}
1667 0 0 0       && $tsttt=~/many/i;
1668 0 0         if (exists $Items{$num}->{Mark}) {
1669 0           $mark{$text}=$Items{$num}->{Mark};
1670 0           my $lmt=length $mark{$text};
1671 0 0         $mark{BLANK}=$lmt if $mark{BLANK}<$lmt;
1672             }
1673 0 0         $filtered=1 if exists $Items{$num}->{Filter};
1674             $sorted=$Items{$num}->{Sort}
1675 0 0         if exists $Items{$num}->{Sort};
1676 0           $chosen{$text}="Item_$num";
1677             $num__{$text}=$Items{$num}->{__NUM__}
1678 0 0         if exists $Items{$num}->{__NUM__};
1679             }
1680             }
1681            
1682            
1683             #########################################
1684             # End Items Breakdown
1685            
1686             $display_this_many_items=$_[0]->{Display}
1687 0 0         if exists $_[0]->{Display};
1688            
1689 0 0 0       if (exists $MenuUnit_hash_ref->{Scroll} &&
1690             ref $MenuUnit_hash_ref->{Scroll} ne 'ARRAY') {
1691             $MenuUnit_hash_ref->{Scroll}=
1692 0           [ $MenuUnit_hash_ref->{Scroll},1 ];
1693             }
1694            
1695             ############################################
1696             # End MenuUnit Breakdown
1697             ############################################
1698            
1699 0 0         %default=() if defined $FullMenu->{$MenuUnit_hash_ref}[5];
1700 0 0         my $nm_=(keys %num__)?\%num__:{};
1701             #print "MENU=",$MenuUnit_hash_ref->{Name}," and CONVEY=",keys %convey,"\n";;
1702 0           $FullMenu->{$MenuUnit_hash_ref}=[ $MenuUnit_hash_ref,
1703             \%negate,\%result,\%convey,\%chosen,\%default,
1704             \%select,\%mark,$nm_,$filtered,$picks,$start ];
1705 0 0 0       if ($select_many || keys %{$MenuUnit_hash_ref->{Select}}) {
  0            
1706 0           my @filtered_menu_return=();
1707 0           my $error='';
1708             ($pick,$FullMenu,$Selected,$Conveyed,$SavePick,
1709             $SaveMMap,$SaveNext,$Persists,$parent_menu,
1710             @filtered_menu_return,$error)=&pick(
1711 0   0       $picks,$MenuUnit_hash_ref->{Banner}||'',
1712             $display_this_many_items,'','',
1713             $MenuUnit_hash_ref,++$recurse,
1714             $picks_from_parent,$parent_menu,
1715             $FullMenu,$Selected,$Conveyed,$SavePick,
1716             $SaveMMap,$SaveNext,$Persists,
1717             $no_wantarray,$sorted,
1718             $select_many);
1719 0 0         if (-1<$#filtered_menu_return) {
1720 0           return $pick,$FullMenu,$Selected,$Conveyed,$SavePick,
1721             $SaveMMap,$SaveNext,$Persists,$parent_menu,
1722             $filtered_menu_return[0],$filtered_menu_return[1],
1723             $filtered_menu_return[2];
1724             }
1725 0 0 0       if ($Term::Menus::fullauto && $master_substituted) {
1726 0           $pick=~s/$master_substituted/__Master_${$}__/sg;
1727             }
1728 0 0 0       if ($pick eq ']quit[') {
    0 0        
    0 0        
    0 0        
    0          
1729 0           return ']quit['
1730             } elsif ($pick eq '-' || $pick eq '+') {
1731 0           return $pick,$FullMenu,$Selected,$Conveyed,
1732             $SavePick,$SaveMMap,$SaveNext,$Persists;
1733             } elsif ($pick=~/DONE/) {
1734 0           return $pick,$FullMenu,$Selected,$Conveyed,
1735             $SavePick,$SaveMMap,$SaveNext,$Persists;
1736             } elsif (ref $pick eq 'ARRAY' && wantarray
1737             && !$no_wantarray && 1==$recurse) {
1738 0 0         if (ref $pick->[$#{$pick}] eq 'HASH') {
  0            
1739 0           my @choyce=@{$pick};undef @{$pick};undef $pick;
  0            
  0            
  0            
  0            
1740 0           pop @choyce;
1741 0           pop @choyce;
1742             return @choyce
1743 0           }
1744 0           my @choyce=@{$pick};undef @{$pick};undef $pick;
  0            
  0            
  0            
  0            
1745             return @choyce
1746 0           } elsif ($pick) { return $pick }
  0            
1747             } else {
1748 0           my @filtered_menu_return=();
1749 0           my $error='';
1750             ($pick,$FullMenu,$Selected,$Conveyed,$SavePick,
1751             $SaveMMap,$SaveNext,$Persists,$parent_menu,
1752             @filtered_menu_return,$error)
1753 0   0       =&pick($picks,$MenuUnit_hash_ref->{Banner}||'',
1754             $display_this_many_items,
1755             '','',$MenuUnit_hash_ref,++$recurse,
1756             $picks_from_parent,$parent_menu,
1757             $FullMenu,$Selected,$Conveyed,$SavePick,
1758             $SaveMMap,$SaveNext,$Persists,
1759             $no_wantarray,$sorted,
1760             $select_many);
1761 0 0         if (-1<$#filtered_menu_return) {
1762 0           return $pick,$FullMenu,$Selected,$Conveyed,$SavePick,
1763             $SaveMMap,$SaveNext,$Persists,$parent_menu,
1764             $filtered_menu_return[0],$filtered_menu_return[1],
1765             $filtered_menu_return[2];
1766             }
1767             #print "WAHT IS ALL=",keys %{$pick->[0]}," and FULL=$FullMenu and SEL=$Selected and CON=$Conveyed and SAVE=$SavePick and LAST=$SaveMMap and NEXT=$SaveNext and PERSISTS=$Persists and PARENT=$parent_menu<==\n";
1768 0 0 0       if ($Term::Menus::fullauto && $master_substituted) {
1769 0           $pick=~s/$master_substituted/__Master_${$}__/sg;
1770             }
1771 0 0 0       if ($pick eq ']quit[') {
    0          
    0          
    0          
    0          
1772 0           return ']quit['
1773             } elsif ($pick eq '-' || $pick eq '+') {
1774 0 0         unless (keys %{$SavePick->{$MenuUnit_hash_ref}}) {
  0 0          
1775 0           return $pick,$FullMenu,$Selected,$Conveyed,
1776             $SavePick,$SaveMMap,$SaveNext,$Persists;
1777 0 0         } elsif ($select_many || keys %{$Selected->{$MenuUnit_hash_ref}}) {
  0            
1778 0           return '+',$FullMenu,$Selected,$Conveyed,
1779             $SavePick,$SaveMMap,$SaveNext,$Persists;
1780             } else {
1781 0           return $pick,$FullMenu,$Selected,$Conveyed,
1782             $SavePick,$SaveMMap,$SaveNext,$Persists;
1783             }
1784             } elsif ($pick=~/DONE/) {
1785 0           return $pick,$FullMenu,$Selected,$Conveyed,
1786             $SavePick,$SaveMMap,$SaveNext,$Persists;
1787             } elsif (ref $pick eq 'ARRAY') {
1788 0           my $topmenu='';
1789 0           my $savpick='';
1790 0 0 0       if (1==$recurse && ref $pick->[$#{$pick}] eq 'HASH') {
  0            
1791 0           $topmenu=pop @{$pick};
  0            
1792 0           $savpick=pop @{$pick};
  0            
1793             }
1794 0 0 0       if (wantarray && 1==$recurse) {
    0 0        
    0 0        
      0        
1795 0           my @choyce=@{$pick};undef @{$pick};undef $pick;
  0            
  0            
  0            
  0            
1796             return @choyce
1797 0           } elsif (ref $pick eq 'ARRAY' && -1<$#{$pick} &&
  0            
1798             $pick->[0]=~/^[{](.*)[}][<]$/) {
1799 0           return $pick,$FullMenu,$Selected,$Conveyed,
1800             $SavePick,$SaveMMap,$SaveNext,$Persists;
1801             } elsif (!$picks_from_parent &&
1802             !(keys %{$MenuUnit_hash_ref->{Select}})) {
1803 0 0 0       if (ref $topmenu eq 'HASH' && (keys %{$topmenu->{Select}} &&
  0 0 0        
    0 0        
      0        
      0        
      0        
1804             $topmenu->{Select} eq 'Many') || (ref $savpick eq 'HASH' &&
1805 0           exists $topmenu->{Select}->{(keys %{$savpick})[0]})) {
1806 0 0         if (wantarray) {
1807 0           return @{$pick}
  0            
1808             } else {
1809 0           return $pick;
1810             }
1811 0           } elsif (-1==$#{$pick} &&
1812             (ref $topmenu eq 'HASH') &&
1813 0           (grep { /Item_/ } keys %{$topmenu})) {
  0            
1814 0           return [ $topmenu ];
1815 0           } elsif (0==$#{$pick}) {
1816 0           return $pick->[0];
1817             } else {
1818 0           return $pick;
1819             }
1820             } else {
1821 0 0         if ($picks_from_parent) {
1822 0           $pick->[0]=&transform_pmsi($pick->[0],
1823             $Conveyed,$SaveMMap,$picks_from_parent);
1824             }
1825 0           return $pick
1826             }
1827 0           } elsif ($pick) { return $pick }
1828             }
1829            
1830             }
1831            
1832             sub pw {
1833            
1834             ## pw [p]ad [w]alker
1835             #print "PWCALLER=",caller,"\n";
1836             return $_[0]->{Name} if ref $_[0] eq 'HASH'
1837 0 0 0 0 0   && exists $_[0]->{Name};
1838 0           my @packages=();
1839 0 0 0       @packages=@{$_[1]} if defined $_[1] && $_[1];
  0            
1840 0           my $name='';
1841 0 0         unless (ref $_[0] eq 'HASH') {
1842 0           return '';
1843             } else {
1844 0           my $flag=1;
1845 0           my $n=0;
1846 0           WH: while (1) {
1847             {
1848 0           local $SIG{__DIE__}; # No sigdie handler
  0            
1849 0           eval {
1850 0           $name=PadWalker::var_name($n++,$_[0]);
1851             };
1852 0 0         if ($@) {
1853 0           undef $@;
1854 0           my $o=0;
1855 0           while (1) {
1856 0           eval {
1857 0           my $vars=PadWalker::peek_our($o++);
1858 0           foreach my $key (keys %{$vars}) {
  0            
1859 0 0 0       if (ref $vars->{$key} eq 'HASH' &&
1860 0           %{$_[0]} eq %{$vars->{$key}}) {
  0            
1861 0           $name=$key;
1862 0           last;
1863             }
1864             }
1865             };
1866 0 0         if ($@) {
1867 0           undef $@;
1868 0           my $s=0;
1869 0           unshift @packages, 'main';
1870 0           PK: foreach my $package (@packages) {
1871 0           my $obj=Devel::Symdump->rnew($package);
1872 0           foreach my $hash ($obj->hashes) {
1873 0 0         next if $hash=~/^_
1874 0 0         next if $hash=~/^Term::Menus::/;
1875 0 0         next if $hash=~/^Config::/;
1876 0 0         next if $hash=~/^DynaLoader::/;
1877 0 0         next if $hash=~/^warnings::/;
1878 0 0         next if $hash=~/^utf8::/;
1879 0 0         next if $hash=~/^Carp::/;
1880 0 0         next if $hash=~/^fields::attr/;
1881 0 0         next if $hash=~/^Text::Balanced::/;
1882 0 0         next if $hash=~/^Data::Dump::Streamer/;
1883 0 0         next if $hash=~/^re::EXPORT_OK/;
1884 0 0         next if $hash=~/^fa_code::email_addresses/;
1885 0 0         next if $hash=~/^fa_code::email_defaults/;
1886 0 0         next if $hash=~/^PadWalker::/;
1887 0 0         next if $hash=~/^Fcntl::/;
1888 0 0         next if $hash=~/^B::Utils::/;
1889 0 0         next if $hash=~/^ExtUtils::/;
1890 0 0         next if $hash=~/^Exporter::/;
1891 0 0         next if $hash=~/^Moo::/;
1892 0 0         next if $hash=~/^overload::/;
1893 0 0         next if $hash=~/^Term::ReadKey::/;
1894 0 0         next if $hash=~/^main::INC/;
1895 0 0         next if $hash=~/^main::SIG/;
1896 0 0         next if $hash=~/^main::ENV/;
1897 0 0         next if $hash=~/^main[:][^\w]*$/;
1898 0 0         next if $hash=~/^main::[@]$/;
1899 0 0         next if $hash=~/^Net::FullAuto::FA_Core::makeplan/;
1900 0 0         next if $hash=~
1901             /^Net::FullAuto::FA_Core::admin_menus/;
1902 0           my %test=eval "%$hash";
1903 0 0         $name=$hash if %test eq %{$_[0]};
  0            
1904 0 0         last PK if $name;
1905             }
1906             }
1907 0   0       $name||='';
1908 0           $name=~s/^.*::(.*)$/$1/;
1909 0           last WH;
1910             }
1911 0 0         last WH if $name;
1912             }
1913             }
1914 0 0         last if $name;
1915             };
1916             }
1917 0   0       $name||='';
1918 0           $name=~s/^%//;
1919 0 0         return $name if $name;
1920             }
1921             }
1922            
1923             sub list_module {
1924 0     0 0   my @modules = @_;
1925 0           my @result=();
1926 1     1   12 no strict 'refs';
  1         2  
  1         99608  
1927 0           foreach my $module (@modules) {
1928 0           $module=~s/\.pm$//;
1929 0           push @result,grep { defined &{"$module\::$_"} } keys %{"$module\::"};
  0            
  0            
  0            
1930             }
1931 0           return @result;
1932             }
1933            
1934             sub test_hashref {
1935            
1936 0     0 0   my $hashref_to_test=$_[0];
1937 0 0         if (ref $hashref_to_test eq 'HASH') {
1938 0 0 0       if (grep { /Item_/ } keys %{$hashref_to_test}) {
  0 0 0        
  0 0          
1939 0           return 1;
1940             } elsif (exists $hashref_to_test->{Input} &&
1941             $hashref_to_test->{Input}) {
1942 0           return 1;
1943 0           } elsif (!grep { /Item_/ } keys %{$hashref_to_test}
1944             && grep { /Banner/ } keys %{$hashref_to_test}) {
1945 0           return 1;
1946             } else {
1947 0           my $die="\n FATAL ERROR! - Unable to verify Menu\n"
1948             ."\n This Error is usually the result of a Menu"
1949             ."\n block that does not contain properly"
1950             ."\n coded Item blocks or was not coded"
1951             ."\n ABOVE the parent Menu hash block"
1952             ."\n (Example: 1), or not coded with"
1953             ."\n GLOBAL scope (Example: 2).\n"
1954             ."\n Example 1:"
1955             ."\n my %Example_Menu=( \# ABOVE parent"
1956             ."\n \# Best Practice"
1957             ."\n Item_1 => {"
1958             ."\n Text => 'Item Text',"
1959             ."\n },"
1960             ."\n );"
1961             ."\n my %Parent_Menu=(\n"
1962             ."\n Item_1 => {"
1963             ."\n Text => 'Item Text',"
1964             ."\n Result => \%Example_Menu,"
1965             ."\n },"
1966             ."\n );\n"
1967             ."\n"
1968             ."\n Example 2:"
1969             ."\n my %Parent_Menu=(\n"
1970             ."\n Item_1 => {"
1971             ."\n Text => 'Item Text',"
1972             ."\n Result => \%Example_Menu,"
1973             ."\n },"
1974             ."\n );"
1975             ."\n our %Example_Menu=( \# GLOBAL scope"
1976             ."\n \# Note: 'our' pragma"
1977             ."\n Item_1 => {"
1978             ."\n Text => 'Item Text',"
1979             ."\n },"
1980             ."\n );\n"
1981             ."\n";
1982 0           die $die;
1983             }
1984 0           } else { return 0 }
1985            
1986             }
1987            
1988             sub transform_sicm
1989             {
1990            
1991             #print "TRANSFORM_SICM_CALLER=",caller,"\n";
1992             ## sicm - [s]elected [i]tems [c]urrent [m]enu
1993 0   0 0 0   my $text=$_[0]||'';
1994 0   0       my $numbor=$_[1]||-1;
1995 0   0       my $all_menu_items_array=$_[2]||'';
1996 0   0       my $picks=$_[3]||'';
1997 0   0       my $pn=$_[4]||'';
1998 0   0       my $return_from_child_menu=$_[5]||'';
1999 0   0       my $log_handle=$_[6]||'';
2000 0   0       my $current_menu_name=$_[7]||'';
2001 0           my $selected=[];my $replace='';
  0            
2002 0           my $expand_array_flag=0;
2003 0           my $sicm_regex=
2004             qr/\](!)?s(?:e+lected[-_]*)*i*(?:t+ems[-_]*)
2005             *c*(?:u+rrent[-_]*)*m*(?:e+nu[-_]*)*\[/xi;
2006 0           my $tsmi_regex=qr/\](!)?t(?:e+st[-_]*)*s*(?:e+lected[-_]*)
2007             *m*(?:e+nu[-_]*)*i*(?:t+ems[-_]*)*\[/xi;
2008 0 0 0       if ((-1
2009 0 0 0       unless ($text=~/^\s*\]\[\[\s*/s && $text=~/\s*\]\]\[\s*$/s) {
2010 0           my $die="\n FATAL ERROR! - The --RETURN-ARRAY-- Macro"
2011             ."\n Boundary indicators: '][[' and ']]['"
2012             ."\n are only supported at the beginning"
2013             ."\n and end of the return instructions."
2014             ."\n Nothing but white space should precede"
2015             ."\n the left indicator, nor extend beyond"
2016             ."\n the right indicator.\n"
2017             ."\n Your String:\n"
2018             ."\n $text\n"
2019             ."\n Remedy: Recreate your return instructions"
2020             ."\n to conform to this convention. Also"
2021             ."\n be sure to use the Macro delimiter"
2022             ."\n indicator ']|[' to denote return array"
2023             ."\n element separation boundaries."
2024             ."\n Example:\n"
2025             ."\n '][[ ]S[ ]|[ ]P[{Menu_One} ]|[ SomeString ]]['"
2026             ."\n";
2027 0 0 0       if (defined $log_handle &&
2028             -1
2029 0           print $log_handle $die;
2030 0           close($log_handle);
2031             }
2032             }
2033 0           $expand_array_flag=1;
2034             }
2035 0           my @pks=keys %{$picks};
  0            
2036 0 0 0       if (0<$#pks && !$return_from_child_menu) {
2037 0           foreach my $key (sort numerically keys %{$picks}) {
  0            
2038 0           push @{$selected},$all_menu_items_array->[$key-1];
  0            
2039             }
2040 0           $replace=&Data::Dump::Streamer::Dump($selected)->Out();
2041 0           $replace=~s/\$ARRAY\d*\s*=\s*//s;
2042 0           $replace=~s/\;\s*$//s;
2043 0 0         if ($expand_array_flag) {
2044 0           $replace='eval '.$replace;
2045             }
2046 0           $replace=~s/\'/\\\'/sg;
2047             } else {
2048 0 0         if (ref $pn eq 'HASH') {
    0          
2049 0   0       $pn->{$numbor}->[1]||=1; #COMEHERE
2050 0           $replace=$all_menu_items_array->[$pn->{$numbor}->[1]-1];
2051             } elsif ($pn) {
2052 0           $replace=$all_menu_items_array->[$pn];
2053             } else {
2054 0   0       $replace=$all_menu_items_array->[$numbor-1]||'';
2055             }
2056 0           $replace=~s/\'/\\\'/g;
2057 0           $replace=~s/\"/\\\"/g;
2058 0 0         $replace='"'.$replace.'"' unless
2059             $text=~/^&?(\w+)\s*[(]["'].*["'][)]\s*$/;
2060             }
2061 0           my $test_regx_flag=0;
2062 0           FE: foreach my $regx ($tsmi_regex,$sicm_regex) {
2063 0 0         last if $test_regx_flag;
2064 0           while ($text=~m/($regx(?:\\\{([^}]+)\})*)/sg) {
2065 0 0         $test_regx_flag=1 if -1
2066 0           my $esc_one=$1;
2067 0           my $bang=$2;
2068 0           my $menu=$3;
2069 0   0       $menu||='';
2070 0           $esc_one=~s/\[/\\\[/;$esc_one=~s/\]/\\\]/;
  0            
2071 0 0         $replace=~s/\s*//s if $text=~/[)]\s*$/s;
2072 0 0         if ($menu) {
2073 0 0         if (-1
2074 0           $text=~s/$esc_one/$replace/sg;
2075             } else {
2076 0           $test_regx_flag=0;
2077             }
2078 0           next;
2079             }
2080 0           $text=~s/$esc_one(?![{])/$replace/g;
2081             }
2082             }
2083 0           return $text;
2084            
2085             }
2086            
2087             sub transform_mboi
2088             {
2089            
2090             ## mboi - [m]enu [b]anner [o]output [i]tems
2091 0   0 0 0   my $text=$_[0]||'';
2092 0   0       my $input=$_[1]||{};
2093 0   0       my $MenuUnit_hash_ref=$_[2]||{};
2094 0   0       my $Conveyed=$_[3]||'';
2095 0   0       my $SaveMMap=$_[4]||'';
2096 0   0       my $picks_from_parent=$_[5]||'';
2097 0   0       my $log_handle=$_[6]||'';
2098 0           my $mboi_regex=qr/\](!)?o(?:u+tput[-_]*)*b*(?:a+nner[-_]*)
2099             *m*(?:e+nu[-_]*)*i*(?:t+ems[-_]*)*\[/xi;
2100 0           my $test_regx_flag=0;
2101 0           FE: foreach my $regx ($mboi_regex) {
2102 0 0         last if $test_regx_flag;
2103 0           while ($text=~m/($regx(?:\{[^}]+\})*)/sg) {
2104 0 0         $test_regx_flag=1 if -1
2105 0           my $esc_one=$1;my $bang=$2;
  0            
2106 0           my $length_of_macro=length $esc_one;
2107 0           $esc_one=~s/["]\s*[.]\s*["]//s;
2108 0           my $esc_two=$esc_one;
2109 0           $esc_two=~s/\]/\\\]/;$esc_two=~s/\[/\\\[/;
  0            
2110 0           $esc_one=~s/^\]/\[\]\]/;$esc_one=~s/^(.*?)\[\{/$1\[\[\]{/;
  0            
2111 0           $esc_one=~s/^(.*?[]])[{](.*)[}]$/$1\[\{\]$2\[\}\]/;
2112 0           $esc_one=~s/\\/\\\\/g;
2113 0           $esc_one=~s/[+]/\[+\]/g;$esc_one=~s/[*]/\[*\]/g;
  0            
2114 0           if (NEW_PERL) {
2115 0           $esc_one=~s/(?:(?:\d\s*,\s*"|"\s*,\s*\d)(*SKIP)(*FAIL)|")/\\\"/g;
2116 0           $esc_two=~s/(?:(?:\d\s*,\s*"|"\s*,\s*\d)(*SKIP)(*FAIL)|")/\\\"/g;
2117             } else {
2118             $esc_one=~s/(?
2119             $esc_one=~s/"(?!,\d)/\\\"/g;
2120             $esc_one=~s/\\"/"/g;
2121             $esc_two=~s/(?
2122             $esc_two=~s/"(?!,\d)/\\\"/g;
2123             $esc_two=~s/\\"/"/g;
2124             }
2125 0           $esc_one=~s/\$/\\\$/g;$esc_two=~s/\$/\\\$/g;
  0            
2126 0           if (NEW_PERL) {
2127 0           $esc_two=~s/(?:(?:\\[]]|\\[[]|\\["]|\\[\$])(*SKIP)(*FAIL)|\\)/\\\\/g;
2128             } else {
2129             $esc_two=~s/\\(?![[]|[]]|["]|[\$])/\\\\/g;
2130             }
2131 0           my $instructions=$esc_two;
2132 0           $instructions=~s/^\\[]][^[]+\\[[]\s*[{](.*?)[}]$/$1/;
2133 0           $instructions=~/^(.*?),(.*?)$/;
2134 0           my $input_macro=$1;my $code=$2;
  0            
2135 0           $code=~s/["']//g;
2136 0           $code="\$main::$code";
2137 0           my $input_text=$input->{$input_macro};
2138 0           $code=eval $code;
2139 0           my $cd=&Data::Dump::Streamer::Dump($code)->Out();
2140 0           $cd=&transform_pmsi($cd,
2141             $Conveyed,$SaveMMap,
2142             $picks_from_parent);
2143 0           $cd=~s/\$CODE\d*\s*=\s*//s;
2144 0           $code=eval $cd;
2145 0           my $output='';
2146 0 0         $output=$code->($input_text) if $input_text!~/^\s*$/;
2147 0           my $out_height=$output=~tr/\n//;
2148 0           my @output=split /\n/,$output;
2149 0           my @newtext=();
2150 0           foreach my $line (split "\n",$text) {
2151 0 0         if ($line=~/^(.*)$esc_one(.*)$/) {
2152 0           my $front_of_line=$1;my $back_of_line=$2;
  0            
2153 0           my $frlen=length $front_of_line;
2154 0   0       my $bottomline=pop @output||'';
2155 0           $bottomline=$front_of_line.$bottomline.$back_of_line;
2156 0           foreach my $ln (@output) {
2157 0           my $pad=sprintf "%-${frlen}s",'';
2158 0           push @newtext,$pad.$ln;
2159             }
2160 0           push @newtext,$bottomline;
2161             } else {
2162 0           push @newtext,$line;
2163             }
2164 0           } $text=join "\n",@newtext;
2165             }
2166             }
2167 0           return $text,$input;
2168            
2169             }
2170            
2171             sub transform_mbir
2172             {
2173            
2174             ## mbir - [m]enu [b]anner [i]nput [r]esults
2175 0   0 0 0   my $text=$_[0]||'';
2176 0   0       my $Conveyed=$_[1]||{};
2177 0   0       my $MenuUnit_hash_ref=$_[2]||'';
2178 0   0       my $log_handle=$_[3]||'';
2179 0           my $tbii_regex=qr/\](!)?i(?:n+put[-_]*)*b*(?:a+nner[-_]*)
2180             *m*(?:e+nu[-_]*)*i*(?:t+ems[-_]*)*\[/xi;
2181 0           my $test_regx_flag=0;
2182 0           FE: foreach my $regx ($tbii_regex) {
2183 0 0         last if $test_regx_flag;
2184 0           while ($text=~m/($regx(?:\{[^}]+\})*)/sg) {
2185 0 0         $test_regx_flag=1 if -1
2186 0           my $esc_one=$1;my $bang=$2;
  0            
2187 0           my $length_of_macro=length $esc_one;
2188 0           $esc_one=~s/["]\s*[.]\s*["]//s;
2189 0           $esc_one=~s/\]/\\\]/;$esc_one=~s/\[/\\\[/;
  0            
2190 0           if (NEW_PERL) {
2191 0           $esc_one=~s/(?:(?:\d\s*,\s*"|"\s*,\s*\d)(*SKIP)(*FAIL)|")/\\\"/g;
2192             } else {
2193             print "WHAT IS ESC_ONE=$esc_one<==\n";
2194             $esc_one=~s/(?
2195             $esc_one=~s/"(?!,\d)/\\\"/g;
2196             $esc_one=~s/\\"/"/g;
2197             }
2198 0           my $instructions=$esc_one;
2199 0           $instructions=~s/^\\[]][^[]+\\[[]\s*[{](.*?)[}]$/$1/;
2200 0           $instructions='('.$instructions.')';
2201 0           my @instructions=eval $instructions;
2202 0 0         next if $#instructions==2;
2203 0 0         if ($#instructions==1) {
2204 0 0         if (exists $Conveyed->{$instructions[0].'_mbir'}) {
2205 0           my $item=$instructions[0].'_mbir';
2206 0           my $replace=$Conveyed->{$item}->{$instructions[1]};
2207 0           $esc_one=~s/[{]/\\{/g;
2208 0           $text=~s/$esc_one/$replace/s;
2209             }
2210             }
2211             }
2212 0           } return $text;
2213             }
2214            
2215             sub transform_mbii
2216             {
2217            
2218             ## mbii - [m]enu [b]anner [i]nput [i]tems
2219 0   0 0 0   my $text=$_[0]||'';
2220 0 0         my $numbor=(defined $_[1])?$_[1]:'';
2221 0   0       my $ikey=$_[2]||'';
2222 0   0       my $input=$_[3]||{};
2223 0   0       my $MenuUnit_hash_ref=$_[4]||{};
2224 0   0       my $Conveyed=$_[5]||'';
2225 0   0       my $log_handle=$_[6]||'';
2226 0           my $tbii_regex=qr/\](!)?i(?:n+put[-_]*)*b*(?:a+nner[-_]*)
2227             *m*(?:e+nu[-_]*)*i*(?:t+ems[-_]*)*\[/xi;
2228 0           my $test_regx_flag=0;
2229 0 0 0       if ($ikey eq 'TAB' && exists $input->{focus}) {
2230 0           $input->{focus}->[0]=$input->{focus}->[2]->{$input->{focus}->[0]};
2231 0           $ikey='';$numbor='';
  0            
2232             }
2233            
2234 0           FE: foreach my $regx ($tbii_regex) {
2235 0 0         last if $test_regx_flag;
2236 0           my $fill_focus=0;
2237 0 0         $fill_focus=1 unless exists $input->{focus};
2238 0           while ($text=~m/($regx(?:\{[^}]+\})*)/sg) {
2239 0 0         $test_regx_flag=1 if -1
2240 0           my $esc_one=$1;my $bang=$2;
  0            
2241 0           my $length_of_macro=length $esc_one;
2242            
2243 0           $esc_one=~s/["]\s*[.]\s*["]//s;
2244 0           my $esc_two=$esc_one;
2245 0           $esc_two=~s/\]/\\\]/;$esc_two=~s/\[/\\\[/;
  0            
2246 0           $esc_one=~s/^\]/\[\]\]/;$esc_one=~s/^(.*?)\[\{/$1\[\[\]{/;
  0            
2247 0           $esc_one=~s/^(.*?[]])[{](.*)[}]$/$1\[\{\]$2\[\}\]/;
2248 0           $esc_one=~s/\\/\\\\/g;
2249 0           $esc_one=~s/[+]/\[+\]/g;$esc_one=~s/[*]/\[*\]/g;
  0            
2250 0           if (NEW_PERL) {
2251 0           $esc_one=~s/(?:(?:\d\s*,\s*"|"\s*,\s*\d)(*SKIP)(*FAIL)|")/\\\"/g;
2252 0           $esc_two=~s/(?:(?:\d\s*,\s*"|"\s*,\s*\d)(*SKIP)(*FAIL)|")/\\\"/g;
2253             } else {
2254             $esc_one=~s/(?
2255             $esc_one=~s/"(?!,\d)/\\\"/g;
2256             $esc_one=~s/\\"/"/g;
2257             $esc_two=~s/(?
2258             $esc_two=~s/"(?!,\d)/\\\"/g;
2259             $esc_two=~s/\\"/"/g;
2260             }
2261 0           $esc_one=~s/\$/\\\$/g;$esc_two=~s/\$/\\\$/g;
  0            
2262 0           if (NEW_PERL) {
2263 0           $esc_two=~s/(?:(?:\\[]]|\\[[]|\\["]|\\[\$])(*SKIP)(*FAIL)|\\)/\\\\/g;
2264             } else {
2265             $esc_two=~s/\\(?![[]|[]]|["]|[\$])/\\\\/g;
2266             }
2267 0           my $instructions=$esc_two;
2268 0           $instructions=~s/^\\[]][^[]+\\[[]\s*[{](.*?)[}]$/$1/;
2269 0           $instructions='('.$instructions.')';
2270 0           my @instructions=eval $instructions;
2271 0 0         unless (exists $input->{$instructions[0]}) {
2272 0           $input->{$instructions[0]}=$instructions[1];
2273 0           $numbor='';
2274             }
2275             $input->{$instructions[0]}='' unless defined
2276 0 0         $input->{$instructions[0]};
2277 0 0         if ($fill_focus) {
2278 0 0         unless (exists $input->{focus}) {
2279 0           my $default_focus=$instructions[0];
2280 0 0 0       if (exists $MenuUnit_hash_ref->{Focus} &&
2281             $MenuUnit_hash_ref->{Focus}) {
2282 0           $default_focus=$MenuUnit_hash_ref->{Focus};
2283             }
2284 0           $input->{focus}=[$default_focus,[$instructions[0]],{}];
2285             } else {
2286             $input->{focus}->[2]->{
2287 0           $input->{focus}->[1][$#{$input->{focus}->[1]}]}
  0            
2288             =$instructions[0];
2289 0           push @{$input->{focus}->[1]},$instructions[0];
  0            
2290             $input->{focus}->[2]->{$instructions[0]}=
2291 0           $input->{focus}->[1]->[0];
2292             }
2293             }
2294 0           my @newtext=();
2295 0           foreach my $line (split "\n",$text) {
2296 0 0         if ($line=~/^(.*)$esc_one(.*)$/) {
2297 0           my $front_of_line=$1;my $back_of_line=$2;
  0            
2298 0           my $box_top_bottom='';my @sides=('| ',' |');
  0            
2299 0 0 0       if ($#instructions==2 and $instructions[2]>0) {
2300 0 0         if ($input->{focus}->[0] eq $instructions[0]) {
2301 0           for (1..$instructions[2]) {
2302 0           $box_top_bottom.='=';
2303             }
2304 0           @sides=('[ ',' ]');
2305             } else {
2306 0           for (1..$instructions[2]) {
2307 0           $box_top_bottom.='-';
2308             }
2309             }
2310             }
2311 0 0         if ($input->{focus}->[0] eq $instructions[0]) {
2312 0 0 0       if ($ikey eq 'BACKSPACE') {
    0          
    0          
2313 0           chop $input->{$instructions[0]};
2314             } elsif ($ikey eq 'DELETE') {
2315 0           $input->{$instructions[0]}='';
2316             } elsif ($ikey ne 'TAB' && defined $numbor) {
2317 0           my $length_input=length $input->{$instructions[0]};
2318 0           my $length_box=$instructions[2];
2319 0 0         if ($length_input>$length_box) {
2320 0           print "\n\n WARNING! - input exceeds box size!";
2321 0           print "\n\n You may have forgotten to [TAB] to the".
2322             "\n next box, or the input for the next box".
2323             "\n box has a TAB in it - usually at the".
2324             "\n front of the string. Use a text editor".
2325             "\n to see and remove it before pasting".
2326             "\n input.";
2327 0           print "\n\n Press to continue ...\n\n";
2328 0           sleep 1;
2329 0           ;
2330             }
2331 0           $input->{$instructions[0]}.=$numbor;
2332             }
2333             }
2334 0           my $insert=$sides[0];
2335 0           $insert.=$input->{$instructions[0]};
2336             $Conveyed->{&pw($MenuUnit_hash_ref).'_mbir'}->
2337 0           {$instructions[0]}=$input->{$instructions[0]};
2338 0           my $insert_num_of_spaces=$instructions[2]-2;
2339 0           $insert=sprintf "%-${insert_num_of_spaces}s",$insert;
2340 0           $insert.=$sides[1];
2341 0           my $frlen=length $front_of_line;
2342 0           my $box_top_line='';
2343 0           my $box_mid_line='';
2344 0           my $box_bot_line='';
2345 0           my $length_of_front_and_macro=$frlen+$instructions[2]+2;
2346 0 0 0       if ($#newtext==-1 || $#newtext==0) {
2347 0           $box_top_line=sprintf "%-${frlen}s",'';
2348 0           $box_top_line=~s/^.(.*).$/.$1./;
2349 0           $box_top_line.=$box_top_bottom;
2350             } else {
2351 0           my $front_of_box_top=unpack("a$frlen",$newtext[$#newtext-1]);
2352 0 0         $front_of_box_top=sprintf "%-${frlen}s",$front_of_box_top
2353             if length $front_of_box_top<$frlen;
2354 0           my $back_of_box_top='';
2355 0 0         if ($length_of_front_and_macro<=length
2356             $newtext[$#newtext-1]) {
2357 0           $back_of_box_top=unpack("x$length_of_front_and_macro a*",
2358             $newtext[$#newtext-1]);
2359             }
2360 0           $box_top_bottom=~s/^.(.*).$/.$1./;
2361 0           $box_top_line=$front_of_box_top.
2362             $box_top_bottom.$back_of_box_top;
2363             }
2364 0 0         if ($#newtext==-1) {
2365 0           $box_mid_line=sprintf "%-${frlen}s",'';
2366 0           $box_mid_line.=$insert;
2367             } else {
2368 0 0         my $elem=($#newtext==0)?0:$#newtext;
2369 0           my $front_of_box_mid=sprintf "%-${frlen}s",'';
2370 0 0         if ($newtext[$elem]!~/^\s*$/) {
2371 0           $front_of_box_mid=unpack("a$frlen",$newtext[$elem]);
2372 0 0         $front_of_box_mid=sprintf "%-${frlen}s",$front_of_box_mid
2373             if length $front_of_box_mid<$frlen;
2374             }
2375 0           my $back_of_box_mid='';
2376 0 0         if ($length_of_front_and_macro<=length $newtext[$elem]) {
2377 0           $back_of_box_mid=unpack("x$length_of_front_and_macro a*",
2378             $newtext[$elem]);
2379             }
2380 0           $box_mid_line=$front_of_box_mid.
2381             $insert.$back_of_box_mid;
2382             }
2383 0           $box_top_bottom=~s/^.(.*).$/'$1'/;
2384 0           $box_bot_line=$front_of_line.$box_top_bottom.$back_of_line;
2385 0 0         if ($#newtext==-1) {
    0          
2386 0           push @newtext,$box_top_line;
2387 0           push @newtext,$box_mid_line;
2388             } elsif ($#newtext==0) {
2389 0           unshift @newtext,$box_top_line;
2390 0           $newtext[1]=$box_mid_line;
2391             } else {
2392 0           $newtext[$#newtext-1]=$box_top_line;
2393 0           $newtext[$#newtext]=$box_mid_line;
2394 0           } push @newtext, $box_bot_line;
2395             } else {
2396 0           push @newtext,$line;
2397             }
2398 0           } $text=join "\n",@newtext;
2399             }
2400 0           } return $text, $input;
2401             }
2402            
2403             sub transform_pmsi
2404             {
2405            
2406             #print "TRANSFORM_PMSI CALLER=",caller,"\n";
2407             ## pmsi - [p]revious [m]enu [s]elected [i]tems
2408 0   0 0 0   my $text=$_[0]||'';
2409 0   0       my $Conveyed=$_[1]||'';
2410 0   0       my $SaveMMap=$_[2]||'';
2411 0   0       my $picks_from_parent=$_[3]||'';
2412 0   0       my $log_handle=$_[4]||'';
2413 0           my $expand_array_flag=0;
2414 0           my $tpmi_regex=qr/\](!)?t(?:e+st[-_]*)*p*(?:r+vious[-_]*)
2415             *m*(?:e+nu[-_]*)*i*(?:t+ems[-_]*)*\[/xi;
2416 0           my $pmsi_regex=qr/\](!)?p(?:r+evious[-_]*)*m*(?:e+nu[-_]*)
2417             *s*(?:e+lected[-_]*)*i*(?:t+ems[-_]*)*\[/xi;
2418 0           my $amlm_regex=qr/\]a(n+cestor[-_]*)*m*(e+nu[-_]*)
2419             *l*(a+bel[-_]*)*m*(a+p[-_]*)*\[/xi;
2420 0           $text=~s/\s?$//s;
2421 0 0 0       if ((-1
2422 0 0 0       unless ($text=~/^\s*\]\[\[\s*/s && $text=~/\s*\]\]\[\s*$/s) {
2423 0           my $die=<
2424            
2425             FATAL ERROR! - The --RETURN-ARRAY-- Macro
2426             Boundary indicators: '][[' and ']]['
2427             are only supported at the beginning
2428             and end of the return instructions.
2429             Nothing but white space should precede
2430             the left indicator, nor extend beyond
2431             the right indicator.
2432             Your String:
2433             $text
2434             Remedy: Recreate your return instructions
2435             to conform to this convention. Also
2436             be sure to use the Macro delimiter
2437             indicator ']|[' to denote return array
2438             element separation boundaries.
2439             Example:
2440             '][[ ]S[ ]|[ ]P[{Menu_One} ]|[ SomeString ]]['
2441             DIE
2442 0 0 0       if (defined $log_handle &&
2443             -1
2444 0           print $log_handle $die;
2445 0           close($log_handle);
2446             }
2447             }
2448 0           $expand_array_flag=1;
2449             }
2450 0           my $test_regx_flag=0;
2451 0           FE: foreach my $regx ($tpmi_regex,$pmsi_regex) {
2452 0 0         last if $test_regx_flag;
2453 0           while ($text=~m/($regx(?:\{[^}]+\})*)/sg) {
2454 0 0         $test_regx_flag=1 if -1
2455 0           my $esc_one=$1;my $bang=$2;
  0            
2456 0           $esc_one=~s/["]\s*[.]\s*["]//s;
2457 0           $esc_one=~s/\]/\\\]/;$esc_one=~s/\[/\\\[/;
  0            
2458 0           $esc_one=~s/[{]/\\\{\(/;$esc_one=~s/\}/\)\}/;
  0            
2459 0   0       while ($esc_one=~/[{]/ && $text=~m/$esc_one/) {
2460 0 0 0       unless (exists $Conveyed->{$1} || $bang || $test_regx_flag) {
      0        
2461 0           my $die="\n\n FATAL ERROR! - The Menu Name: \"$1\""
2462             ."\n describes a Menu that is *NOT* in the"
2463             ."\n invocation history of this process.\n"
2464             ."\n This Error is *usually* the result of a missing,"
2465             ."\n Menu, a Menu block that was not global or"
2466             ."\n was not coded ABOVE the parent Menu hash"
2467             ."\n block. (See Example)\n"
2468             ."\n Also be sure to use a UNIQUE name for every"
2469             ."\n Menu.\n"
2470             ."\n Example: my %Example_Menu=(\n"
2471             ."\n Item_1 => {"
2472             ."\n ... # ]P[ is a Macro 'Previous'"
2473             ."\n Result => sub { return ']P[{Parent_Menu}' },"
2474             ."\n );"
2475             ."\n my %Parent_Menu=(\n"
2476             ."\n Item_1 => {"
2477             ."\n ..."
2478             ."\n Result => \\%Example_Menu,"
2479             ."\n ..."
2480             ."\n );\n"
2481             ."\n *HOWEVER*: Read the Documentation on \"stepchild\""
2482             ."\n and other deeply nested menus. There are"
2483             ."\n scenarios with dynamically generated menus"
2484             ."\n where Term::Menus simply cannot test for"
2485             ."\n menu stack integrity when it encounters"
2486             ."\n unexpanded macros in defined but ungenerated"
2487             ."\n menus. In these situations this error"
2488             ."\n message should be turned off by using the"
2489             ."\n \"test\" macro ( ]T[ ) or using an"
2490             ."\n exclamation point character with either"
2491             ."\n or both the ]S[ (becomes ]!S[) and ]P["
2492             ."\n (becomes ]!P[) macros.\n\n";
2493 0 0 0       if (defined $log_handle &&
2494             -1
2495 0           print $log_handle $die;
2496 0           close($log_handle);
2497             }
2498 0 0         if ($Term::Menus::fullauto) {
2499 0           &Net::FullAuto::FA_Core::handle_error($die);
2500 0           } else { die $die }
2501             }
2502 0 0         unless ($Conveyed->{$1}) {
2503 0           $test_regx_flag=0;
2504             next FE
2505 0           }
2506 0           my $replace=$Conveyed->{$1};
2507 0 0         if (ref $replace) {
2508 0           $replace=&Data::Dump::Streamer::Dump($Conveyed->{$1})->Out();
2509 0           my $type=ref $Conveyed->{$1};
2510 0           $replace=~s/\$$type\d*\s*=\s*//s;
2511 0           $replace=~s/\'/\\\'/sg;
2512 0 0         if ($expand_array_flag) {
2513 0           $replace='eval '.$replace;
2514             }
2515             }
2516 0 0 0       if ($text=~/^&?(?:.*::)*(\w+)\s*[(]?.*[)]?\s*$/ &&
2517 0           grep { $1 eq $_ } list_module('main',$Term::Menus::fa_code)) {
2518 0           $replace=~s/\'/\\\'/g;
2519 0           $replace=~s/\"/\\\"/g;
2520 0 0         $replace='"'.$replace.'"' unless
2521             $text=~/^&?(\w+)\s*[(]["'].*["'][)]\s*$/;
2522             }
2523 0 0 0       if ($replace=~/^.(?
2524 0 0 0       $replace='"'.$replace.'"' if
2525             $text!~/^&?(\w+)\s*[(]["'].*["'][)]\s*$/ &&
2526             $replace!~/^eval /;
2527             }
2528 0           $text=~s/$esc_one/$replace/se;
  0            
2529             }
2530 0           my $replace='';
2531 0 0         if (ref $picks_from_parent eq 'ARRAY') {
2532 0           $replace=&Data::Dump::Streamer::Dump($picks_from_parent)->Out();
2533 0           my $type=ref $picks_from_parent;
2534 0           $replace=~s/\$$type\d*\s*=\s*//s;
2535 0           $replace=~s/\'/\\\'/sg;
2536 0 0 0       if ($expand_array_flag) {
    0          
2537 0           $replace='eval '.$replace;
2538             } elsif ($replace=~/^.(?
2539 0 0         $replace='"'.$replace.'"' unless
2540             $text=~/^&?(\w+)\s*[(]["'].*["'][)]\s*$/;
2541             }
2542             } else {
2543 0           $replace=$picks_from_parent;
2544 0 0 0       if ($replace=~/^.(?
2545 0 0         $replace='"'.$replace.'"' unless
2546             $text=~/^&?(\w+)\s*[(]["'].*["'][)]\s*$/;
2547             }
2548            
2549             }
2550 0 0 0       if ($text=~/^&?(?:.*::)*(\w+)\s*[(]?.*[)]?\s*$/ &&
2551 0           grep { $1 eq $_ } list_module('main',$Term::Menus::fa_code)) {
2552 0           $replace=~s/\'/\\\'/g;
2553 0           $replace=~s/\"/\\\"/g;
2554 0 0 0       $replace='"'.$replace.'"' if
2555             $text!~/^&?(?:.*::)*(\w+)\s*[(]["'].*["'][)]\s*$/ &&
2556             $replace!~/^eval /;
2557             }
2558 0           $text=~s/$esc_one/$replace/s;
2559             }
2560             }
2561 0           while ($text=~m/($amlm_regex(?:\{[^}]+\})*)/sg) {
2562 0           my $esc_one=$1;
2563 0 0         last unless $esc_one;
2564 0           $esc_one=~s/\]/\\\]/;$esc_one=~s/\[/\\\[/;
  0            
2565 0           $esc_one=~s/\{/\{\(/;$esc_one=~s/\}/\)\}/;
  0            
2566 0           my $replace=$Conveyed->{$1};
2567 0 0         if (ref $replace) {
2568 0           $replace=&Data::Dump::Streamer::Dump($Conveyed->{$1})->Out();
2569 0           my $type=ref $Conveyed->{$1};
2570 0           $replace=~s/\$$type\d*\s*=\s*//s;
2571 0           $replace=~s/\'/\\\'/sg;
2572 0 0         if ($expand_array_flag) {
2573 0           $replace='eval '.$replace;
2574             }
2575             }
2576 0           $text=~s/$esc_one/$replace/se;
  0            
2577 0           } return $text;
2578            
2579             }
2580            
2581             sub pick # USAGE: &pick( ref_to_choices_array,
2582             # (Optional) banner_string,
2583             # (Optional) display_this_many_items,
2584             # (Optional) return_index_only_flag,
2585             # (Optional) log_file_handle,
2586             # ----------
2587             # For Use With Sub-Menus
2588             # ----------
2589             # (Optional) MenuUnit_hash_ref,
2590             # (Optional) recurse_level,
2591             # (Optional) picks_from_parent,
2592             # (Optional) parent_menu,
2593             # (Optional) menus_cfg_file,
2594             # (Optional) Full_Menu_data_structure,
2595             # (Optional) Selected_data_structure,
2596             # (Optional) Conveyed_data_structure,
2597             # (Optional) SavePick_data_structure,
2598             # (Optional) SaveMMap_data_structure,
2599             # (Optional) SaveNext_data_structure,
2600             # (Optional) Persists_data_structure,
2601             # (Optional) no_wantarray_flag,
2602             # (Optional) sorted
2603             # (Optional) select_many )
2604             {
2605            
2606             #print "PICKCALLER=",caller," and Argument 7 =>$_[6]<=\n";;
2607            
2608             # "pick" --> This function presents the user with
2609             # with a list of items from which to choose.
2610            
2611 0     0 1   my @all_menu_items_array=@{$_[0]};
  0            
2612 0 0         my $banner=defined $_[1] ? $_[1] : "\n Please Pick an Item :";
2613 0 0         my $display_this_many_items=defined $_[2] ? $_[2] : 10;
2614 0 0         my $return_index_only_flag=(defined $_[3]) ? 1 : 0;
2615 0 0         my $log_handle= (defined $_[4]) ? $_[4] : '';
2616            
2617             # Used Only With Cascasding Menus (Optional)
2618 0 0         my $MenuUnit_hash_ref= (defined $_[5]) ? $_[5] : {};
2619 0           my $show_banner_only=0;
2620 0 0         unless (grep { /Item_/ } keys %{$MenuUnit_hash_ref}) {
  0            
  0            
2621 0 0         if (grep { /Banner/ } keys %{$MenuUnit_hash_ref}) {
  0            
  0            
2622 0           $show_banner_only=1;
2623             }
2624             }
2625 0   0       $MenuUnit_hash_ref->{Select}||={};
2626 0 0         my $recurse_level= (defined $_[6]) ? $_[6] : 1;
2627 0 0         my $picks_from_parent= (defined $_[7]) ? $_[7] : '';
2628 0 0         my $parent_menu= (defined $_[8]) ? $_[8] : '';
2629 0 0         my $FullMenu= (defined $_[9]) ? $_[9] : {};
2630 0 0         my $Selected= (defined $_[10]) ? $_[10] : {};
2631 0 0         my $Conveyed= (defined $_[11]) ? $_[11] : {};
2632 0 0         my $SavePick= (defined $_[12]) ? $_[12] : {};
2633 0 0         my $SaveMMap= (defined $_[13]) ? $_[13] : {};
2634 0 0         my $SaveNext= (defined $_[14]) ? $_[14] : {};
2635 0 0         my $Persists= (defined $_[15]) ? $_[15] : {};
2636 0 0         my $no_wantarray= (defined $_[16]) ? $_[16] : 0;
2637 0 0         my $sorted= (defined $_[17]) ? $_[17] : 0;
2638 0 0         my $select_many= (defined $_[18]) ? $_[18] : 0;
2639            
2640 0           my %items=();my %picks=();my %negate=();
  0            
  0            
2641 0           my %exclude=();my %include=();my %default=();
  0            
  0            
2642 0           my %labels=();
2643 0           foreach my $menuhash (keys %{$FullMenu}) {
  0            
2644 0           my $name=&pw($FullMenu->{$menuhash}[0]);
2645 0 0         if ($name) {
2646 0           $FullMenu->{$menuhash}[0]->{Name}=$name;
2647 0           } else { next }
2648 0           $labels{$name}=$FullMenu->{$menuhash}[0];
2649             }
2650 0 0 0       if ($SavePick && exists $SavePick->{$MenuUnit_hash_ref}) {
2651 0           %picks=%{$SavePick->{$MenuUnit_hash_ref}};
  0            
2652             }
2653 0           my $num_pick=$#all_menu_items_array+1;
2654 0   0       my $caller=(caller(1))[3]||'';
2655 0           my $numbor=0; # Number of Item Selected
2656 0           my $ikey=''; # rawInput Key - key used
2657             # to end menu. Can be
2658             # any non-alphanumeric
2659             # key like Enter or
2660             # Right Arrow.
2661 0           my $return_from_child_menu=0;
2662            
2663 0           my $choose_num='';
2664 0           my $convey='';
2665 0           my $menu_output='';
2666 0           my $hidedefaults=0;
2667             my $start=($FullMenu->{$MenuUnit_hash_ref}[11])?
2668 0 0         $FullMenu->{$MenuUnit_hash_ref}[11]:0;
2669 0           my $got_default=0;
2670            
2671             sub delete_Selected
2672             {
2673            
2674 0     0 0   my $Selected=$_[2];
2675 0           my $SavePick=$_[3];
2676 0           my $SaveNext=$_[4];
2677 0           my $Persists=$_[5];
2678 0 0         if ($_[1]) {
2679 0           my $result=$Selected->{$_[0]}{$_[1]};
2680 0           delete $Selected->{$_[0]}{$_[1]};
2681 0           delete $SavePick->{$_[0]}{$_[1]};
2682 0 0         if ($result) {
2683 0           &delete_Selected($result,'',
2684             $Selected,$SavePick,$SaveNext);
2685 0           } delete $SaveNext->{$_[0]};
2686             } else {
2687 0 0         if (keys %{$Selected->{$_[0]}}) {
  0            
2688 0           foreach my $key (keys %{$Selected->{$_[0]}}) {
  0            
2689 0           delete $Selected->{$_[0]}{$key};
2690 0           delete $SavePick->{$_[0]}{$key};
2691 0           delete $SaveNext->{$_[0]};
2692             }
2693             } else {
2694 0           foreach my $key (keys %{$SavePick->{$_[0]}}) {
  0            
2695 0           delete $SavePick->{$_[0]}{$key};
2696 0           delete $SaveNext->{$_[0]};
2697             }
2698             }
2699 0           } delete $SaveNext->{$_[0]};
2700 0           return $SaveNext;
2701            
2702             }
2703            
2704             sub find_Selected
2705             {
2706 0     0 0   my $Selected=$_[2];
2707 0 0         if ($_[1]) {
2708 0           my $result=$Selected->{$_[0]}{$_[1]};
2709 0 0 0       if ($result=~/^&?(?:.*::)*(\w+)\s*[(]?.*[)]?\s*$/ &&
2710 0           grep { $1 eq $_ } list_module('main',$Term::Menus::fa_code)) {
2711 0           return 0;
2712             } else {
2713 0           return &find_Selected($result,'',$Selected);
2714             }
2715             } else {
2716 0 0         if (keys %{$Selected->{$_[0]}}) {
  0            
2717 0           foreach my $key (keys %{$Selected->{$_[0]}}) {
  0            
2718 0           my $result=$Selected->{$_[0]}{$key};
2719             #return '+' if substr($result,0,1) eq '&';
2720 0 0 0       if ($result=~/^&?(?:.*::)*(\w+)\s*[(]?.*[)]?\s*$/ &&
2721 0           grep { $1 eq $_ } list_module('main',$Term::Menus::fa_code)) {
2722 0           return '+';
2723             }
2724 0           my $output=&find_Selected($result,'',$Selected);
2725 0 0         return '+' if $output eq '+';
2726             }
2727             }
2728             }
2729             }
2730            
2731             sub get_subs_from_menu
2732             {
2733 0     0 0   my $Selected=$_[0];
2734 0           my @subs=();
2735 0           foreach my $key (keys %{$Selected}) {
  0            
2736 0           foreach my $item (keys %{$Selected->{$key}}) {
  0            
2737 0           my $seltext=$Selected->{$key}{$item};
2738 0 0 0       if ($seltext=~/^&?(?:.*::)*(\w+)\s*[(]?.*[)]?\s*$/ &&
    0          
2739 0           grep { $1 eq $_ } list_module('main',$Term::Menus::fa_code)) {
2740 0           push @subs, escape_quotes($seltext);
2741             } elsif (ref $seltext eq 'CODE') {
2742 0           push @subs, $seltext;
2743             }
2744             }
2745             }
2746 0           return @subs;
2747             }
2748            
2749             my $get_result = sub {
2750            
2751             # $_[0] => $MenuUnit_hash_ref
2752             # $_[1] => \@all_menu_items_array
2753             # $_[2] => $picks
2754             # $_[3] => $picks_from_parent
2755            
2756 0     0     my $convey=[];
2757 0           my $FullMenu=$_[4];
2758 0           my $Conveyed=$_[5];
2759 0           my $Selected=$_[6];
2760 0           my $SaveNext=$_[7];
2761 0           my $Persists=$_[8];
2762 0           my $parent_menu=$_[9];
2763 0   0       my $pick=(keys %{$_[2]})[0] || 1;
2764 0   0       $_[1]->[$pick-1]||='';
2765             my $gotmany=(exists $MenuUnit_hash_ref->{Select} &&
2766 0 0 0       $MenuUnit_hash_ref->{Select}) ? 1 : 0;
2767 0 0         $FullMenu->{$_[0]}[3]={} unless $gotmany;
2768 0 0 0       if ($pick && exists $FullMenu->{$_[0]}[3]{$_[1]->[$pick-1]}) {
    0          
    0          
2769 0 0 0       if ($pick && exists $_[0]->{$FullMenu->{$_[0]}
2770             [4]{$_[1]->[$pick-1]}}{Convey}) {
2771 0           my $contmp='';
2772 0 0         if (0<$#{[keys %{$_[2]}]}) {
  0            
  0            
2773 0           foreach my $numb (sort numerically keys %{$_[2]}) {
  0            
2774 0           $contmp=${${$FullMenu}{$_[0]}[3]}
  0            
2775 0           {${$_[1]}[$numb-1]}[0];
  0            
2776 0           $contmp=~s/\s?$//s;
2777 0           push @{$convey}, $contmp;
  0            
2778             }
2779             } else {
2780 0           $convey=${${${$FullMenu}{$_[0]}[3]}{${$_[1]}[$pick-1]}}[0];
  0            
  0            
  0            
  0            
2781             #$convey=$FullMenu->{$_[0]}[3]->{$_[1]->[$pick-1]}->[0];
2782 0           $convey=~s/\s?$//s;
2783             }
2784 0 0         $convey='SKIP' if $convey eq '';
2785 0 0 0       if (ref $convey eq 'ARRAY' && $#{$convey}==0) {
  0            
2786 0           $convey=$convey->[0];
2787             }
2788             }
2789 0           $Conveyed->{&pw($_[0])}=$convey;
2790             } elsif ($pick) {
2791 0           $convey=${$_[1]}[$pick-1];
  0            
2792 0           $Conveyed->{&pw($_[0])}=$convey;
2793             } elsif ($_[3]) {
2794 0           $convey=$_[3];
2795 0           $Conveyed->{&pw($_[0])}=$convey;
2796             }
2797             $convey='' if !$convey ||
2798 0 0 0       (ref $convey eq 'ARRAY' && $#{$convey}==-1);
  0   0        
2799 0           my $test_item='';my $show_banner_only=0;
  0            
2800 0 0         if (exists $FullMenu->{$_[0]}[2]{'__FA_Banner__'}) {
    0          
2801 0           $test_item=$FullMenu->{$_[0]}[2]{'__FA_Banner__'};
2802 0           $show_banner_only=1;$pick=0;
  0            
2803             } elsif ($pick) {
2804 0           $test_item=$FullMenu->{$_[0]}[2]{$_[1]->[$pick-1]};
2805             }
2806 0   0       $test_item||='';
2807 0 0 0       if (($pick &&
      0        
      0        
      0        
2808             exists $FullMenu->{$_[0]}[2]{$_[1]->[$pick-1]} &&
2809             (ref $test_item eq 'HASH' &&
2810 0           (values %{$test_item})[0] ne 'recurse')) ||
2811             ref $test_item eq 'CODE') {
2812 0 0 0       if ((ref $test_item eq 'HASH' &&
      0        
      0        
      0        
      0        
      0        
2813             ((grep { /Item_/ } keys %{$test_item}) ||
2814             ($show_banner_only && (grep { /Banner/ }
2815             keys %{$test_item}))))
2816             || ($test_item=~/^&?(?:.*::)*(\w+)\s*[(]?.*[)]?\s*$/
2817 0           && grep { $1 eq $_ } list_module(
2818             'main',$Term::Menus::fa_code))
2819             || ref $test_item eq 'CODE' ||
2820             &test_hashref($test_item)) {
2821 0           my $con_regex=qr/\]c(o+nvey)*\[/i;
2822 0           my $tpmi_regex=qr/\](!)?t(?:e+st[-_]*)*p*(?:r+vious[-_]*)
2823             *m*(?:e+nu[-_]*)*i*(?:t+ems[-_]*)*\[/xi;
2824 0           my $sicm_regex=
2825             qr/\]s(e+lected[-_]*)*i*(t+ems[-_]*)
2826             *c*(u+rrent[-_]*)*m*(e+nu[-_]*)*\[/xi;
2827 0           my $pmsi_regex=qr/\](!)?p(?:r+evious[-_]*)*m*(?:e+nu[-_]*)
2828             *s*(?:e+lected[-_]*)*i*(?:t+ems[-_]*)*\[/xi;
2829 0           my $amlm_regex=qr/\]a(n+cestor[-_]*)*m*(e+nu[-_]*)
2830             *l*(a+bel[-_]*)*m*(a+p[-_]*)*\[/xi;
2831 0           my $tbii_regex=qr/\](!)?i(?:n+put[-_]*)*b*(?:a+nner[-_]*)
2832             *m*(?:e+nu[-_]*)*i*(?:t+ems[-_]*)*\[/xi;
2833 0 0         if ($test_item=~/$con_regex|$pmsi_regex|
    0          
2834             $amlm_regex|$sicm_regex|$tpmi_regex|$tbii_regex/x) {
2835 0           $test_item=&transform_mbii($test_item,
2836             $Conveyed,$SaveMMap,
2837             $picks_from_parent,$log_handle);
2838             $test_item=&transform_sicm($test_item,$numbor,
2839             \@all_menu_items_array,$_[2],'',
2840             $return_from_child_menu,$log_handle,
2841 0           $_[0]->{Name});
2842 0           $test_item=&transform_pmsi($test_item,
2843             $Conveyed,$SaveMMap,
2844             $picks_from_parent,$log_handle);
2845 0           $test_item=&transform_mbir($test_item,
2846             $Conveyed,$MenuUnit_hash_ref,$log_handle);
2847             } elsif (ref $test_item eq 'CODE') {
2848 0           my $cd='';
2849             #if ($Term::Menus::data_dump_streamer && (!$show_banner_only
2850             # || (exists $MenuUnit_hash_ref->{Input}
2851             # && $MenuUnit_hash_ref->{Input}==1))) {
2852 0           $cd=&Data::Dump::Streamer::Dump($test_item)->Out();
2853             $cd=&transform_sicm($cd,$numbor,
2854             \@all_menu_items_array,$_[2],'',
2855             $return_from_child_menu,$log_handle,
2856 0           $_[0]->{Name});
2857 0           $cd=&transform_pmsi($cd,
2858             $Conveyed,$SaveMMap,
2859             $picks_from_parent);
2860 0           $cd=&transform_mbir($cd,$Conveyed,$MenuUnit_hash_ref,
2861             $log_handle);
2862             #}
2863 0           $cd=~s/\$CODE\d*\s*=\s*//s;
2864             #print "CD2=$cd<==\n";;
2865 0           eval { $test_item=eval $cd };
  0            
2866 0 0         if ($@) {
2867 0 0         if (unpack('a11',$@) eq 'FATAL ERROR') {
2868 0 0 0       if (defined $log_handle &&
2869             -1
2870 0           print $log_handle $@;
2871 0           close($log_handle);
2872             }
2873 0           die $@;
2874             } else {
2875 0           my $die="\n FATAL ERROR! - The Local "
2876             ."System $Term::Menus::local_hostname Conveyed\n"
2877             ." the Following "
2878             ."Unrecoverable Error Condition :\n\n"
2879             ." $@\n line ".__LINE__;
2880 0 0 0       if (defined $log_handle &&
2881             -1
2882 0           print $log_handle $die;
2883 0           close($log_handle);
2884             }
2885 0 0 0       if ($parent_menu && wantarray && !$no_wantarray) {
    0 0        
2886 0           return $FullMenu,$Conveyed,
2887             $SaveNext,$Persists,$Selected,
2888             $convey,$parent_menu;
2889             } elsif ($Term::Menus::fullauto) {
2890 0           &Net::FullAuto::FA_Core::handle_error($die);
2891 0           } else { die $die }
2892             }
2893             }
2894 0 0         my $item=($show_banner_only)?'__FA_Banner__':$pick;
2895 0           $Selected->{$_[0]}->{$item}=$test_item;
2896 0           return $FullMenu,$Conveyed,$SaveNext,
2897             $Persists,$Selected,$convey,$parent_menu;
2898             }
2899 0 0         if ($test_item=~/Convey\s*=\>/) {
2900 0 0         if ($convey ne 'SKIP') {
2901 0           $test_item=~s/Convey\s*=\>/$convey/g;
2902             } else {
2903 0           $test_item=~s/Convey\s*=\>/${$_[1]}[$pick-1]/g;
  0            
2904             }
2905             }
2906 0 0         if ($test_item=~/Text\s*=\>/) {
2907 0           $test_item=~s/Text\s*=\>/${$_[1]}[$pick-1]/g;
  0            
2908             }
2909             } else {
2910             my $die="The \"Result3 =>\" Setting\n -> "
2911 0           .$FullMenu->{$_[0]}[2]{$_[1]->[$_[2]-1]}
2912             ."\n Found in the Menu Unit -> "
2913             .$MenuUnit_hash_ref
2914             ."\n is not a Menu Unit\,"
2915             ." and Because it Does Not Have"
2916             ."\n an \"&\" as"
2917             ." the Lead Character, $0"
2918             ."\n Cannot Determine "
2919             ."if it is a Valid SubRoutine.\n\n";
2920 0           die $die;
2921             }
2922             }
2923 0 0         if ($show_banner_only) {
2924 0           $Selected->{$_[0]}{'__FA_Banner__'}=$test_item;
2925 0           $SaveNext->{$_[0]}=$FullMenu->{$_[0]}[2]{'__FA_Banner__'};
2926             } else {
2927 0 0         chomp($pick) if $pick;
2928 0 0         $Selected->{$_[0]}{$pick}=$test_item if $pick;
2929 0 0 0       if ($pick && ref $_[0]->{$FullMenu->{$_[0]}
2930             [4]{$_[1]->[$pick-1]}}{'Result'} eq 'HASH') {
2931             $SaveNext->{$_[0]}=$FullMenu->{$_[0]}[2]
2932 0           {$_[1]->[$pick-1]};
2933             }
2934             }
2935 0           return $FullMenu,$Conveyed,$SaveNext,
2936             $Persists,$Selected,$convey,$parent_menu;
2937 0           };
2938            
2939 0           my $filtered_menu=0;my $defaults_exist=0;my $input='';
  0            
  0            
2940 0           while (1) {
2941 0 0         if ($num_pick-$start<=$display_this_many_items) {
2942 0           $choose_num=$num_pick-$start;
2943 0           } else { $choose_num=$display_this_many_items }
2944 0           $numbor=$start+$choose_num+1;my $done=0;my $savechk=0;my %pn=();
  0            
  0            
  0            
2945 0           my $sorted_flag=0;
2946             $Persists->{$MenuUnit_hash_ref}={} unless exists
2947 0 0         $Persists->{$MenuUnit_hash_ref};
2948 0 0 0       if (!exists $Persists->{$MenuUnit_hash_ref}{defaults} &&
2949 0           defined ${[keys %{$FullMenu->{$MenuUnit_hash_ref}[5]}]}[0]) {
  0            
2950 0           my $it=${[keys %{$FullMenu->{$MenuUnit_hash_ref}[5]}]}[0];
  0            
  0            
2951 0           my $def=$FullMenu->{$MenuUnit_hash_ref}[5]{$it};
2952 0 0         if ($def) {
2953 0 0         $def='.*' if $def eq '*';
2954 0           foreach my $item (
2955 0           @{[keys %{$FullMenu->{$MenuUnit_hash_ref}[5]}]}) {
  0            
2956 0 0         if ($item=~/$def/) {
2957 0           $Persists->{$MenuUnit_hash_ref}{defaults}=1;
2958             }
2959             }
2960             }
2961             }
2962             $Persists->{$MenuUnit_hash_ref}{defaults}=0 unless exists
2963 0 0         $Persists->{$MenuUnit_hash_ref}{defaults};
2964 0           my $plann='';my $plannn='';
  0            
2965 0 0         if (ref $Net::FullAuto::FA_Core::plan eq 'HASH') {
2966 0           my $plann=shift @{$Net::FullAuto::FA_Core::plan};
  0            
2967 0           $plannn=$plann->{Item};
2968 0           my $plan_='';
2969 0 0         if (substr($plannn,2,5) eq 'ARRAY') {
2970 0           my $eval_plan=substr($plannn,1,-1);
2971 0           $plan_=eval $eval_plan;
2972 0 0         &eval_error($@,$log_handle) if $@;
2973             } else {
2974 0           $plan_=$plannn;
2975             }
2976 0           return $plan_;
2977             }
2978 0   0       while ($numbor=~/\d+/ &&
      0        
      0        
2979             ($numbor<=$start || $start+$choose_num < $numbor ||
2980             $numbor eq 'admin') || $input) {
2981 0           my $menu_text='';my $picknum_for_display='';
  0            
2982 0           my $bout='';
2983 0   0       ($bout,$input)=&banner($MenuUnit_hash_ref->{Banner}||$banner,
2984             $Conveyed,$SaveMMap,$picks_from_parent,
2985             $numbor,$ikey,$input,$MenuUnit_hash_ref,$log_handle);
2986 0           $menu_text.=$bout."\n";
2987 0           my $picknum=$start+1;
2988 0           my $numlist=$choose_num;
2989 0           my $mark='';
2990 0           my $mark_len=$FullMenu->{$MenuUnit_hash_ref}[7]{BLANK};
2991 0           while ($mark_len--) {
2992 0           $mark.=' ';
2993             }
2994 0           my $mark_blank=$mark;
2995 0           my $mark_flg=0;my $prev_menu=0;
  0            
2996 0 0         $numlist=1 if $numbor eq 'admin';
2997 0           while (0 < $numlist) {
2998 0 0         if (exists $picks{$picknum}) {
2999 0           $mark_flg=1;
3000 0 0         if ($return_from_child_menu) {
3001 0           $mark=$mark_blank;
3002 0           substr($mark,-1)=$picks{$picknum}=$return_from_child_menu;
3003 0           %{$SavePick->{$MenuUnit_hash_ref}}=%picks;
  0            
3004 0           $prev_menu=$picknum;
3005             #print "DO WE GET HERE3 and SEL=$MenuUnit_hash_ref->{Select}! and $return_from_child_menu\n";
3006             } else {
3007 0           $mark=$mark_blank;
3008 0           substr($mark,-1)=$picks{$picknum};
3009             }
3010             #print "DO WE GET HERE4 and SEL=$MenuUnit_hash_ref->{Select}!\n";
3011             my $gotmany=($select_many ||
3012 0 0 0       (keys %{$MenuUnit_hash_ref->{Select}})) ? 1 : 0;
3013 0 0 0       if (($gotmany
      0        
      0        
      0        
3014             && $numbor=~/^[Ff]$/) || ($picks{$picknum} ne
3015             '+' && $picks{$picknum} ne '-' &&
3016             !$gotmany)) {
3017             #print "DO WE GET HERE5! and $MenuUnit_hash_ref->{Select}\n";
3018 0           $mark_flg=1;
3019 0           $mark=$mark_blank;
3020 0           substr($mark,-1)='*';
3021 0 0 0       if ((exists $FullMenu->{$MenuUnit_hash_ref}[2]
      0        
3022             {$all_menu_items_array[$picknum-1]}) && ref
3023             $FullMenu->{$MenuUnit_hash_ref}[2]
3024             {$all_menu_items_array[$picknum-1]} eq 'HASH' &&
3025 0           (grep { /Item_/ } keys %{$FullMenu->
3026 0           {$MenuUnit_hash_ref}[3]})) {
3027 0 0         if (exists $FullMenu->{$MenuUnit_hash_ref}[3]
3028             {$all_menu_items_array[$picknum-1]}) {
3029             $convey=$FullMenu->{$MenuUnit_hash_ref}[3]
3030 0           {$all_menu_items_array[$picknum-1]}->[0];
3031 0           } else { $convey=$all_menu_items_array[$picknum-1] }
3032 0           eval {
3033             ($menu_output,$FullMenu,$Selected,$Conveyed,$SavePick,
3034             $SaveMMap,$SaveNext,$Persists)=&Menu($FullMenu->
3035             {$MenuUnit_hash_ref}[2]
3036 0           {$all_menu_items_array[$picknum-1]},$convey,
3037             $recurse_level,$FullMenu,
3038             $Selected,$Conveyed,$SavePick,
3039             $SaveMMap,$SaveNext,$Persists,
3040             $MenuUnit_hash_ref,$no_wantarray);
3041             }; # MENU RETURN MENURETURN 1
3042 0 0         print "MENU RETURN 1\n" if $menu_return_debug;
3043 0 0         die $@ if $@;
3044 0 0         chomp($menu_output) if !(ref $menu_output);
3045 0 0         if ($menu_output eq '-') {
    0          
    0          
    0          
    0          
3046 0           $picks{$picknum}='-';
3047 0           $mark=$mark_blank;
3048 0           substr($mark,-1)='-';
3049 0           $start=${$FullMenu}{$MenuUnit_hash_ref}[11];
  0            
3050             } elsif ($menu_output eq '+') {
3051 0           $picks{$picknum}='+';
3052 0           $mark=$mark_blank;
3053 0           substr($mark,-1)='+';
3054 0           $start=$FullMenu->{$MenuUnit_hash_ref}[11];
3055             } elsif ($menu_output eq 'DONE_SUB') {
3056 0           return 'DONE_SUB';
3057             } elsif ($menu_output eq 'DONE') {
3058 0 0         if (1==$recurse_level) {
3059 0 0         my $subfile=substr($Term::Menus::fa_code,0,-3).'::'
3060             if $Term::Menus::fa_code;
3061 0   0       $subfile||='';
3062 0           foreach my $sub (&get_subs_from_menu($Selected)) {
3063 0           my @resu=();
3064 0 0         if (ref $sub eq 'CODE') {
3065 0 0 0       if ($Term::Menus::fullauto && (!exists
      0        
      0        
3066             $MenuUnit_hash_ref->{'NoPlan'} ||
3067             !$MenuUnit_hash_ref->{'NoPlan'})
3068             && defined
3069             $Net::FullAuto::FA_Core::makeplan) {
3070             #print "IN MAKEPLAN1\n";
3071 0 0 0       if (-1==
3072             $#{$Net::FullAuto::FA_Core::makeplan{
3073 0           'Plan'}} && !exists
3074             $Net::FullAuto::FA_Core::makeplan->{
3075             'Title'}) {
3076             $Net::FullAuto::FA_Core::makeplan->{
3077 0           'Title'}=$pn{$numbor}[0];
3078             }
3079 0           my $n='Number';
3080             my $planid=
3081             $Net::FullAuto::FA_Core::makeplan->{
3082 0           $n};
3083 0           my $s=$sub;
3084 0           my $item=
3085             &Data::Dump::Streamer::Dump(
3086             $s)->Out();
3087 0           push @{$Net::FullAuto::FA_Core::makeplan->{
3088 0           'Plan'}},
3089             { Menu => &pw($MenuUnit_hash_ref),
3090             Number => $numbor,
3091             PlanID => $planid,
3092             Item => $item
3093             }
3094             }
3095 0           eval { @resu=$sub->() };
  0            
3096 0 0         if ($@) {
3097 0 0 0       if (10
3098             eq 'FATAL ERROR') {
3099 0 0 0       if ($parent_menu && wantarray
      0        
3100             && !$no_wantarray) {
3101 0           return '',$FullMenu,$Selected,
3102             $Conveyed,$SavePick,$SaveMMap,
3103             $SaveNext,$Persists,
3104             $parent_menu,$@;
3105             }
3106 0 0 0       if (defined $log_handle &&
3107             -1
3108 0           print $log_handle $@;
3109 0           close($log_handle);
3110             }
3111 0 0         if ($Term::Menus::fullauto) {
3112 0           &Net::FullAuto::FA_Core::handle_error(
3113             $@);
3114 0           } else { die $@ }
3115             } else {
3116 0           my $die=''
3117             ."\n FATAL ERROR! - The Local "
3118             ."System $Term::Menus::local_hostname"
3119             ." Conveyed\n"
3120             ." the Following "
3121             ."Unrecoverable Error Condition :\n\n"
3122             ." $@\n line ".__LINE__;
3123 0 0 0       if ($parent_menu && wantarray
      0        
3124             && !$no_wantarray) {
3125 0           return '',$FullMenu,$Selected,
3126             $Conveyed,$SavePick,$SaveMMap,
3127             $SaveNext,$Persists,
3128             $parent_menu,$die;
3129             }
3130 0 0 0       if (defined $log_handle &&
3131             -1
3132 0           print $log_handle $die;
3133 0           close($log_handle);
3134             }
3135 0 0         if ($Term::Menus::fullauto) {
3136 0           &Net::FullAuto::FA_Core::handle_error(
3137             $die);
3138 0           } else { die $die }
3139             }
3140             }
3141 0 0         if (-1<$#resu) {
3142 0 0         if ($resu[0] eq '<') { %picks=();next }
  0            
  0            
3143 0 0 0       if (0<$#resu && wantarray &&
      0        
3144             !$no_wantarray) {
3145 0           return @resu;
3146             } else {
3147 0           return return_result($resu[0],
3148             $MenuUnit_hash_ref,$Conveyed);
3149 0           } return 'DONE_SUB';
3150             }
3151             }
3152 0           eval {
3153 0 0         if ($subfile) {
3154 0           $sub=~s/^[&]//;
3155 0 0 0       if ($Term::Menus::fullauto && (!exists
      0        
      0        
3156             $MenuUnit_hash_ref->{'NoPlan'} ||
3157             !$MenuUnit_hash_ref->{'NoPlan'})
3158             && defined
3159             $Net::FullAuto::FA_Core::makeplan) {
3160             #print "IN MAKEPLAN2\n";
3161 0 0 0       if (-1==$#{$Net::FullAuto::FA_Core::makeplan{
3162 0           'Plan'}} && !exists
3163             $Net::FullAuto::FA_Core::makeplan->{
3164             'Title'}) {
3165             $Net::FullAuto::FA_Core::makeplan->{
3166 0           'Title'}=$pn{$numbor}[0];
3167             }
3168             push @{$Net::FullAuto::FA_Core::makeplan->{
3169 0           'Plan'}},
3170             { Menu => &pw($MenuUnit_hash_ref),
3171             Number => $numbor,
3172             PlanID =>
3173             $Net::FullAuto::FA_Core::makeplan->{Number},
3174 0           Item => "&$subfile$sub" }
3175             }
3176 0           eval "\@resu=\&$subfile$sub";
3177 0   0       my $firsterr=$@||'';
3178            
3179 0 0 0       if ((-1
    0          
3180             'Undefined subroutine') &&
3181             (-1
3182 0 0         if ($sub!~/::/) {
3183 0           eval "\@resu=main::$sub";
3184             } else {
3185 0           eval "\@resu=$sub";
3186             }
3187 0   0       my $seconderr=$@||'';my $die='';
  0            
3188 0           my $c=$Term::Menus::fa_code;
3189 0 0         if ($seconderr=~/Undefined subroutine/) {
3190 0 0         if ($FullMenu->{$MenuUnit_hash_ref}
3191             [2]{$all_menu_items_array[
3192             $numbor-1]}) {
3193             $die="The \"Result15 =>\" Setting"
3194             ."\n\t\t-> " . $FullMenu->
3195             {$MenuUnit_hash_ref}[2]
3196             {$all_menu_items_array[
3197             $numbor-1]}
3198             ."\n\t\tFound in the Menu "
3199             ."Unit -> "
3200             .$MenuUnit_hash_ref->{Name}
3201 0           ."\n\t\t"
3202             ."Specifies a Subroutine"
3203             ." that Does NOT Exist"
3204             ."\n\t\tin the User Code File "
3205             .$c.",\n\t\tnor was a routine "
3206             ."with that name\n\t\tlocated"
3207             ." in the main:: script.\n";
3208             } else {
3209 0           $die=
3210             "$firsterr\n $seconderr"
3211             }
3212 0           } else { $die=$seconderr }
3213 0           &Net::FullAuto::FA_Core::handle_error(
3214             $die);
3215             } elsif ($firsterr) {
3216 0           &Net::FullAuto::FA_Core::handle_error(
3217             $firsterr);
3218             }
3219             } else {
3220 0 0         if ($sub!~/::/) {
3221 0           $sub=~s/^[&]//;
3222 0           eval "\@resu=main::$sub";
3223             } else {
3224 0           eval "\@resu=$sub";
3225             }
3226 0 0         die $@ if $@;
3227             }
3228             };
3229 0 0         if ($@) {
3230 0 0 0       if (10
3231             eq 'FATAL ERROR') {
3232 0 0 0       if ($parent_menu && wantarray
      0        
3233             && !$no_wantarray) {
3234 0           return '',$FullMenu,$Selected,$Conveyed,
3235             $SavePick,$SaveMMap,$SaveNext,
3236             $Persists,$parent_menu,$@;
3237             }
3238 0 0 0       if (defined $log_handle &&
3239             -1
3240 0           print $log_handle $@;
3241 0           close($log_handle);
3242             }
3243 0 0         if ($Term::Menus::fullauto) {
3244 0           &Net::FullAuto::FA_Core::handle_error($@);
3245 0           } else { die $@ }
3246             } else {
3247 0           my $die=''
3248             ."\n FATAL ERROR! - The Local "
3249             ."System $Term::Menus::local_hostname "
3250             ."Conveyed\n"
3251             ." the Following "
3252             ."Unrecoverable Error Condition :\n\n"
3253             ." $@\n line ".__LINE__;
3254 0 0 0       if ($parent_menu && wantarray
      0        
3255             && !$no_wantarray) {
3256 0           return '',$FullMenu,$Selected,$Conveyed,
3257             $SavePick,$SaveMMap,$SaveNext,
3258             $Persists,$parent_menu,$die;
3259             }
3260 0 0 0       if (defined $log_handle &&
3261             -1
3262 0           print $log_handle $die;
3263 0           close($log_handle);
3264             }
3265 0 0         if ($Term::Menus::fullauto) {
3266 0           &Net::FullAuto::FA_Core::handle_error(
3267             $die);
3268 0           } else { die $die }
3269             }
3270             }
3271 0 0         if (-1<$#resu) {
3272 0 0         if ($resu[0] eq '<') { %picks=();next }
  0            
  0            
3273 0 0 0       if (0<$#resu && wantarray && !$no_wantarray) {
      0        
3274 0           return @resu;
3275             } else {
3276 0           return return_result($resu[0],
3277             $MenuUnit_hash_ref,$Conveyed);
3278             }
3279             }
3280             }
3281 0           return 'DONE_SUB';
3282 0           } else { return 'DONE' }
3283             } elsif ($menu_output) {
3284 0           return $menu_output;
3285             } else {
3286 0           $picks{$picknum}='+';
3287 0           $mark=$mark_blank;
3288 0           substr($mark,-1)='+';
3289 0           $start=$FullMenu->{$MenuUnit_hash_ref}[11];
3290             }
3291             }
3292             }
3293             } else {
3294 0           $mark='';
3295 0           my $mark_len=$FullMenu->{$MenuUnit_hash_ref}[7]{BLANK};
3296 0           while ($mark_len--) {
3297 0           $mark.=' ';
3298             }
3299             }
3300             $mark=$FullMenu->{$MenuUnit_hash_ref}[7]
3301             {$all_menu_items_array[$picknum-1]}
3302             if exists $FullMenu->{$MenuUnit_hash_ref}[7]
3303 0 0         {$all_menu_items_array[$picknum-1]};
3304 0 0 0       if (!$hidedefaults &&
      0        
      0        
      0        
3305             ref $FullMenu->{$MenuUnit_hash_ref}[5] eq 'HASH'
3306             && $FullMenu->{$MenuUnit_hash_ref}[5]
3307             {$all_menu_items_array[$picknum-1]} && ($FullMenu->
3308             {$MenuUnit_hash_ref}[5]{$all_menu_items_array[$picknum-1]}
3309             eq '*' || $all_menu_items_array[$picknum-1]=~
3310             /$FullMenu->{$MenuUnit_hash_ref}[5]{
3311             $all_menu_items_array[$picknum-1]}/)) {
3312 0           $mark=$mark_blank;
3313 0           substr($mark,-1)='*';$mark_flg=1;
  0            
3314 0           $SavePick->{$MenuUnit_hash_ref}{$picknum}='*';
3315             }
3316 0           $picknum_for_display=$picknum;
3317 0 0 0       if (ref $FullMenu->{$MenuUnit_hash_ref}[8] eq 'HASH'
      0        
      0        
3318 0           && keys %{$FullMenu->{$MenuUnit_hash_ref}[8]} &&
3319             exists $FullMenu->{$MenuUnit_hash_ref}[8]
3320             {$all_menu_items_array[$picknum-1]}
3321             && $FullMenu->{$MenuUnit_hash_ref}[8]
3322             {$all_menu_items_array[$picknum-1]}) {
3323             $picknum_for_display=
3324             $FullMenu->{$MenuUnit_hash_ref}[8]
3325 0           {$all_menu_items_array[$picknum-1]};
3326 0           $mark=$mark_blank;
3327 0 0 0       if (exists $SavePick->{$MenuUnit_hash_ref}
3328             {$picknum_for_display} &&
3329             $SavePick->{$MenuUnit_hash_ref}
3330             {$picknum_for_display}) {
3331             substr($mark,-1)=$SavePick->{$MenuUnit_hash_ref}
3332 0           {$picknum_for_display}
3333 0           } else { $mark=' ' }
3334 0 0         $mark_flg=1 unless $mark=~/^ +$/;
3335             $Persists->{$MenuUnit_hash_ref}{defaults}=1
3336 0 0         if $Persists->{$parent_menu}{defaults};
3337 0 0         if ($FullMenu->{$MenuUnit_hash_ref}[9]) {
3338 0           $filtered_menu=1;
3339             }
3340             }
3341 0           $pn{$picknum_for_display}=
3342             [ $all_menu_items_array[$picknum-1],$picknum ];
3343 0           my $scroll=' ';
3344 0 0 0       if (exists $MenuUnit_hash_ref->{Scroll}
      0        
3345             && ($MenuUnit_hash_ref->{Scroll}->[1] eq $picknum
3346             || $MenuUnit_hash_ref->{Scroll}->[0] eq $picknum)) {
3347 0 0         if ($MenuUnit_hash_ref->{Scroll}->[0]) {
3348 0 0         if ($MenuUnit_hash_ref->{Scroll}->[0] eq $picknum) {
3349 0           $MenuUnit_hash_ref->{Scroll}->[1]=$picknum;
3350 0           $MenuUnit_hash_ref->{Scroll}->[0]=0;
3351 0           $scroll='>';
3352             }
3353             } else {
3354 0           $scroll='>';
3355             }
3356             }
3357 0           my $picknum_display=sprintf "%-7s",$picknum_for_display;
3358 0           $menu_text.=" $scroll$mark $picknum_display"
3359             ."$all_menu_items_array[$picknum-1]\n";
3360 0 0         if (exists $FullMenu->{$MenuUnit_hash_ref}[6]
3361             {$all_menu_items_array[$picknum-1]}) {
3362             my $tstt=$FullMenu->{$MenuUnit_hash_ref}[6]
3363 0           {$all_menu_items_array[$picknum-1]};
3364 0 0         if ($tstt=~/many/i) {
3365 0           $MenuUnit_hash_ref->{Select}{$picknum_for_display}='many';
3366             }
3367             }
3368 0 0 0       if ($mark=~/^ +$/ || (exists $picks{$picknum} ||
      0        
3369             exists $picks{$picknum_for_display})) {
3370 0           ${$_[0]}[$picknum_for_display-1]=
  0            
3371             $all_menu_items_array[$picknum-1];
3372             }
3373 0           $picknum++;
3374 0           $numlist--;
3375 0           } $hidedefaults=1;$picknum--;
  0            
3376 0 0 0       if ($Term::Menus::fullauto && (!exists
      0        
      0        
      0        
      0        
3377             $MenuUnit_hash_ref->{'NoPlan'} ||
3378             !$MenuUnit_hash_ref->{'NoPlan'}) &&
3379             $Net::FullAuto::FA_Core::makeplan &&
3380             $Persists->{$MenuUnit_hash_ref}{defaults} &&
3381             !$filtered_menu) {
3382 0           my %askmenu=(
3383            
3384             Item_1 => {
3385            
3386             Text => "Use the result saved with the \"Plan\""
3387            
3388             },
3389             Item_2 => {
3390            
3391             Text => "Use the \"Default\" setting to determine result"
3392            
3393             },
3394             NoPlan => 1,
3395             Banner => " FullAuto has determined that the ".
3396             &pw($MenuUnit_hash_ref) .
3397             " Menu has been\n".
3398             " configured with a \"Default\" setting."
3399            
3400             );
3401 0           my $answ=Menu(\%askmenu);
3402 0 0         if ($answ eq ']quit[') {
3403 0           return ']quit['
3404             }
3405 0 0         if (-1==index $answ,'result saved') {
3406             #print "IN MAKEPLAN3\n";
3407 0 0 0       if (-1==$#{$Net::FullAuto::FA_Core::makeplan{'Plan'}} &&
  0            
3408             !exists $Net::FullAuto::FA_Core::makeplan->{'Title'}) {
3409 0           $Net::FullAuto::FA_Core::makeplan->{'Title'}=$pn{$numbor}[0];
3410             }
3411 0           push @{$Net::FullAuto::FA_Core::makeplan->{'Plan'}},
3412             { Menu => &pw($MenuUnit_hash_ref),
3413             Number => 'Default',
3414             PlanID =>
3415             $Net::FullAuto::FA_Core::makeplan->{Number},
3416 0           Item => '' };
3417 0           $got_default=1;
3418             }
3419             }
3420 0 0         unless ($Persists->{unattended}) {
    0          
    0          
3421 0 0         if ($^O ne 'cygwin') {
3422 0 0         unless ($noclear) {
3423 0 0 0       if ($^O eq 'MSWin32' || $^O eq 'MSWin64') {
3424 0           system("cmd /c cls");
3425 0           print "\n";
3426             } else {
3427 0           print `${Term::Menus::clearpath}clear`."\n";
3428 0           print $blanklines
3429             }
3430 0           } else { print $blanklines }
3431 0           } else { print $blanklines }
3432 0           print $menu_text;my $ch=0;
  0            
3433 0 0 0       if ($select_many || (keys %{${$MenuUnit_hash_ref}{Select}})) {
  0            
  0            
3434 0           print "\n";
3435 0 0         unless (keys %{$FullMenu->{$MenuUnit_hash_ref}[1]}) {
  0            
3436 0           print " a. Select All";$ch=1;
  0            
3437             }
3438 0 0 0       if ($mark_flg==1 || $Persists->{$MenuUnit_hash_ref}{defaults}) {
3439 0           print " c. Clear All";#print "\n" if $ch;
3440             }
3441 0           print " f. FINISH\n";
3442 0 0         if ($filtered_menu) {
3443 0           print "\n (Type '<' to return to previous Menu)\n";
3444             }
3445 0 0 0       if ($Persists->{$MenuUnit_hash_ref}{defaults} &&
3446             !$filtered_menu) {
3447 0           print "\n == Default Selections Exist! == ",
3448             "(Type '*' to view them)\n";
3449             }
3450             } else {
3451 0 0         if ($Persists->{$MenuUnit_hash_ref}{defaults}) {
    0          
3452 0           print "\n",
3453             " c. Clear Default Selection.",
3454             " f. FINISH with Default Selection.\n";
3455 0 0         if ($filtered_menu) {
3456 0           print "\n (Type '<' to return to previous Menu)\n";
3457             } else {
3458 0           print "\n == Default Selection Exists! == ",
3459             "(Type '*' to view it)\n";
3460             }
3461             } elsif ($filtered_menu) {
3462 0           print "\n (Type '<' to return to previous Menu)\n";
3463             }
3464             }
3465 0 0         if ($display_this_many_items<$num_pick) {
3466 0           my $len=length $num_pick;my $pad='';
  0            
3467 0           foreach my $n (1..$len) {
3468 0           $pad.=' ';
3469             }
3470 0           print $pad,
3471             "\n $num_pick Total Choices ",
3472             "[v][^] Scroll with ARROW keys ".
3473             " [F1] for HELP\n";
3474 0           } else { print "\n \(Press [F1] for HELP\)\n" }
3475 0 0         if ($Term::Menus::term_input) {
3476 0           print "\n";
3477 0 0 0       if (exists $MenuUnit_hash_ref->{Input} &&
    0          
3478             $MenuUnit_hash_ref->{Input}) {
3479 0           ($numbor,$ikey)=rawInput(" \([ESC] to Quit\)".
3480             " Press ENTER when finished ",1);
3481 0 0 0       next unless ($ikey eq 'ENTER' || $ikey eq 'ESC' ||
      0        
      0        
      0        
      0        
      0        
3482             $ikey eq 'UPARROW' || $ikey eq 'DOWNARROW' ||
3483             $ikey eq 'LEFTARROW' || $ikey eq 'RIGHTARROW' ||
3484             $ikey eq 'F1');
3485             } elsif ($show_banner_only) {
3486 0           ($numbor,$ikey)=rawInput(" \([ESC] to Quit\)".
3487             " Press ENTER to continue ... ");
3488            
3489             } else {
3490 0           ($numbor,$ikey)=rawInput(" \([ESC] to Quit\)".
3491             " PLEASE ENTER A CHOICE: ");
3492             }
3493 0           print "\n";
3494             } else {
3495 0 0         if ($show_banner_only) {
3496 0           print "\n \([ESC] to Quit\)",
3497             " Press ENTER to continue ... ";
3498             } else {
3499 0           print "\n \([ESC] to Quit\)",
3500             " PLEASE ENTER A CHOICE: ";
3501             }
3502 0           $numbor=;
3503 0           } $picknum_for_display=$numbor;chomp $picknum_for_display;
  0            
3504 0           } elsif ($Persists->{$MenuUnit_hash_ref}{defaults}) {
3505 0           $numbor='f';
3506 0 0         } elsif (wantarray && !$no_wantarray) {
3507 0           my $die="\n FATAL ERROR! - 'Unattended' mode cannot be\n"
3508             ." used without a Plan or Default\n"
3509             ." Selections being available.";
3510 0           return '',$die;
3511             } else {
3512 0           my $die="\n FATAL ERROR! - 'Unattended' mode cannot be\n"
3513             ." used without a Plan or Default\n"
3514             ." Selections being available.";
3515 0           die($die);
3516             }
3517 0 0 0       if ($numbor=~/^[Ff]$/ &&
    0 0        
    0 0        
    0 0        
    0 0        
    0 0        
    0 0        
    0 0        
    0 0        
    0 0        
    0 0        
    0 0        
      0        
      0        
3518             ($Persists->{$MenuUnit_hash_ref}{defaults} ||
3519             $filtered_menu)) {
3520             # FINISH
3521 0 0         delete $main::maintain_scroll_flag->{$MenuUnit_hash_ref}
3522             if defined $main::maintain_scroll_flag;
3523 0           my $choice='';my @keys=();
  0            
3524 0           my $chosen='';
3525 0 0         if ($filtered_menu) {
3526 0           $chosen=$parent_menu;
3527 0           return '-',
3528             $FullMenu,$Selected,$Conveyed,
3529             $SavePick,$SaveMMap,$SaveNext,
3530             $Persists,$parent_menu;
3531 0           } else { $chosen=$MenuUnit_hash_ref }
3532 0           @keys=keys %picks;
3533 0 0         if (-1==$#keys) {
3534 0 0         if ($Persists->{$MenuUnit_hash_ref}{defaults}) {
3535 0 0         if ($filtered_menu) {
3536 0           $chosen=$parent_menu;
3537             }
3538 0           my $it=${[keys %{${$FullMenu}{$chosen}[5]}]}[0];
  0            
  0            
  0            
3539 0           my $def=${$FullMenu}{$chosen}[5]{$it};
  0            
3540 0 0         $def='.*' if $def eq '*';
3541 0 0         if ($def) {
3542 0           my $cnt=1;
3543 0           foreach my $item (@all_menu_items_array) {
3544             #sort @{[keys %{${$FullMenu}{$chosen}[5]}]}) {
3545 0 0         if ($item=~/$def/) {
3546 0           $picks{$cnt}='*';
3547 0           push @keys, $item;
3548 0           } $cnt++
3549             }
3550             }
3551             } else {
3552 0           @keys=keys %{$SavePick->{$parent_menu}};
  0            
3553 0 0         if (-1==$#keys) {
3554 0 0         if ($^O ne 'cygwin') {
3555 0 0         unless ($noclear) {
3556 0 0 0       if ($^O eq 'MSWin32' || $^O eq 'MSWin64') {
3557 0           system("cmd /c cls");
3558 0           print "\n";
3559             } else {
3560 0           print `${Term::Menus::clearpath}clear`."\n";
3561             }
3562 0           } else { print $blanklines }
3563 0           } else { print $blanklines }
3564 0           print "\n\n Attention USER! :\n\n ",
3565             "You have selected \"f\" to finish your\n",
3566             " selections, BUT -> You have not actually\n",
3567             " selected anything!\n\n Do you wish ",
3568             "to quit or re-attempt selecting?\n\n ",
3569             "Press [ESC] to quit or ENTER to continue ... ";
3570 0 0         if ($Term::Menus::term_input) {
3571 0           print "\n";
3572 0           ($choice,$ikey)=rawInput(" \([ESC] to Quit\)".
3573             " PLEASE ENTER A CHOICE: ");
3574 0           print "\n";
3575             } else {
3576 0           print " \([ESC] to Quit\)",
3577             "\n PLEASE ENTER A CHOICE: ";
3578 0           $choice=;
3579             }
3580 0           chomp($choice);
3581 0 0         next if lc($choice) ne 'quit';
3582 0           return ']quit['
3583             }
3584             }
3585             }
3586 0           my $return_values=0;
3587 0     0 0   sub numerically { $a <=> $b }
3588 0           my %dupseen=();my @pickd=();
  0            
3589 0           foreach my $pk (sort numerically keys %picks) {
3590             $return_values=1 if !exists
3591 0           ${$FullMenu}{$chosen}[2]{${$_[0]}[$pk-1]}
  0            
3592             || !keys
3593 0 0 0       %{${$FullMenu}{$chosen}[2]{${$_[0]}[$pk-1]}};
  0            
  0            
  0            
3594 0 0 0       if (${${$FullMenu}{$parent_menu}[10]}[$pk-1] &&
  0 0          
  0 0          
3595 0           !${$_[0]}[$pk-1]) {
3596 0           my $txt=${${$FullMenu}{$parent_menu}[10]}[$pk-1];
  0            
  0            
3597 0 0         if (-1
3598 0           my $lhn=$Term::Menus::local_hostname;
3599 0           $txt=~s/__Master_${$}__/Local-Host: $lhn/sg;
3600             }
3601 0 0         unless (exists $dupseen{$txt}) {
3602 0           push @pickd, $txt;
3603 0           } $dupseen{$txt}='';
3604 0           } elsif (${$_[0]}[$pk-1]) {
3605 0           my $txt=${$_[0]}[$pk-1];
  0            
3606 0 0         if (-1
3607 0           my $lhn=$Term::Menus::local_hostname;
3608 0           $txt=~s/__Master_${$}__/Local-Host: $lhn/sg;
3609             }
3610 0 0         unless (exists $dupseen{$txt}) {
3611 0           push @pickd, $txt;
3612 0           } $dupseen{$txt}='';
3613             } elsif ($pn{$picknum}) {
3614 0           my $txt=$pn{$picknum}[0];
3615 0 0         if (-1
3616 0           my $lhn=$Term::Menus::local_hostname;
3617 0           $txt=~s/__Master_${$}__/Local-Host: $lhn/sg;
3618             }
3619 0 0         unless (exists $dupseen{$txt}) {
3620 0           push @pickd, $txt;
3621 0           } $dupseen{$txt}='';
3622             }
3623             }
3624 0 0 0       if ($return_values && $Term::Menus::fullauto &&
      0        
      0        
      0        
3625             (!exists ${$MenuUnit_hash_ref}{'NoPlan'} ||
3626             !${$MenuUnit_hash_ref}{'NoPlan'}) &&
3627             defined $Net::FullAuto::FA_Core::makeplan) {
3628             #print "IN MAKEPLAN4\n";
3629 0 0 0       if (-1==$#{$Net::FullAuto::FA_Core::makeplan{'Plan'}} &&
  0            
3630             !exists $Net::FullAuto::FA_Core::makeplan->{'Title'}) {
3631 0           $Net::FullAuto::FA_Core::makeplan->{'Title'}=
3632             "Multiple Selections";
3633             }
3634 0 0         unless ($got_default) {
3635 0           push @{$Net::FullAuto::FA_Core::makeplan->{'Plan'}},
3636             { Menu => &pw($MenuUnit_hash_ref),
3637             Number => 'Multiple',
3638             PlanID =>
3639             $Net::FullAuto::FA_Core::makeplan->{Number},
3640 0           Item => "'".
3641             &Data::Dump::Streamer::Dump(\@pickd)->Out().
3642             "'" }
3643             }
3644             }
3645 0 0         return \@pickd if $return_values;
3646 0           return 'DONE';
3647             } elsif ($numbor=~/^\s*%(.*)/s) {
3648             # PERCENT SYMBOL SORT ORDER
3649 0   0       my $one=$1||'';
3650 0           chomp $one;
3651 0 0         $one=qr/$one/ if $one;
3652 0           my @spl=();
3653 0           chomp $numbor;
3654 0           my $cnt=0;my $ct=0;my @splice=();
  0            
  0            
3655 0           my $sort_ed='';
3656 0 0 0       if ($one) {
    0          
3657            
3658             } elsif ($sorted && $sorted eq 'forward') {
3659 0           @spl=reverse @all_menu_items_array;$sort_ed='reverse';
  0            
3660 0           } else { @spl=sort @all_menu_items_array;$sort_ed='forward' }
  0            
3661 0 0         next if $#spl==-1;
3662 0           my %sort=();
3663 0           foreach my $line (@all_menu_items_array) {
3664 0           $cnt++;
3665 0 0 0       if (exists $pn{$picknum} &&
      0        
      0        
      0        
      0        
3666             exists $FullMenu->{$MenuUnit_hash_ref}[8]
3667             {$pn{$picknum}[0]} && $FullMenu->
3668             {$MenuUnit_hash_ref}[8]{$pn{$picknum}[0]} &&
3669             ref $FullMenu->{$MenuUnit_hash_ref}[8]
3670             {$pn{$picknum}[0]} eq 'HASH' &&
3671             keys %{$FullMenu->{$MenuUnit_hash_ref}[8]
3672 0           {$pn{$picknum}[0]}} && $FullMenu->
3673             {$MenuUnit_hash_ref}[8]{$pn{$picknum}[0]}) {
3674 0           $sort{$line}=$FullMenu->{$MenuUnit_hash_ref}[8]{$line};
3675 0           } else { $sort{$line}=$cnt }
3676 0           } $cnt=0;
3677 0           my $chosen='';
3678 0 0         if (!$sorted) {
3679 0 0         my $send_select='Many' if $select_many;
3680             $chosen={
3681             Select => $send_select,
3682 0           Banner => ${$MenuUnit_hash_ref}{Banner},
3683 0           };
3684 0           my $cnt=0;
3685 0           foreach my $text (@spl) {
3686 0           my $num=$sort{$text};
3687 0           $cnt++;
3688 0 0         if (exists $picks{$num}) {
3689 0           $chosen->{'Item_'.$cnt}=
3690             { Text => $text,Default => '*',__NUM__=>$num };
3691             } else {
3692 0           $chosen->{'Item_'.$cnt}=
3693             { Text => $text,__NUM__=>$num };
3694             }
3695             $chosen->{'Item_'.$cnt}{Result}=
3696 0           ${${$MenuUnit_hash_ref}{${${$FullMenu}
  0            
3697 0           {$MenuUnit_hash_ref}[4]}{$text}}}{'Result'}
  0            
3698 0           if exists ${${$MenuUnit_hash_ref}{${${$FullMenu}
  0            
3699 0 0         {$MenuUnit_hash_ref}[4]}{$text}}}{'Result'};
  0            
  0            
3700 0           $chosen->{'Item_'.$cnt}{Sort}=$sort_ed;
3701 0           $chosen->{'Item_'.$cnt}{Filter}=1;
3702 0           } $sorted=$sort_ed;
3703             } else {
3704 0           @all_menu_items_array=reverse @all_menu_items_array;
3705 0           next;
3706             }
3707 0           %{$SavePick->{$chosen}}=%picks;
  0            
3708 0           my @return_from_filtered_menu=();
3709 0           eval {
3710 0           ($menu_output,$FullMenu,$Selected,$Conveyed,$SavePick,
3711             $SaveMMap,$SaveNext,$Persists,
3712             @return_from_filtered_menu)=&Menu(
3713             $chosen,$picks_from_parent,
3714             $recurse_level,$FullMenu,
3715             $Selected,$Conveyed,$SavePick,
3716             $SaveMMap,$SaveNext,$Persists,
3717             $MenuUnit_hash_ref,$no_wantarray);
3718             }; # MENU RETURN MENURETURN 2
3719 0 0         print "MENU RETURN 2\n" if $menu_return_debug;
3720 0 0         die $@ if $@;
3721 0 0         if (-1<$#return_from_filtered_menu) {
3722 0 0         if ((values %{$menu_output})[0] eq 'recurse') {
  0            
3723 0           my %k=%{$menu_output};
  0            
3724 0           delete $k{Menu};
3725 0           my $lab=(keys %k)[0];
3726 0           $menu_output=$labels{$lab};
3727             }
3728 0           $MenuMap=$Persists->{$MenuUnit_hash_ref};
3729 0           eval {
3730 0           ($menu_output,$FullMenu,$Selected,$Conveyed,$SavePick,
3731             $SaveMMap,$SaveNext,$Persists)=&Menu(
3732             $menu_output,$FullMenu,
3733             $Selected,$Conveyed,$SavePick,
3734             $SaveMMap,$SaveNext,$Persists,
3735             $return_from_filtered_menu[0],
3736             $MenuUnit_hash_ref,
3737             $return_from_filtered_menu[2]);
3738             };
3739 0 0         die $@ if $@;
3740             }
3741 0 0         chomp($menu_output) if !(ref $menu_output);
3742 0 0         if ($menu_output eq '-') {
    0          
    0          
    0          
    0          
3743 0           %picks=%{$SavePick->{$chosen}};
  0            
3744 0           $start=$FullMenu->{$MenuUnit_hash_ref}[11];
3745             } elsif ($menu_output eq '+') {
3746 0           %picks=%{$SavePick->{$chosen}};
  0            
3747 0           %picks=%{$SavePick->{$MenuUnit_hash_ref}};
  0            
3748 0           $start=$FullMenu->{$MenuUnit_hash_ref}[11];
3749             } elsif ($menu_output eq 'DONE_SUB') {
3750 0           return 'DONE_SUB';
3751             } elsif ($menu_output eq 'DONE') {
3752 0 0         if (1==$recurse_level) {
3753 0 0         my $subfile=substr($Term::Menus::fa_code,0,-3)
3754             .'::' if $Term::Menus::fa_code;
3755 0   0       $subfile||='';
3756 0           foreach my $sub (&get_subs_from_menu($Selected)) {
3757 0           my @resu=();
3758 0 0         if (ref $sub eq 'CODE') {
3759 0 0 0       if ($Term::Menus::fullauto && (!exists
      0        
      0        
3760             ${$MenuUnit_hash_ref}{'NoPlan'} ||
3761             !${$MenuUnit_hash_ref}{'NoPlan'}) &&
3762             defined $Net::FullAuto::FA_Core::makeplan) {
3763             #print "IN MAKEPLAN5\n";
3764 0 0 0       if (-1==$#{$Net::FullAuto::FA_Core::makeplan{
3765 0           'Plan'}} && !exists
3766             $Net::FullAuto::FA_Core::makeplan->{
3767             'Title'}) {
3768             $Net::FullAuto::FA_Core::makeplan->{'Title'}
3769 0           =$pn{$numbor}[0];
3770             }
3771             push @{$Net::FullAuto::FA_Core::makeplan->{
3772 0           'Plan'}},
3773             { Menu => &pw($MenuUnit_hash_ref),
3774             Number => $numbor,
3775             PlanID =>
3776             $Net::FullAuto::FA_Core::makeplan->{
3777 0           'Number'},
3778             Item =>
3779             &Data::Dump::Streamer::Dump($sub)->Out() }
3780             }
3781 0           eval { @resu=$sub->() };
  0            
3782 0 0         if ($@) {
3783 0 0 0       if (10
3784             eq 'FATAL ERROR') {
3785 0 0 0       if ($parent_menu && wantarray && !$no_wantarray) {
      0        
3786 0           return '',$FullMenu,$Selected,$Conveyed,
3787             $SavePick,$SaveMMap,$SaveNext,
3788             $Persists,$parent_menu,$@;
3789             }
3790 0 0 0       if (defined $log_handle &&
3791             -1
3792 0           print $log_handle $@;
3793 0           close($log_handle);
3794             }
3795 0 0         if ($Term::Menus::fullauto) {
3796 0           &Net::FullAuto::FA_Core::handle_error($@);
3797 0           } else { die $@ }
3798             } else {
3799 0           my $die="\n FATAL ERROR! - The Local "
3800             ."System $Term::Menus::local_hostname "
3801             ."Conveyed\n"
3802             ." the Following "
3803             ."Unrecoverable Error Condition :\n\n"
3804             ." $@\n line ".__LINE__;
3805 0 0 0       if ($parent_menu && wantarray && !$no_wantarray) {
      0        
3806 0           return '',$FullMenu,$Selected,$Conveyed,
3807             $SavePick,$SaveMMap,$SaveNext,
3808             $Persists,$parent_menu,$die;
3809             }
3810 0 0 0       if (defined $log_handle &&
3811             -1
3812 0           print $log_handle $die;
3813 0           close($log_handle);
3814             }
3815 0 0         if ($Term::Menus::fullauto) {
3816 0           &Net::FullAuto::FA_Core::handle_error($die);
3817 0           } else { die $die }
3818             }
3819             }
3820 0 0         if (-1<$#resu) {
3821 0 0         if ($resu[0] eq '<') { %picks=();next }
  0            
  0            
3822 0 0 0       if (0<$#resu && wantarray && !$no_wantarray) {
      0        
3823 0           return @resu;
3824             } else {
3825 0           return return_result($resu[0],
3826             $MenuUnit_hash_ref,$Conveyed);
3827             }
3828             }
3829 0           $done=1;last
3830 0           }
3831 0           eval {
3832 0 0         if ($subfile) {
3833 0           $sub=~s/^[&]//;
3834 0 0 0       if ($Term::Menus::fullauto && (!exists
      0        
      0        
3835             ${$MenuUnit_hash_ref}{'NoPlan'} ||
3836             !${$MenuUnit_hash_ref}{'NoPlan'}) &&
3837             defined $Net::FullAuto::FA_Core::makeplan) {
3838             #print "IN MAKEPLAN6\n";
3839 0 0 0       if (-1==$#{$Net::FullAuto::FA_Core::makeplan{
3840 0           'Plan'}} && !exists
3841             $Net::FullAuto::FA_Core::makeplan->{
3842             'Title'}) {
3843             $Net::FullAuto::FA_Core::makeplan->{'Title'}
3844 0           =$pn{$numbor}[0];
3845             }
3846             push @{$Net::FullAuto::FA_Core::makeplan->{
3847 0           'Plan'}},
3848             { Menu => &pw($MenuUnit_hash_ref),
3849             Number => $numbor,
3850             PlanID =>
3851             $Net::FullAuto::FA_Core::makeplan->{
3852 0           'Number'},
3853             Item => "&$subfile$sub" }
3854             }
3855 0           eval "\@resu=\&$subfile$sub";
3856 0   0       my $firsterr=$@||'';
3857 0 0 0       if ((-1
    0          
3858             (-1
3859 0 0         if ($sub!~/::/) {
3860 0           eval "\@resu=main::$sub";
3861             } else {
3862 0           eval "\@resu=$sub";
3863             }
3864 0   0       my $seconderr=$@||'';my $die='';
  0            
3865 0 0         if ($seconderr=~/Undefined subroutine/) {
3866 0 0         if ($FullMenu->{$MenuUnit_hash_ref}
3867             [2]{$all_menu_items_array[$numbor-1]}) {
3868             $die="The \"Result15 =>\" Setting"
3869 0           ."\n\t\t-> " . ${$FullMenu}
3870             {$MenuUnit_hash_ref}[2]
3871             {$all_menu_items_array[$numbor-1]}
3872             ."\n\t\tFound in the Menu Unit -> "
3873 0           .$MenuUnit_hash_ref->{Name}."\n\t\t"
3874             ."Specifies a Subroutine"
3875             ." that Does NOT Exist"
3876             ."\n\t\tin the User Code File "
3877             .$Term::Menus::fa_code
3878             .",\n\t\tnor was a routine with "
3879             ."that name\n\t\tlocated in the"
3880             ." main:: script.\n";
3881 0           } else { $die="$firsterr\n $seconderr" }
3882 0           } else { $die=$seconderr }
3883 0           &Net::FullAuto::FA_Core::handle_error($die);
3884             } elsif ($firsterr) {
3885 0           &Net::FullAuto::FA_Core::handle_error($firsterr);
3886             }
3887             } else {
3888 0 0         if ($sub!~/::/) {
3889 0           $sub=~s/^[&]//;
3890 0           eval "\@resu=main::$sub";
3891             } else {
3892 0           eval "\@resu=$sub";
3893             }
3894 0 0         die $@ if $@;
3895             }
3896             };
3897 0 0         if ($@) {
3898 0 0 0       if (10
3899 0 0 0       if ($parent_menu && wantarray && !$no_wantarray) {
      0        
3900 0           return '',$FullMenu,$Selected,$Conveyed,
3901             $SavePick,$SaveMMap,$SaveNext,
3902             $Persists,$parent_menu,$@;
3903             }
3904 0 0 0       if (defined $log_handle &&
3905             -1
3906 0           print $log_handle $@;
3907 0           close($log_handle);
3908             }
3909 0 0         if ($Term::Menus::fullauto) {
3910 0           &Net::FullAuto::FA_Core::handle_error($@);
3911 0           } else { die $@ }
3912             } else {
3913 0           my $die="\n FATAL ERROR! - The Local "
3914             ."System $Term::Menus::local_hostname "
3915             ."Conveyed\n"
3916             ." the Following "
3917             ."Unrecoverable Error Condition :\n\n"
3918             ." $@\n line ".__LINE__;
3919 0 0 0       if ($parent_menu && wantarray && !$no_wantarray) {
      0        
3920 0           return '',$FullMenu,$Selected,$Conveyed,
3921             $SavePick,$SaveMMap,$SaveNext,
3922             $Persists,$parent_menu,$die;
3923             }
3924 0 0 0       if (defined $log_handle &&
3925             -1
3926 0           print $log_handle $die;
3927 0           close($log_handle);
3928             }
3929 0 0         if ($Term::Menus::fullauto) {
3930 0           &Net::FullAuto::FA_Core::handle_error($die);
3931 0           } else { die $die }
3932             }
3933             }
3934 0 0         if (-1<$#resu) {
3935 0 0         if ($resu[0] eq '<') { %picks=();next }
  0            
  0            
3936 0 0 0       if (0<$#resu && wantarray && !$no_wantarray) {
      0        
3937 0           return @resu;
3938             } else {
3939 0           return return_result($resu[0],
3940             $MenuUnit_hash_ref,$Conveyed);
3941             }
3942             }
3943             }
3944 0           return 'DONE_SUB';
3945 0           } else { return 'DONE' }
3946             } elsif ($menu_output) {
3947 0           return $menu_output;
3948             } else {
3949 0           %picks=%{$SavePick->{$MenuUnit_hash_ref}};
  0            
3950 0           $start=$FullMenu->{$MenuUnit_hash_ref}[11];
3951             }
3952             } elsif ($numbor=~/^\*\s*$/s) {
3953             # SHOW DEFAULT SELECTIONS using STAR symbol
3954 0 0         if ($filtered_menu) {
3955 0           print "\n WARNING!: Only -ONE- Level of Filtering",
3956             " is Supported!\n";
3957 0           sleep 2;
3958 0           last;
3959             }
3960 0           my @splice=();
3961 0           my @spl=();
3962 0           foreach my $key (keys %{$SavePick->{$parent_menu}}) {
  0            
3963 0           $picks{$key}='*';
3964             }
3965 0   0       $SavePick->{$MenuUnit_hash_ref}||={};
3966 0           foreach my $key (keys %picks) {
3967 0 0         if ($parent_menu) {
3968 0           $SavePick->{$parent_menu}->{$key}='*';
3969             } else {
3970 0           $SavePick->{$MenuUnit_hash_ref}->{$key}='*';
3971             }
3972             }
3973 0 0         if ($Persists->{$MenuUnit_hash_ref}{defaults}) {
3974 0           my $it=${[keys %{$FullMenu->{$MenuUnit_hash_ref}[5]}]}[0];
  0            
  0            
3975 0           my $def=$FullMenu->{$MenuUnit_hash_ref}[5]{$it};
3976 0 0         $def='.*' if $def eq '*';
3977 0 0         if ($def) {
3978 0           my $cnt=1;
3979 0           foreach my $item (@all_menu_items_array) {
3980 0 0         if ($item=~/$def/) {
3981 0           $picks{$cnt}='*';
3982 0           } $cnt++
3983             }
3984             }
3985             }
3986 0           foreach my $pick (sort numerically keys %picks) {
3987 0           push @splice,($pick-1)
3988             }
3989 0           foreach my $spl (@splice) {
3990 0           push @spl, $FullMenu->{$MenuUnit_hash_ref}[10]->[$spl];
3991             }
3992 0 0         my $send_select='Many' if $select_many;
3993             my $chosen={
3994             Select => $send_select,
3995             Banner => $MenuUnit_hash_ref->{Banner},
3996 0           }; my $cnt=0;
  0            
3997 0   0       my $hash_ref=$parent_menu||$MenuUnit_hash_ref;
3998 0           foreach my $text (@spl) {
3999 0           my $num=shift @splice;
4000 0           $cnt++;
4001 0           $chosen->{'Item_'.$cnt}=
4002             { Text => $text,Default => '*',__NUM__=>$num+1 };
4003             $chosen->{'Item_'.$cnt}{Result}=
4004 0           ${${$MenuUnit_hash_ref}{${${$FullMenu}
  0            
4005 0           {$MenuUnit_hash_ref}[4]}{$text}}}{'Result'}
  0            
4006 0           if exists ${${$MenuUnit_hash_ref}{${${$FullMenu}
  0            
4007 0 0         {$MenuUnit_hash_ref}[4]}{$text}}}{'Result'};
  0            
  0            
4008 0           $chosen->{'Item_'.$cnt}{Filter}=1;
4009             }
4010 0           %{$SavePick->{$chosen}}=%picks;
  0            
4011 0           $hidedefaults=1;
4012 0           eval {
4013 0           my ($ignore1,$ignore2,$ignore3)=('','','');
4014 0           ($menu_output,$FullMenu,$Selected,$Conveyed,$SavePick,
4015             $SaveMMap,$SaveNext,$Persists,$ignore1,$ignore2,
4016             $ignore3)
4017             =&Menu($chosen,$picks_from_parent,
4018             $recurse_level,$FullMenu,
4019             $Selected,$Conveyed,$SavePick,
4020             $SaveMMap,$SaveNext,$Persists,
4021             $MenuUnit_hash_ref,$no_wantarray);
4022             }; # MENU RETURN MENURETURN 3
4023 0 0         print "MENU RETURN 3\n" if $menu_return_debug;
4024 0 0         die $@ if $@;
4025 0 0         chomp($menu_output) if !(ref $menu_output);
4026 0 0         if ($menu_output eq '-') {
    0          
    0          
    0          
    0          
4027 0           %picks=%{$SavePick->{$MenuUnit_hash_ref}};
  0            
4028 0           $start=$FullMenu->{$MenuUnit_hash_ref}[11];
4029             } elsif ($menu_output eq '+') {
4030 0           %picks=%{$SavePick->{$MenuUnit_hash_ref}};
  0            
4031 0           $start=${$FullMenu}{$MenuUnit_hash_ref}[11];
  0            
4032             } elsif ($menu_output eq 'DONE_SUB') {
4033 0           return 'DONE_SUB';
4034             } elsif ($menu_output eq 'DONE') {
4035 0 0         if (1==$recurse_level) {
4036 0 0         my $subfile=substr($Term::Menus::fa_code,0,-3)
4037             .'::' if $Term::Menus::fa_code;
4038 0   0       $subfile||='';
4039 0           foreach my $sub (&get_subs_from_menu($Selected)) {
4040 0           my @resu=();
4041 0 0         if (ref $sub eq 'CODE') {
4042 0 0 0       if ($Term::Menus::fullauto && (!exists
      0        
      0        
4043             ${$MenuUnit_hash_ref}{'NoPlan'} ||
4044             !${$MenuUnit_hash_ref}{'NoPlan'}) &&
4045             defined $Net::FullAuto::FA_Core::makeplan) {
4046             #print "IN MAKEPLAN7\n";
4047 0 0 0       if (-1==$#{$Net::FullAuto::FA_Core::makeplan{
4048 0           'Plan'}} && !exists
4049             $Net::FullAuto::FA_Core::makeplan->{
4050             'Title'}) {
4051             $Net::FullAuto::FA_Core::makeplan->{'Title'}
4052 0           =$pn{$numbor}[0];
4053             }
4054 0           my $n='Number';
4055             push @{$Net::FullAuto::FA_Core::makeplan->{
4056 0           'Plan'}},
4057             { Menu => &pw($MenuUnit_hash_ref),
4058             Number => $numbor,
4059             PlanID =>
4060 0           $Net::FullAuto::FA_Core::makeplan->{$n},
4061             Item =>
4062             &Data::Dump::Streamer::Dump($sub)->Out() }
4063             }
4064 0           eval { @resu=$sub->() };
  0            
4065 0 0         if ($@) {
4066 0 0 0       if (10
4067             eq 'FATAL ERROR') {
4068 0 0 0       if ($parent_menu && wantarray && !$no_wantarray) {
      0        
4069 0           return '',$FullMenu,$Selected,$Conveyed,
4070             $SavePick,$SaveMMap,$SaveNext,
4071             $Persists,$parent_menu,$@;
4072             }
4073 0 0 0       if (defined $log_handle &&
4074             -1
4075 0           print $log_handle $@;
4076 0           close($log_handle);
4077             }
4078 0 0         if ($Term::Menus::fullauto) {
4079 0           &Net::FullAuto::FA_Core::handle_error($@);
4080 0           } else { die $@ }
4081             } else {
4082 0           my $die="\n FATAL ERROR! - The Local "
4083             ."System $Term::Menus::local_hostname "
4084             ."Conveyed\n"
4085             ." the Following "
4086             ."Unrecoverable Error Condition :\n\n"
4087             ." $@\n line ".__LINE__;
4088 0 0 0       if ($parent_menu && wantarray && !$no_wantarray) {
      0        
4089 0           return '',$FullMenu,$Selected,$Conveyed,
4090             $SavePick,$SaveMMap,$SaveNext,
4091             $Persists,$parent_menu,$die;
4092             }
4093 0 0 0       if (defined $log_handle &&
4094             -1
4095 0           print $log_handle $die;
4096 0           close($log_handle);
4097             }
4098 0 0         if ($Term::Menus::fullauto) {
4099 0           &Net::FullAuto::FA_Core::handle_error($die);
4100 0           } else { die $die }
4101             }
4102             }
4103 0 0         if (-1<$#resu) {
4104 0 0         if ($resu[0] eq '<') { %picks=();next }
  0            
  0            
4105 0 0 0       if (0<$#resu && wantarray && !$no_wantarray) {
      0        
4106 0           return @resu;
4107             } else {
4108 0           return return_result($resu[0],
4109             $MenuUnit_hash_ref,$Conveyed);
4110             }
4111             }
4112 0           $done=1;last
4113 0           }
4114 0           eval {
4115 0 0         if ($subfile) {
4116 0           $sub=~s/^[&]//;
4117 0 0 0       if ($Term::Menus::fullauto && (!exists
      0        
      0        
4118             ${$MenuUnit_hash_ref}{'NoPlan'} ||
4119             !${$MenuUnit_hash_ref}{'NoPlan'}) &&
4120             defined $Net::FullAuto::FA_Core::makeplan) {
4121             #print "IN MAKEPLAN8\n";
4122 0 0 0       if (-1==$#{$Net::FullAuto::FA_Core::makeplan{
4123 0           'Plan'}} && !exists
4124             $Net::FullAuto::FA_Core::makeplan->{
4125             'Title'}) {
4126             $Net::FullAuto::FA_Core::makeplan->{'Title'}
4127 0           =$pn{$numbor}[0];
4128             }
4129 0           my $n='Number';
4130             push @{$Net::FullAuto::FA_Core::makeplan->{
4131 0           'Plan'}},
4132             { Menu => &pw($MenuUnit_hash_ref),
4133             Number => $numbor,
4134             PlanID =>
4135 0           $Net::FullAuto::FA_Core::makeplan->{$n},
4136             Item => "&$subfile$sub" }
4137             }
4138 0           eval "\@resu=\&$subfile$sub";
4139 0   0       my $firsterr=$@||'';
4140 0 0 0       if ((-1
    0          
4141             (-1
4142 0 0         if ($sub!~/::/) {
4143 0           eval "\@resu=main::$sub";
4144             } else {
4145 0           eval "\@resu=$sub";
4146             }
4147 0   0       my $seconderr=$@||'';my $die='';
  0            
4148 0 0         if ($seconderr=~/Undefined subroutine/) {
4149 0 0         if (${$FullMenu}{$MenuUnit_hash_ref}
  0            
4150             [2]{$all_menu_items_array[$numbor-1]}) {
4151             $die="The \"Result15 =>\" Setting"
4152 0           ."\n\t\t-> " . ${$FullMenu}
4153             {$MenuUnit_hash_ref}[2]
4154             {$all_menu_items_array[$numbor-1]}
4155             ."\n\t\tFound in the Menu Unit -> "
4156 0           .$MenuUnit_hash_ref->{Name}."\n\t\t"
4157             ."Specifies a Subroutine"
4158             ." that Does NOT Exist"
4159             ."\n\t\tin the User Code File "
4160             .$Term::Menus::fa_code
4161             .",\n\t\tnor was a routine with "
4162             ."that name\n\t\tlocated in the"
4163             ." main:: script.\n";
4164 0           } else { $die="$firsterr\n $seconderr" }
4165 0           } else { $die=$seconderr }
4166 0           &Net::FullAuto::FA_Core::handle_error($die);
4167             } elsif ($firsterr) {
4168 0           &Net::FullAuto::FA_Core::handle_error($firsterr);
4169             }
4170             } else {
4171 0 0         if ($sub!~/::/) {
4172 0           $sub=~s/^[&]//;
4173 0           eval "\@resu=main::$sub";
4174             } else {
4175 0           eval "\@resu=$sub";
4176             }
4177 0 0         die $@ if $@;
4178             }
4179             };
4180 0 0         if ($@) {
4181 0 0 0       if (10
4182 0 0 0       if ($parent_menu && wantarray && !$no_wantarray) {
      0        
4183 0           return '',$FullMenu,$Selected,$Conveyed,
4184             $SavePick,$SaveMMap,$SaveNext,
4185             $Persists,$parent_menu,$@;
4186             }
4187 0 0 0       if (defined $log_handle &&
4188             -1
4189 0           print $log_handle $@;
4190 0           close($log_handle);
4191             }
4192 0 0         if ($Term::Menus::fullauto) {
4193 0           &Net::FullAuto::FA_Core::handle_error($@);
4194 0           } else { die $@ }
4195             } else {
4196 0           my $die="\n FATAL ERROR! - The Local "
4197             ."System $Term::Menus::local_hostname "
4198             ."Conveyed\n"
4199             ." the Following "
4200             ."Unrecoverable Error Condition :\n\n"
4201             ." $@\n line ".__LINE__;
4202 0 0 0       if ($parent_menu && wantarray && !$no_wantarray) {
      0        
4203 0           return '',$FullMenu,$Selected,$Conveyed,
4204             $SavePick,$SaveMMap,$SaveNext,
4205             $Persists,$parent_menu,$die;
4206             }
4207 0 0 0       if (defined $log_handle &&
4208             -1
4209 0           print $log_handle $die;
4210 0           close($log_handle);
4211             }
4212 0 0         if ($Term::Menus::fullauto) {
4213 0           &Net::FullAuto::FA_Core::handle_error($die);
4214 0           } else { die $die }
4215             }
4216             }
4217 0 0         if (-1<$#resu) {
4218 0 0         if ($resu[0] eq '<') { %picks=();next }
  0            
  0            
4219 0 0 0       if (0<$#resu && wantarray && !$no_wantarray) {
      0        
4220 0           return @resu;
4221             } else {
4222 0           return return_result($resu[0],
4223             $MenuUnit_hash_ref,$Conveyed);
4224             }
4225             }
4226             }
4227 0           return 'DONE_SUB';
4228 0           } else { return 'DONE' }
4229             } elsif ($menu_output) {
4230 0           return $menu_output;
4231             } else {
4232 0           %picks=%{$SavePick->{$MenuUnit_hash_ref}};
  0            
4233 0           $start=$FullMenu->{$MenuUnit_hash_ref}[11];
4234             }
4235             } elsif ($numbor=~/^\s*\/(.+)$/s) {
4236             ## SLASH SEARCH
4237 0 0         if ($filtered_menu) {
4238 0           print "\n WARNING!: ",
4239             "Only -ONE- Level of Search is Supported!\n";
4240 0           sleep 2;
4241 0           last;
4242             }
4243 0   0       my $one=$1||'';
4244 0           chomp $one;
4245 0           $one=~s/\*/[\*]/g;
4246 0           $one=~s/\+/[\+]/g;
4247 0 0         $one=qr/$one/ if $one;
4248 0           my @spl=();
4249 0           chomp $numbor;
4250 0           my $def='';
4251 0 0         unless (exists $Persists->{$MenuUnit_hash_ref}{defaults}) {
4252 0           my $it=${[keys %{${$FullMenu}{$MenuUnit_hash_ref}[5]}]}[0];
  0            
  0            
  0            
4253 0           $def=${$FullMenu}{$MenuUnit_hash_ref}[5]{$it};
  0            
4254 0 0         $def='.*' if $def eq '*';
4255 0 0         if ($def) {
4256 0           my $cnt=1;
4257 0           foreach my $item (sort
4258 0           @{[keys %{${$FullMenu}{$MenuUnit_hash_ref}[5]}]}) {
  0            
  0            
4259 0 0         if ($item=~/$def/) {
4260 0           $picks{$cnt}='*';
4261 0           } $cnt++
4262             }
4263             }
4264             }
4265            
4266 0           my $cnt=0;my $ct=0;my @splice=();
  0            
  0            
4267 0           foreach my $pik (@all_menu_items_array) {
4268 0           $cnt++;
4269 0 0         if ($pik=~/$one/s) {
4270 0           push @spl, $pik;
4271 0           $splice[$ct++]=$cnt;
4272             }
4273             }
4274 0 0         next if $#spl==-1;
4275 0 0         my $send_select='Many' if $select_many;
4276             my $chosen={
4277             Select => $send_select,
4278 0           Banner => ${$MenuUnit_hash_ref}{Banner},
4279 0           }; $cnt=0;
  0            
4280 0           foreach my $text (@spl) {
4281 0           my $num=$splice[$cnt];
4282 0           $cnt++;
4283 0 0 0       if (exists $picks{$num}) {
    0          
4284 0           $chosen->{'Item_'.$cnt}=
4285             { Text => $text,Default => '*',__NUM__=>$num };
4286             } elsif ($def && $text=~/$def/) {
4287 0           $chosen->{'Item_'.$cnt}=
4288             { Text => $text,Default => '*',__NUM__=>$num };
4289 0           $picks{$num}='*';
4290             } else {
4291 0           $chosen->{'Item_'.$cnt}=
4292             { Text => $text,__NUM__=>$num };
4293             }
4294             $chosen->{'Item_'.$cnt}{Result}=
4295 0           ${${$MenuUnit_hash_ref}{${$FullMenu->
4296 0           {$MenuUnit_hash_ref}[4]}{$text}}}{'Result'}
  0            
4297 0           if exists ${${$MenuUnit_hash_ref}{${$FullMenu->
4298 0 0         {$MenuUnit_hash_ref}[4]}{$text}}}{'Result'};
  0            
  0            
4299 0           $chosen->{'Item_'.$cnt}{Filter}=1;
4300             }
4301 0           %{$SavePick->{$chosen}}=%picks;
  0            
4302 0           my @return_from_filtered_menu=();
4303 0           eval {
4304 0           ($menu_output,$FullMenu,$Selected,$Conveyed,$SavePick,
4305             $SaveMMap,$SaveNext,$Persists,
4306             @return_from_filtered_menu)=&Menu(
4307             $chosen,$picks_from_parent,
4308             $recurse_level,$FullMenu,
4309             $Selected,$Conveyed,$SavePick,
4310             $SaveMMap,$SaveNext,$Persists,
4311             $MenuUnit_hash_ref,$no_wantarray);
4312             }; # MENU RETURN MENURETURN 4
4313 0 0         print "MENU RETURN 4\n" if $menu_return_debug;
4314 0 0         die $@ if $@;
4315 0 0         if (-1<$#return_from_filtered_menu) {
4316 0 0         if ((values %{$menu_output})[0] eq 'recurse') {
  0            
4317 0           my %k=%{$menu_output};
  0            
4318 0           delete $k{Menu};
4319 0           my $lab=(keys %k)[0];
4320 0           $menu_output=$labels{$lab};
4321             }
4322 0           $MenuMap=$Persists->{$MenuUnit_hash_ref};
4323 0           eval {
4324 0           ($menu_output,$FullMenu,$Selected,$Conveyed,$SavePick,
4325             $SaveMMap,$SaveNext,$Persists)=&Menu(
4326             $menu_output,$FullMenu,
4327             $Selected,$Conveyed,$SavePick,
4328             $SaveMMap,$SaveNext,$Persists,
4329             $return_from_filtered_menu[0],
4330             $MenuUnit_hash_ref,
4331             $return_from_filtered_menu[2]);
4332             }; # MENU RETURN MENURETURN 5
4333 0 0         print "MENU RETURN 5\n" if $menu_return_debug;
4334 0 0         die $@ if $@;
4335             }
4336 0 0         chomp($menu_output) if !(ref $menu_output);
4337 0 0 0       if (($menu_output eq '-') && exists
    0 0        
    0          
    0          
    0          
    0          
    0          
4338             $SavePick->{$MenuUnit_hash_ref}) {
4339 0           %picks=%{$SavePick->{$MenuUnit_hash_ref}};
  0            
4340 0           $start=$FullMenu->{$MenuUnit_hash_ref}[11];
4341             } elsif ($menu_output eq '+' && exists
4342             $SavePick->{$MenuUnit_hash_ref}) {
4343 0           %picks=%{$SavePick->{$MenuUnit_hash_ref}};
  0            
4344 0           $start=$FullMenu->{$MenuUnit_hash_ref}[11];
4345             } elsif ($menu_output eq 'DONE_SUB') {
4346 0           return 'DONE_SUB';
4347             } elsif ($menu_output eq 'DONE') {
4348 0 0         if (1==$recurse_level) {
4349 0 0         my $subfile=substr($Term::Menus::fa_code,0,-3)
4350             .'::' if $Term::Menus::fa_code;
4351 0   0       $subfile||='';
4352 0           foreach my $sub (&get_subs_from_menu($Selected)) {
4353 0           my @resu=();
4354 0 0         if (ref $sub eq 'CODE') {
4355 0 0 0       if ($Term::Menus::fullauto && (!exists
      0        
      0        
4356             $MenuUnit_hash_ref->{'NoPlan'} ||
4357             !$MenuUnit_hash_ref->{'NoPlan'}) &&
4358             defined $Net::FullAuto::FA_Core::makeplan) {
4359             #print "IN MAKEPLAN9\n";
4360 0 0 0       if (-1==$#{$Net::FullAuto::FA_Core::makeplan{
4361 0           'Plan'}} && !exists
4362             $Net::FullAuto::FA_Core::makeplan->{
4363             'Title'}) {
4364             $Net::FullAuto::FA_Core::makeplan->{'Title'}
4365 0           =$pn{$numbor}[0];
4366             }
4367 0           my $n='Number';
4368             push @{$Net::FullAuto::FA_Core::makeplan->{
4369 0           'Plan'}},
4370             { Menu => &pw($MenuUnit_hash_ref),
4371             Number => $numbor,
4372             PlanID =>
4373 0           $Net::FullAuto::FA_Core::makeplan->{$n},
4374             Item =>
4375             &Data::Dump::Streamer::Dump($sub)->Out() }
4376             }
4377 0           eval { @resu=$sub->() };
  0            
4378 0 0         if ($@) {
4379 0 0 0       if (10
4380             'FATAL ERROR') {
4381 0 0 0       if ($parent_menu && wantarray && !$no_wantarray) {
      0        
4382 0           return '',$FullMenu,$Selected,$Conveyed,
4383             $SavePick,$SaveMMap,$SaveNext,
4384             $Persists,$parent_menu,$@;
4385             }
4386 0 0 0       if (defined $log_handle &&
4387             -1
4388 0           print $log_handle $@;
4389 0           close($log_handle);
4390             }
4391 0 0         if ($Term::Menus::fullauto) {
4392 0           &Net::FullAuto::FA_Core::handle_error($@);
4393 0           } else { die $@ }
4394             } else {
4395 0           my $die="\n FATAL ERROR! - The Local "
4396             ."System $Term::Menus::local_hostname "
4397             ."Conveyed\n"
4398             ." the Following "
4399             ."Unrecoverable Error Condition :\n\n"
4400             ." $@\n line ".__LINE__;
4401 0 0 0       if ($parent_menu && wantarray && !$no_wantarray) {
      0        
4402 0           return '',$FullMenu,$Selected,$Conveyed,
4403             $SavePick,$SaveMMap,$SaveNext,
4404             $Persists,$parent_menu,$die;
4405             }
4406 0 0 0       if (defined $log_handle &&
4407             -1
4408 0           print $log_handle $die;
4409 0           close($log_handle);
4410             }
4411 0 0         if ($Term::Menus::fullauto) {
4412 0           &Net::FullAuto::FA_Core::handle_error($die);
4413 0           } else { die $die }
4414             }
4415             }
4416 0 0         if (-1<$#resu) {
4417 0 0         if ($resu[0] eq '<') { %picks=();next }
  0            
  0            
4418 0 0 0       if (0<$#resu && wantarray && !$no_wantarray) {
      0        
4419 0           return @resu;
4420             } else {
4421 0           return return_result($resu[0],
4422             $MenuUnit_hash_ref,$Conveyed);
4423             }
4424             }
4425 0           $done=1;last
4426 0           }
4427 0           eval {
4428 0 0         if ($subfile) {
4429 0           $sub=~s/^[&]//;
4430 0 0 0       if ($Term::Menus::fullauto && (!exists
      0        
      0        
4431             $MenuUnit_hash_ref->{'NoPlan'} ||
4432             !$MenuUnit_hash_ref->{'NoPlan'}) &&
4433             defined $Net::FullAuto::FA_Core::makeplan) {
4434             #print "IN MAKEPLAN10\n";
4435 0 0 0       if (-1==$#{$Net::FullAuto::FA_Core::makeplan{
4436 0           'Plan'}} && !exists
4437             $Net::FullAuto::FA_Core::makeplan->{
4438             'Title'}) {
4439             $Net::FullAuto::FA_Core::makeplan->{'Title'}
4440 0           =$pn{$numbor}[0];
4441             }
4442 0           my $n='Number';
4443             push @{$Net::FullAuto::FA_Core::makeplan->{
4444 0           'Plan'}},
4445             { Menu => &pw($MenuUnit_hash_ref),
4446             Number => $numbor,
4447             PlanID =>
4448 0           $Net::FullAuto::FA_Core::makeplan->{$n},
4449             Item => "&$subfile$sub" }
4450             }
4451 0           eval "\@resu=\&$subfile$sub";
4452 0   0       my $firsterr=$@||'';
4453 0 0 0       if ((-1
    0          
4454             (-1
4455 0 0         if ($sub!~/::/) {
4456 0           eval "\@resu=main::$sub";
4457             } else {
4458 0           eval "\@resu=$sub";
4459             }
4460 0   0       my $seconderr=$@||'';my $die='';
  0            
4461 0 0         if ($seconderr=~/Undefined subroutine/) {
4462 0 0         if (${$FullMenu}{$MenuUnit_hash_ref}
  0            
4463             [2]{$all_menu_items_array[$numbor-1]}) {
4464             $die="The \"Result15 =>\" Setting"
4465 0           ."\n\t\t-> " . ${$FullMenu}
4466             {$MenuUnit_hash_ref}[2]
4467             {$all_menu_items_array[$numbor-1]}
4468             ."\n\t\tFound in the Menu Unit -> "
4469 0           .$MenuUnit_hash_ref->{Name}."\n\t\t"
4470             ."Specifies a Subroutine"
4471             ." that Does NOT Exist"
4472             ."\n\t\tin the User Code File "
4473             .$Term::Menus::fa_code
4474             .",\n\t\tnor was a routine with "
4475             ."that name\n\t\tlocated in the"
4476             ." main:: script.\n";
4477 0           } else { $die="$firsterr\n $seconderr" }
4478 0           } else { $die=$seconderr }
4479 0           &Net::FullAuto::FA_Core::handle_error($die);
4480             } elsif ($firsterr) {
4481 0           &Net::FullAuto::FA_Core::handle_error($firsterr);
4482             }
4483             } else {
4484 0 0         if ($sub!~/::/) {
4485 0           $sub=~s/^[&]//;
4486 0           eval "\@resu=main::$sub";
4487             } else {
4488 0           eval "\@resu=$sub";
4489             }
4490 0 0         die $@ if $@;
4491             }
4492             };
4493 0 0         if ($@) {
4494 0 0 0       if (10
4495 0 0 0       if ($parent_menu && wantarray && !$no_wantarray) {
      0        
4496 0           return '',$FullMenu,$Selected,$Conveyed,
4497             $SavePick,$SaveMMap,$SaveNext,
4498             $Persists,$parent_menu,$@;
4499             }
4500 0 0 0       if (defined $log_handle &&
4501             -1
4502 0           print $log_handle $@;
4503 0           close($log_handle);
4504             }
4505 0 0         if ($Term::Menus::fullauto) {
4506 0           &Net::FullAuto::FA_Core::handle_error($@);
4507 0           } else { die $@ }
4508             } else {
4509 0           my $die="\n FATAL ERROR! - The Local "
4510             ."System $Term::Menus::local_hostname "
4511             ."Conveyed\n"
4512             ." the Following "
4513             ."Unrecoverable Error Condition :\n\n"
4514             ." $@\n line ".__LINE__;
4515 0 0 0       if ($parent_menu && wantarray && !$no_wantarray) {
      0        
4516 0           return '',$FullMenu,$Selected,$Conveyed,
4517             $SavePick,$SaveMMap,$SaveNext,
4518             $Persists,$parent_menu,$die;
4519             }
4520 0 0 0       if (defined $log_handle &&
4521             -1
4522 0           print $log_handle $die;
4523 0           close($log_handle);
4524             }
4525 0 0         if ($Term::Menus::fullauto) {
4526 0           &Net::FullAuto::FA_Core::handle_error($die);
4527 0           } else { die $die }
4528             }
4529             }
4530 0 0         if (-1<$#resu) {
4531 0 0         if ($resu[0] eq '<') { %picks=();next }
  0            
  0            
4532 0 0 0       if (0<$#resu && wantarray && !$no_wantarray) {
      0        
4533 0           return @resu;
4534             } else {
4535 0           return return_result($resu[0],
4536             $MenuUnit_hash_ref,$Conveyed);
4537             }
4538             }
4539             }
4540 0           return 'DONE_SUB';
4541 0           } else { return 'DONE' }
4542             } elsif ($menu_output eq '-') {
4543 0           $return_from_child_menu='-';
4544             } elsif ($menu_output eq '+') {
4545 0           $return_from_child_menu='+';
4546             } elsif ($menu_output) {
4547 0           return $menu_output;
4548             }
4549             } elsif (($numbor=~/^\
4550 0 0         if ($recurse_level==1) {
    0          
4551 0           print "\n WARNING! - You are at the First Menu!\n";
4552 0           sleep 2;
4553 0           } elsif (grep { /\+|\*/ } values %picks) {
4554 0           return '+',
4555             $FullMenu,$Selected,$Conveyed,
4556             $SavePick,$SaveMMap,$SaveNext,
4557             $Persists;
4558             } else {
4559 0           my %sp_copy=%{$SavePick->{$parent_menu}}
4560 0 0         if exists $SavePick->{$parent_menu};
4561 0           foreach my $key (keys %sp_copy) {
4562             $SavePick->{$parent_menu}->{$key}='-' if
4563 0 0         $sp_copy{$key} eq '+';
4564             }
4565 0   0       $parent_menu->{Scroll}->[1]||=0;
4566 0   0       $main::maintain_scroll_flag||={};
4567 0 0 0       if ($parent_menu->{Scroll}->[1]>1 &&
4568             !exists $main::maintain_scroll_flag->{$parent_menu}) {
4569 0           --$parent_menu->{Scroll}->[1];
4570 0           $main::maintain_scroll_flag->{$parent_menu}='';
4571             }
4572 0           return '-',
4573             $FullMenu,$Selected,$Conveyed,
4574             $SavePick,$SaveMMap,$SaveNext,
4575             $Persists;
4576 0           } last;
4577             } elsif (($numbor=~/^\>/ || $ikey eq 'RIGHTARROW') && exists
4578             $SaveNext->{$MenuUnit_hash_ref} &&
4579             ((grep { /-|\+/ } values %picks) || $show_banner_only)) {
4580 0           $MenuMap=$SaveMMap->{$MenuUnit_hash_ref};
4581 0           my $returned_FullMenu='';
4582 0           my $returned_Selected='';
4583 0           my $returned_Conveyed='';
4584 0           my $returned_SavePick='';
4585 0           my $returned_SaveMMap='';
4586 0           my $returned_SaveNext='';
4587 0           my $returned_Persists='';
4588 0           my $menu_result='';
4589 0 0         if (exists $Selected->{$MenuUnit_hash_ref}
4590             {'__FA_Banner__'}) {
4591             $menu_result=$Selected->{$MenuUnit_hash_ref}
4592 0           {'__FA_Banner__'};
4593 0 0         $menu_result=$menu_result->() if ref
4594             $menu_result eq 'CODE';
4595             } else {
4596             $menu_result=$FullMenu->{$MenuUnit_hash_ref}[2]
4597 0           {$all_menu_items_array[(keys %{$SavePick->
4598 0           {$MenuUnit_hash_ref}})[0]-1]};
4599             }
4600 0           eval {
4601 0           ($menu_output,$returned_FullMenu,
4602             $returned_Selected,$returned_Conveyed,
4603             $returned_SavePick,$returned_SaveMMap,
4604             $returned_SaveNext,$returned_Persists)
4605             =&Menu($menu_result,$convey,
4606             $recurse_level,$FullMenu,
4607             $Selected,$Conveyed,$SavePick,
4608             $SaveMMap,$SaveNext,$Persists,
4609             $MenuUnit_hash_ref,$no_wantarray);
4610             }; # MENU RETURN MENURETURN 6
4611 0 0         print "MENU RETURN 6\n" if $menu_return_debug;
4612 0 0         die $@ if $@;
4613 0 0         chomp($menu_output) if !(ref $menu_output);
4614 0 0 0       if (ref $menu_output eq 'ARRAY' &&
4615             $menu_output->[0]=~/^[{](.*)[}][<]$/) {
4616 0           delete $Selected->{$MenuUnit_hash_ref};
4617 0           delete $Conveyed->{$MenuUnit_hash_ref};
4618 0           delete $SavePick->{$MenuUnit_hash_ref};
4619 0           delete $SaveMMap->{$MenuUnit_hash_ref};
4620 0           delete $SaveNext->{$MenuUnit_hash_ref};
4621 0           delete $Persists->{$MenuUnit_hash_ref};
4622 0 0         if ($1 eq $MenuUnit_hash_ref->{Name}) {
4623             delete $FullMenu->{$MenuUnit_hash_ref}[2]
4624 0           {'__FA_Banner__'};
4625 0           %picks=();
4626 0           next;
4627             } else {
4628 0           delete $FullMenu->{$MenuUnit_hash_ref};
4629 0           return $menu_output,
4630             $FullMenu,$Selected,$Conveyed,
4631             $SavePick,$SaveMMap,$SaveNext,
4632             $Persists;
4633             }
4634             } else {
4635 0           $FullMenu=$returned_FullMenu;
4636 0           $Selected=$returned_Selected;
4637 0           $Conveyed=$returned_Conveyed;
4638 0           $SavePick=$returned_SavePick;
4639 0           $SaveMMap=$returned_SaveMMap;
4640 0           $SaveNext=$returned_SaveNext;
4641 0           $Persists=$returned_Persists;
4642             }
4643 0 0         if ($menu_output eq 'DONE_SUB') {
    0          
    0          
    0          
    0          
4644 0           return 'DONE_SUB';
4645             } elsif ($menu_output eq 'DONE') {
4646 0 0         if (1==$recurse_level) {
4647 0 0 0       if ($Term::Menus::fullauto && (!exists
      0        
      0        
4648             $MenuUnit_hash_ref->{'NoPlan'} ||
4649             !$MenuUnit_hash_ref->{'NoPlan'}) &&
4650             defined $Net::FullAuto::FA_Core::makeplan) {
4651             #print "IN MAKEPLAN11\n";
4652 0 0 0       if (-1==$#{$Net::FullAuto::FA_Core::makeplan{'Plan'}} &&
  0            
4653             !exists $Net::FullAuto::FA_Core::makeplan->{
4654             'Title'}) {
4655             $Net::FullAuto::FA_Core::makeplan->{'Title'}
4656 0           =$pn{$numbor}[0];
4657             }
4658 0 0         unless ($got_default) {
4659 0           push @{$Net::FullAuto::FA_Core::makeplan->{'Plan'}},
4660             { Menu => &pw($MenuUnit_hash_ref),
4661             Number => $numbor,
4662             PlanID =>
4663             $Net::FullAuto::FA_Core::makeplan->{Number},
4664 0           Item => $pn{$numbor}[0] }
4665             }
4666             }
4667 0 0         my $subfile=substr($Term::Menus::fa_code,0,-3)
4668             .'::' if $Term::Menus::fa_code;
4669 0   0       $subfile||='';
4670 0           foreach my $sub (&get_subs_from_menu($Selected)) {
4671 0           my @resu=();
4672 0 0         if (ref $sub eq 'CODE') {
4673 0 0 0       if ($Term::Menus::fullauto && (!exists
      0        
      0        
4674             ${$MenuUnit_hash_ref}{'NoPlan'} ||
4675             !${$MenuUnit_hash_ref}{'NoPlan'}) &&
4676             defined $Net::FullAuto::FA_Core::makeplan) {
4677             #print "IN MAKEPLAN12\n";
4678 0 0 0       if (-1==$#{$Net::FullAuto::FA_Core::makeplan{
4679 0           'Plan'}} && !exists
4680             $Net::FullAuto::FA_Core::makeplan->{
4681             'Title'}) {
4682             $Net::FullAuto::FA_Core::makeplan->{'Title'}
4683 0           =$pn{$numbor}[0];
4684             }
4685 0           my $n='Number';
4686             push @{$Net::FullAuto::FA_Core::makeplan->{
4687 0           'Plan'}},
4688             { Menu => &pw($MenuUnit_hash_ref),
4689             Number => $numbor,
4690             PlanID =>
4691 0           $Net::FullAuto::FA_Core::makeplan->{$n},
4692             Item =>
4693             &Data::Dump::Streamer::Dump($sub)->Out() }
4694             }
4695 0           eval { @resu=$sub->() };
  0            
4696 0 0         if ($@) {
4697 0 0 0       if (10
4698             eq 'FATAL ERROR') {
4699 0 0 0       if ($parent_menu && wantarray && !$no_wantarray) {
      0        
4700 0           return '',$FullMenu,$Selected,$Conveyed,
4701             $SavePick,$SaveMMap,$SaveNext,
4702             $Persists,$parent_menu,$@;
4703             }
4704 0 0 0       if (defined $log_handle &&
4705             -1
4706 0           print $log_handle $@;
4707 0           close($log_handle);
4708             }
4709 0 0         if ($Term::Menus::fullauto) {
4710 0           &Net::FullAuto::FA_Core::handle_error($@);
4711 0           } else { die $@ }
4712             } else {
4713 0           my $die="\n FATAL ERROR! - The Local "
4714             ."System $Term::Menus::local_hostname "
4715             ."Conveyed\n"
4716             ." the Following "
4717             ."Unrecoverable Error Condition :\n\n"
4718             ." $@\n line ".__LINE__;
4719 0 0 0       if ($parent_menu && wantarray && !$no_wantarray) {
      0        
4720 0           return '',$FullMenu,$Selected,$Conveyed,
4721             $SavePick,$SaveMMap,$SaveNext,
4722             $Persists,$parent_menu,$die;
4723             }
4724 0 0 0       if (defined $log_handle &&
4725             -1
4726 0           print $log_handle $die;
4727 0           close($log_handle);
4728             }
4729 0 0         if ($Term::Menus::fullauto) {
4730 0           &Net::FullAuto::FA_Core::handle_error($die);
4731 0           } else { die $die }
4732             }
4733             }
4734 0 0         if (-1<$#resu) {
4735 0 0         if ($resu[0] eq '<') { %picks=();next }
  0            
  0            
4736 0 0 0       if (0<$#resu && wantarray && !$no_wantarray) {
      0        
4737 0           return @resu;
4738             } else {
4739 0           return return_result($resu[0],
4740             $MenuUnit_hash_ref,$Conveyed);
4741             }
4742             }
4743 0           $done=1;last
4744 0           }
4745 0           eval {
4746 0 0         if ($subfile) {
4747 0           $sub=~s/^[&]//;
4748 0 0 0       if ($Term::Menus::fullauto && (!exists
      0        
      0        
4749             ${$MenuUnit_hash_ref}{'NoPlan'} ||
4750             !${$MenuUnit_hash_ref}{'NoPlan'}) &&
4751             defined $Net::FullAuto::FA_Core::makeplan) {
4752             #print "IN MAKEPLAN13\n";
4753 0 0 0       if (-1==$#{$Net::FullAuto::FA_Core::makeplan{
4754 0           'Plan'}} && !exists
4755             $Net::FullAuto::FA_Core::makeplan->{
4756             'Title'}) {
4757             $Net::FullAuto::FA_Core::makeplan->{'Title'}
4758 0           =$pn{$numbor}[0];
4759             }
4760 0           my $n='Number';
4761             push @{$Net::FullAuto::FA_Core::makeplan->{
4762 0           'Plan'}},
4763             { Menu => &pw($MenuUnit_hash_ref),
4764             Number => $numbor,
4765             PlanID =>
4766 0           $Net::FullAuto::FA_Core::makeplan->{$n},
4767             Item => "&$subfile$sub" }
4768             }
4769 0           eval "\@resu=\&$subfile$sub";
4770 0   0       my $firsterr=$@||'';
4771 0 0 0       if ((-1
    0          
4772             (-1
4773 0 0         if ($sub!~/::/) {
4774 0           eval "\@resu=main::$sub";
4775             } else {
4776 0           eval "\@resu=$sub";
4777             }
4778 0   0       my $seconderr=$@||'';my $die='';
  0            
4779 0 0         if ($seconderr=~/Undefined subroutine/) {
4780 0 0         if (${$FullMenu}{$MenuUnit_hash_ref}
  0            
4781             [2]{$all_menu_items_array[$numbor-1]}) {
4782             $die="The \"Result15 =>\" Setting"
4783 0           ."\n\t\t-> " . ${$FullMenu}
4784             {$MenuUnit_hash_ref}[2]
4785             {$all_menu_items_array[$numbor-1]}
4786             ."\n\t\tFound in the Menu Unit -> "
4787 0           .$MenuUnit_hash_ref->{Name}."\n\t\t"
4788             ."Specifies a Subroutine"
4789             ." that Does NOT Exist"
4790             ."\n\t\tin the User Code File "
4791             .$Term::Menus::fa_code
4792             .",\n\t\tnor was a routine with "
4793             ."that name\n\t\tlocated in the"
4794             ." main:: script.\n";
4795 0           } else { $die="$firsterr\n $seconderr" }
4796 0           } else { $die=$seconderr }
4797 0           &Net::FullAuto::FA_Core::handle_error($die);
4798             } elsif ($firsterr) {
4799 0           &Net::FullAuto::FA_Core::handle_error($firsterr);
4800             }
4801             } else {
4802 0 0         if ($sub!~/::/) {
4803 0           $sub=~s/^[&]//;
4804 0           eval "\@resu=main::$sub";
4805             } else {
4806 0           eval "\@resu=$sub";
4807             }
4808 0 0         die $@ if $@;
4809             }
4810             };
4811 0 0         if ($@) {
4812 0 0 0       if (10
4813 0 0 0       if ($parent_menu && wantarray && !$no_wantarray) {
      0        
4814 0           return '',$FullMenu,$Selected,$Conveyed,
4815             $SavePick,$SaveMMap,$SaveNext,
4816             $Persists,$parent_menu,$@;
4817             }
4818 0 0 0       if (defined $log_handle &&
4819             -1
4820 0           print $log_handle $@;
4821 0           close($log_handle);
4822             }
4823 0 0         if ($Term::Menus::fullauto) {
4824 0           &Net::FullAuto::FA_Core::handle_error($@);
4825 0           } else { die $@ }
4826             } else {
4827 0           my $die="\n FATAL ERROR! - The Local "
4828             ."System $Term::Menus::local_hostname "
4829             ."Conveyed\n"
4830             ." the Following "
4831             ."Unrecoverable Error Condition :\n\n"
4832             ." $@\n line ".__LINE__;
4833 0 0 0       if ($parent_menu && wantarray && !$no_wantarray) {
      0        
4834 0           return '',$FullMenu,$Selected,$Conveyed,
4835             $SavePick,$SaveMMap,$SaveNext,
4836             $Persists,$parent_menu,$die;
4837             }
4838 0 0 0       if (defined $log_handle &&
4839             -1
4840 0           print $log_handle $die;
4841 0           close($log_handle);
4842             }
4843 0 0         if ($Term::Menus::fullauto) {
4844 0           &Net::FullAuto::FA_Core::handle_error($die);
4845 0           } else { die $die }
4846             }
4847             }
4848 0 0         if (-1<$#resu) {
4849 0 0         if ($resu[0] eq '<') { %picks=();next }
  0            
  0            
4850 0 0 0       if (0<$#resu && wantarray && !$no_wantarray) {
      0        
4851 0           return @resu;
4852             } else {
4853 0           return return_result($resu[0],
4854             $MenuUnit_hash_ref,$Conveyed);
4855             }
4856             }
4857             }
4858 0           return 'DONE_SUB';
4859 0           } else { return 'DONE' }
4860             } elsif ($menu_output eq '-') {
4861 0           $return_from_child_menu='-';
4862             } elsif ($menu_output eq '+') {
4863 0           $return_from_child_menu='+';
4864             } elsif ($menu_output) {
4865 0           return $menu_output;
4866             }
4867             } elsif ($ikey eq 'ESC' || $numbor=~/^quit|exit|bye$/i) {
4868 0 0         print "\n" if $^O ne 'cygwin';
4869 0           return ']quit['
4870             } elsif ($Term::Menus::fullauto and $ikey eq 'F1' ||
4871             $numbor=~/^help$/i) {
4872 0           system('man Net::FullAuto');
4873             } elsif ($ikey eq 'F1' || $numbor=~/^help$/i) {
4874 0           system('man Term::Menus');
4875             } elsif ($Term::Menus::fullauto and $numbor=~/^admin$/i) {
4876 0 0         if (!exists $Net::FullAuto::FA_Core::admin_menus{
4877             &pw($MenuUnit_hash_ref)}) {
4878 0           while (1) {
4879 0 0         my @menu_output=Menu($Net::FullAuto::FA_Core::admin_menu->())
4880             if $Net::FullAuto::FA_Core::admin_menu;
4881 0 0 0       last if $menu_output[0] ne '-' && $menu_output[0] ne '+';
4882             }
4883             } else {
4884 0           return ['{admin}<'],$FullMenu,$Selected,$Conveyed,
4885             $SavePick,$SaveMMap,$SaveNext,$Persists;
4886             }
4887 0           } elsif (!keys %{$FullMenu->{$MenuUnit_hash_ref}[1]}
4888             && $numbor=~/^[Aa]$/) {
4889 0 0 0       if (!$select_many && !(keys %{$MenuUnit_hash_ref->{Select}})) {
  0            
4890 0           print "\n ERROR: Cannot Select All Items\n".
4891             " When 'Select' is NOT set to 'Many'\n";
4892 0           sleep 2;next;
  0            
4893             }
4894 0 0         if ($filtered_menu) {
4895 0           foreach my $num (0..$#all_menu_items_array) {
4896 0           $picks{$num+1}='*';
4897             }
4898 0           foreach my $key (keys %{$FullMenu->{$MenuUnit_hash_ref}[8]}) {
  0            
4899             $SavePick->{$parent_menu}{$FullMenu->
4900 0           {$MenuUnit_hash_ref}[8]{$key}}='*';
4901             }
4902             } else {
4903 0           my $nmp=$num_pick-1;
4904 0           foreach my $pck (0..$nmp) {
4905 0 0 0       if ($select_many ||
4906             exists $FullMenu->{$MenuUnit_hash_ref}[6]->{
4907             $all_menu_items_array[$pck]}) {
4908 0           $picks{$pck+1}='*'
4909             }
4910             }
4911             }
4912             } elsif ($numbor=~/^[Cc]$/) {
4913             ## CLEAR ALL CLEARALL
4914 0           foreach my $key (keys %{${$FullMenu}{$MenuUnit_hash_ref}[8]}) {
  0            
  0            
4915 0           delete ${$SavePick}{$parent_menu}{${$FullMenu}
  0            
4916 0           {$MenuUnit_hash_ref}[8]{$key}};
4917             }
4918 0           foreach my $pick (keys %picks) {
4919 0 0         if (exists $picks{$pick}) {
4920 0           delete $picks{$pick};
4921 0           delete $items{$pick};
4922 0           delete $Selected->{$MenuUnit_hash_ref}{$pick};
4923 0           delete $Selected->{$parent_menu}{$pick};
4924 0           delete $SavePick->{$MenuUnit_hash_ref}{$pick};
4925 0           delete $SavePick->{$parent_menu}{$pick};
4926 0           delete $SaveNext->{$MenuUnit_hash_ref};
4927             }
4928 0           } $FullMenu->{$parent_menu}[5]='';
4929 0           $return_from_child_menu=0;
4930 0           $Persists->{$MenuUnit_hash_ref}{defaults}=0;
4931 0 0         $Persists->{$parent_menu}{defaults}=0 if defined $parent_menu;
4932             }
4933 0 0 0       if ($numbor=~/^u$/i || $ikey eq 'UPARROW' || $ikey eq 'PAGEUP') {
    0 0        
    0 0        
    0 0        
    0 0        
      0        
      0        
      0        
      0        
4934 0 0 0       if ($ikey ne 'PAGEUP' && exists $MenuUnit_hash_ref->{Scroll}
    0 0        
4935             && $MenuUnit_hash_ref->{Scroll}) {
4936             $MenuUnit_hash_ref->{Scroll}->[1]-- if
4937 0 0         $MenuUnit_hash_ref->{Scroll}->[1]!=1;
4938 0           my $remainder=0;my $curscreennum=0;
  0            
4939 0 0         $remainder=$num_pick % $display_this_many_items if $num_pick;
4940 0 0         $curscreennum=($start+$remainder==$num_pick)?
4941             $start+$remainder:$start+$choose_num;
4942 0 0 0       if ($curscreennum-$remainder==
    0          
4943             $MenuUnit_hash_ref->{Scroll}->[1] &&
4944             $curscreennum==$num_pick) {
4945 0           $start=$start-$display_this_many_items;
4946 0           $FullMenu->{$MenuUnit_hash_ref}[11]=$start;
4947             } elsif ($start==$MenuUnit_hash_ref->{Scroll}->[1]) {
4948 0 0 0       if ($display_this_many_items<$num_pick-$start
      0        
      0        
      0        
4949             || $remainder || (!$remainder &&
4950             (($num_pick==$start+1) ||
4951             ($num_pick==$start+$display_this_many_items)))) {
4952 0           $start=$start-$display_this_many_items;
4953 0           $FullMenu->{$MenuUnit_hash_ref}[11]=$start;
4954             }
4955 0           } else { next }
4956 0           $numbor=$start+$choose_num+1;
4957 0           $hidedefaults=0;
4958 0           last;
4959             } elsif (0<=$start-$display_this_many_items) {
4960 0           $start=$start-$display_this_many_items;
4961             $MenuUnit_hash_ref->{Scroll}->[1]=
4962             $start+$display_this_many_items
4963             if $ikey eq 'PAGEUP' &&
4964             exists $MenuUnit_hash_ref->{Scroll}
4965 0 0 0       && $MenuUnit_hash_ref->{Scroll};
      0        
4966 0           $FullMenu->{$MenuUnit_hash_ref}[11]=$start;
4967             } else {
4968 0           $start=$FullMenu->{$MenuUnit_hash_ref}[11]=0;
4969             }
4970 0           $numbor=$start+$choose_num+1;
4971 0           $hidedefaults=0;
4972 0           last;
4973             } elsif ($ikey eq 'END') {
4974 0           $FullMenu->{$MenuUnit_hash_ref}[11]=$num_pick;
4975             $MenuUnit_hash_ref->{Scroll}->[1]=$num_pick if
4976             $MenuUnit_hash_ref->{Scroll} &&
4977 0 0 0       $MenuUnit_hash_ref->{Scroll};
4978 0           $hidedefaults=0;
4979 0 0         if ($num_pick==$start+$choose_num) {
4980 0           next;
4981             }
4982 0           my $remainder=$num_pick % $choose_num;
4983 0 0         if ($remainder) {
4984 0           $start=$num_pick-$remainder;
4985             } else {
4986 0           $start=$num_pick-$display_this_many_items;
4987             }
4988 0           last;
4989             } elsif ($ikey eq 'HOME') {
4990 0           $FullMenu->{$MenuUnit_hash_ref}[11]=0;
4991             $MenuUnit_hash_ref->{Scroll}->[1]=1 if
4992             $MenuUnit_hash_ref->{Scroll} &&
4993 0 0 0       $MenuUnit_hash_ref->{Scroll};
4994 0           $hidedefaults=0;
4995 0           $start=0;
4996 0           last;
4997             } elsif ($numbor && unpack('a1',$numbor) eq '!') {
4998             # SHELLOUT shellout
4999 0   0       my $username=getlogin || getpwuid($<);
5000 0           my $cmd=unpack('x1 a*',$numbor);
5001 0           print "\n";
5002 0 0         unless ($^O eq 'cygwin') {
5003 0           system("su -l -c$cmd $username");
5004             } else {
5005 0           system($cmd);
5006             }
5007 0           print "\nPress ENTER to continue";;
  0            
5008 0           next;
5009             } elsif (((!$ikey || $ikey eq 'ENTER') &&
5010             ($numbor=~/^()$/ || $numbor=~/^\n/)) || $numbor=~/^d$/i
5011             || $ikey eq 'DOWNARROW' || $ikey eq 'PAGEDOWN') {
5012 0   0       $ikey||='ENTER';
5013 0 0         delete $main::maintain_scroll_flag->{$MenuUnit_hash_ref}
5014             if defined $main::maintain_scroll_flag;
5015 0 0 0       if (($ikey eq 'DOWNARROW' || $numbor=~/^d$/i) &&
    0 0        
      0        
      0        
      0        
      0        
5016             exists $MenuUnit_hash_ref->{Scroll}
5017             && $MenuUnit_hash_ref->{Scroll}) {
5018 0           my $remainder=0;my $curscreennum=0;
  0            
5019 0 0         $remainder=$num_pick % $choose_num if $num_pick;
5020 0 0         $curscreennum=($start+$remainder==$num_pick)?
5021             $start+$remainder:$start+$choose_num;
5022             $MenuUnit_hash_ref->{Scroll}->[1]++
5023 0 0         if $MenuUnit_hash_ref->{Scroll}->[1]!=$num_pick;
5024 0 0         if ($curscreennum<$MenuUnit_hash_ref->{Scroll}->[1]) {
5025 0 0         if ($display_this_many_items<$num_pick-$start) {
5026 0           $start=$start+$display_this_many_items;
5027 0           $FullMenu->{$MenuUnit_hash_ref}[11]=$start;
5028             } else {
5029 0           $start=$start+$remainder;
5030 0           $FullMenu->{$MenuUnit_hash_ref}[11]=$num_pick;
5031             }
5032 0           } else { next }
5033 0           $hidedefaults=0;
5034 0           $numbor=$start+$choose_num+1;
5035 0           last;
5036             } elsif ($ikey eq 'ENTER' && exists $MenuUnit_hash_ref->{Scroll}
5037             && $MenuUnit_hash_ref->{Scroll} && !$show_banner_only) {
5038 0           $numbor=$MenuUnit_hash_ref->{Scroll}->[1];
5039             $MenuUnit_hash_ref->{Scroll}->[1]++
5040 0 0         if $MenuUnit_hash_ref->{Scroll}->[1]!=$num_pick;
5041             } else {
5042 0 0         if ($show_banner_only) {
    0          
    0          
5043 0 0         if (exists $MenuUnit_hash_ref->{Result}) {
5044 0           $numbor='f';
5045 0           $picks{'__FA_Banner__'}='';
5046 0           my $remainder=0;
5047 0 0         $remainder=$choose_num % $num_pick if $num_pick;
5048 0 0         my $curscreennum=($start+$remainder==$num_pick)?
5049             $start+$remainder:$start+$choose_num;
5050 0           my $numpick=0;
5051 0 0 0       if ($parent_menu and exists $parent_menu->{Scroll}) {
5052 0 0         if (ref $parent_menu->{Scroll} eq 'ARRAY') {
5053 0           $numpick=$#{[keys %{$FullMenu->{$parent_menu}[2]}]};
  0            
  0            
5054 0 0 0       if ($curscreennum+$display_this_many_items
5055             <$parent_menu->{Scroll}->[1] &&
5056             $parent_menu->{Scroll}->[1]<$numpick) {
5057             $FullMenu->{$parent_menu}[11]=
5058 0           $parent_menu->{Scroll}->[1];
5059             }
5060             }
5061 0   0       $parent_menu->{Scroll}->[1]||=0;
5062             }
5063             } else {
5064 0           return 'DONE_SUB';
5065             }
5066             } elsif ($display_this_many_items<$num_pick-$start) {
5067 0           $start=$start+$display_this_many_items;
5068             $MenuUnit_hash_ref->{Scroll}->[1]=$start+1 if
5069             exists $MenuUnit_hash_ref->{Scroll}
5070 0 0 0       && $MenuUnit_hash_ref->{Scroll};
5071 0           $FullMenu->{$MenuUnit_hash_ref}[11]=$start;
5072             } elsif ($ikey ne 'PAGEDOWN') {
5073 0           $start=$FullMenu->{$MenuUnit_hash_ref}[11]=0;
5074             }
5075 0 0 0       unless ($show_banner_only || $numbor!~/^\d+/) {
5076 0           $hidedefaults=0;
5077 0           $numbor=$start+$choose_num+1;
5078 0           last;
5079             }
5080             }
5081 0           } chomp $numbor;my $test_numbor=$numbor;$test_numbor=~s/\//\\\//sg;
  0            
  0            
5082 0 0 0       if (!((keys %picks) && $numbor=~/^[Ff]$/) &&
    0 0        
      0        
5083             $test_numbor!~/^\d+|admin$/ && !$return_from_child_menu) {
5084 0 0         delete $main::maintain_scroll_flag->{$MenuUnit_hash_ref}
5085             if defined $main::maintain_scroll_flag;
5086 0           $numbor=$start+$choose_num+1;
5087 0           last;
5088             } elsif (exists $pn{$numbor} || ((keys %picks) && $numbor=~/^[Ff]$/)) {
5089             # NUMBOR CHOSEN
5090 0 0         delete $main::maintain_scroll_flag->{$MenuUnit_hash_ref}
5091             if defined $main::maintain_scroll_flag;
5092 0 0         delete $picks{'__FA_Banner__'} if exists $picks{'__FA_Banner__'};
5093 0 0         %pn=() unless %pn;
5094 0           my $callertest=__PACKAGE__."::Menu";
5095 0 0 0       if ($Persists->{$MenuUnit_hash_ref}{defaults} && !$filtered_menu) {
5096 0           $Persists->{$MenuUnit_hash_ref}{defaults}=0;
5097 0 0         $Persists->{$parent_menu}{defaults}=0 if $parent_menu;
5098 0           foreach my $pick (keys %picks) {
5099 0 0 0       if (exists $picks{$pick} && !$picks{$numbor}) {
5100 0 0         if ($picks{$pick} eq '*') {
    0          
5101 0           delete $picks{$pick};
5102 0           delete $items{$pick};
5103 0           delete $Selected->{$MenuUnit_hash_ref}{$pick};
5104             } elsif ($picks{$pick} eq '+') {
5105 0           &delete_Selected($MenuUnit_hash_ref,$pick,
5106             $Selected,$SavePick,$SaveNext,$Persists);
5107 0           delete $picks{$pick};
5108 0           delete $items{$pick};
5109             }
5110             }
5111 0           } $FullMenu->{$MenuUnit_hash_ref}[5]='';
5112             }
5113 0   0       $pn{$numbor}[1]||=1;
5114 0 0         my $digital_numbor=($numbor=~/^\d+$/) ? $numbor : 1;
5115 0   0       $all_menu_items_array[0]||='';
5116 0 0 0       if (exists $MenuUnit_hash_ref->{Result} &&
5117             !defined $MenuUnit_hash_ref->{Result}) {
5118 0           my $name=$MenuUnit_hash_ref->{Name};
5119 0           print "\n\n";
5120 0           my $fatal_error=<
5121            
5122             FATAL ERROR!: The Menu Block \"$name\" :
5123            
5124             END
5125 0           $fatal_error.=<<'END';
5126             has a Result => undef element defined, but not instantiated.
5127             There may be a couple reasons for this, having to do with scope
5128             and where code blocks are located in relation to each other in
5129             the script. It could also be that you didn't provide a value
5130             for the element. If blocks are locally scoped with "my" than
5131             the result block must exist ABOVE the calling block:
5132            
5133             my $block_being_called = { ... };
5134             my $block_doing_calling = { Result => $block_being_called, };
5135            
5136             However, with more complex menu implementations, this
5137             convenience is not always possible or workable. In this
5138             situation, the approach is different. It will be necessary to
5139             globally scope code blocks, and use full package naming
5140             conventions when calling code blocks:
5141            
5142             our $block_doing_calling = {
5143            
5144             Result => $Full::Package::Name::Of::block_being_called,
5145            
5146             };
5147             our $block_being_called = { ... };
5148            
5149             ---------------------------------------------------------------
5150            
5151             Result => elements MUST have a value. A NULL value will work:
5152            
5153             my|our $block_being_called = { Result => '', }
5154            
5155             END
5156 0           die $fatal_error;
5157             }
5158 0 0 0       if (($select_many ||
    0 0        
    0 0        
    0 0        
    0 0        
      0        
      0        
      0        
      0        
      0        
      0        
      0        
      0        
      0        
      0        
      0        
      0        
      0        
5159             (exists ${$MenuUnit_hash_ref}{Select}{$numbor}))
5160             && $numbor!~/^[Ff]$/) {
5161 0 0 0       if ($filtered_menu && (exists
    0          
5162             $SavePick->{$parent_menu}{$numbor})) {
5163 0 0         if ($Persists->{$parent_menu}{defaults}) {
5164 0           $Persists->{$parent_menu}{defaults}=0;
5165 0           $Persists->{$MenuUnit_hash_ref}{defaults}=0;
5166 0           foreach my $pick (keys %picks) {
5167 0 0 0       if (exists $picks{$pick} && !$picks{$numbor}) {
5168 0 0         if ($picks{$pick} eq '*') {
    0          
5169 0           delete $picks{$pick};
5170 0           delete $items{$pick};
5171 0           delete $Selected->{$parent_menu}{$pick};
5172 0           delete $SavePick->{$MenuUnit_hash_ref}{$numbor};
5173             } elsif ($picks{$pick} eq '+') {
5174 0           &delete_Selected($parent_menu,$pick,
5175             $Selected,$SavePick,$SaveNext,$Persists);
5176 0           $SaveNext={%{$SavePick}};
  0            
5177 0           delete $picks{$pick};
5178 0           delete $items{$pick};
5179             }
5180             }
5181 0           } $FullMenu->{$MenuUnit_hash_ref}[5]='';
5182             }
5183 0           delete $Selected->{$MenuUnit_hash_ref}{$numbor};
5184 0           delete $picks{$numbor};
5185 0           delete $items{$numbor};
5186 0           delete $SaveNext->{$MenuUnit_hash_ref};
5187 0           delete $SavePick->{$MenuUnit_hash_ref}{$numbor};
5188 0           delete $SavePick->{$parent_menu}{$numbor};
5189             } elsif (exists $picks{$numbor}) {
5190 0 0         if ($picks{$numbor} eq '*') {
5191 0           delete $picks{$numbor};
5192 0           delete $items{$numbor};
5193 0           delete $Selected->{$MenuUnit_hash_ref}{$numbor};
5194 0           delete $SavePick->{$MenuUnit_hash_ref}{$numbor};
5195 0 0         delete $SavePick->{$parent_menu}{$numbor}
5196             if $filtered_menu;
5197             } else {
5198 0           &delete_Selected($MenuUnit_hash_ref,$numbor,
5199             $Selected,$SavePick,$SaveNext,$Persists);
5200 0           delete $picks{$numbor};
5201 0           delete $items{$numbor};
5202             }
5203             } else {
5204             $items{$numbor}=$FullMenu->{$MenuUnit_hash_ref}
5205 0           [4]{$all_menu_items_array[$numbor-1]};
5206 0 0         $SavePick->{$parent_menu}{$numbor}='*'
5207             if $filtered_menu;
5208 0           my $skip=0;
5209 0           foreach my $key (keys %picks) {
5210 0 0 0       if (defined $all_menu_items_array[$key-1] &&
    0 0        
5211 0           exists ${$FullMenu}{$MenuUnit_hash_ref}[1]->{
5212             $all_menu_items_array[$key-1]}
5213 0           && (grep { $items{$numbor} eq $_ }
5214 0           @{${$FullMenu}{$MenuUnit_hash_ref}[1]->{
5215 0           $all_menu_items_array[$key-1]}})) {
5216 0           my $warn="\n WARNING! You Cannot Select ";
5217 0           $warn.="Line $numbor while Line $key is Selected!\n";
5218 0           print "$warn";sleep 2;
  0            
5219 0           $skip=1;
5220             } elsif ($picks{$key} eq '-') {
5221 0           delete ${$Selected}{$MenuUnit_hash_ref}{$key};
  0            
5222 0           delete $picks{$key};
5223 0           delete $SaveNext->{$MenuUnit_hash_ref};
5224             }
5225             }
5226 0 0         if ($skip==0) {
5227 0           $picks{$numbor}='*';
5228             $negate{$numbor}=
5229 0           ${${$FullMenu}{$MenuUnit_hash_ref}[1]}
  0            
5230 0           {$all_menu_items_array[$numbor-1]};
5231 0           %{$SavePick->{$MenuUnit_hash_ref}}=%picks;
  0            
5232             }
5233             }
5234 0 0 0       if ($prev_menu && $prev_menu!=$numbor) {
5235 0           &delete_Selected($MenuUnit_hash_ref,$prev_menu,
5236             $Selected,$SavePick,$SaveNext,$Persists);
5237 0           delete $picks{$prev_menu};
5238 0           delete $items{$prev_menu};
5239             }
5240             } elsif (($show_banner_only && exists $MenuUnit_hash_ref->
5241             {Result} and ref $MenuUnit_hash_ref->
5242             {Result} eq 'HASH') || ($numbor=~/^\d+$/ &&
5243             (ref $FullMenu->{$MenuUnit_hash_ref}[2]
5244             {$all_menu_items_array[$digital_numbor-1]||
5245             $all_menu_items_array[$pn{$digital_numbor}[1]-1]}
5246             eq 'HASH')) || ($numbor=~/^[Ff]$/ &&
5247             ref $FullMenu->{$MenuUnit_hash_ref}[2]
5248             {$all_menu_items_array[((keys %picks)[0]||1)-1]}
5249             eq 'HASH')) {
5250 0           my $numbor_is_eff=0;
5251 0 0         if ($numbor=~/^[Ff]$/) {
5252 0           $numbor=(keys %picks)[0];
5253 0           $numbor_is_eff=1;
5254             }
5255 0 0         if (grep { /Item_/ } keys %{$MenuUnit_hash_ref}) {
  0            
  0            
5256 0           my @items=();
5257 0           foreach my $key (keys %{$MenuUnit_hash_ref}) {
  0            
5258 0 0         next unless $key=~/Item_/;
5259 0           push @items, $MenuUnit_hash_ref->{$key};
5260             }
5261 0 0 0       if ($#items==0 && ref $items[0] eq 'HASH' &&
      0        
      0        
5262 0           (!grep { /Item_/ } keys %{$items[0]}) &&
  0            
5263 0           grep { /Banner/ } keys %{$items[0]}) {
  0            
5264 0           $show_banner_only=1;
5265             }
5266             }
5267 0 0 0       if ($show_banner_only ||
      0        
      0        
      0        
      0        
5268 0           (grep { /Item_/ } keys %{$FullMenu->{
5269             $MenuUnit_hash_ref}[2]{$all_menu_items_array[
5270             $numbor-1]||$all_menu_items_array[
5271 0   0       $pn{$numbor}[1]-1]}})|| exists $labels{
5272             (keys %{$FullMenu->{$MenuUnit_hash_ref}[2]
5273 0   0       {$all_menu_items_array[$digital_numbor-1]
5274             ||''}})[0]or[]}||
5275             &test_hashref($FullMenu->{$MenuUnit_hash_ref}[2]
5276             {$all_menu_items_array[$numbor-1]||
5277             $all_menu_items_array[$pn{$numbor}[1]-1]})) {
5278 0           my $menyou='';
5279 0 0         my $cur_menu=($filtered_menu)?$parent_menu:$MenuUnit_hash_ref;
5280 0 0         if ($filtered_menu) {
5281 0           my @all_copy=@all_menu_items_array;
5282 0           @all_menu_items_array=();
5283 0           my $pstart=0;
5284 0           my $pstop=0;
5285 0           foreach my $pik (sort numerically keys %pn) {
5286 0           $pstop=$pik-2;
5287 0           foreach my $item ($pstart..$pstop) {
5288 0           push @all_menu_items_array,'';
5289             }
5290 0           push @all_menu_items_array, shift @all_copy;
5291 0           $pstart=$pstop+2;
5292 0           $pstop=0;
5293             }
5294 0           while (my $pst=$pstart--) {
5295 0 0         if ($pst=~/0$/) {
5296 0           $FullMenu->{$cur_menu}[11]=$pst;
5297 0           last;
5298             }
5299             }
5300 0           delete $SavePick->{$MenuUnit_hash_ref};
5301 0           delete $SaveNext->{$MenuUnit_hash_ref};
5302             }
5303 0 0         if (!$filtered_menu) {
5304 0 0         if (exists $MenuUnit_hash_ref->{Result}) {
    0          
5305             $FullMenu->{$MenuUnit_hash_ref}[2]
5306             {'__FA_Banner__'}
5307 0           =$MenuUnit_hash_ref->{Result};
5308             } elsif (exists $labels{(keys %{$FullMenu->
5309             {$MenuUnit_hash_ref}[2]
5310 0           {$all_menu_items_array[$digital_numbor-1]}})[0]}) {
5311 0           my %men_result=%{$FullMenu->
5312             {$MenuUnit_hash_ref}[2]
5313 0           {$all_menu_items_array[$digital_numbor-1]}};
5314             $menyou=&Data::Dump::Streamer::Dump($labels{
5315 0           (keys %men_result)[0]})->Out();
5316             #print "MENYOU=$menyou<==\n";;
5317 0           $menyou=~s/\$HASH\d*\s*=\s*//s;
5318 0           my $mnyou=eval $menyou;
5319             #print "WHAT IS THE CONVEY=$mnyou->{Item_1}->{Convey}<==\n";
5320             $FullMenu->
5321             {$MenuUnit_hash_ref}[2]
5322 0           {$all_menu_items_array[$numbor-1]}=$mnyou;
5323             my $itemnum=$FullMenu->{$MenuUnit_hash_ref}[4]
5324 0           {$all_menu_items_array[$numbor-1]};
5325             }
5326             }
5327 0 0         chomp($numbor) if $numbor;
5328 0 0 0       unless ($numbor_is_eff) {
5329 0 0         if (exists $picks{$numbor}) {
5330             #$FullMenu->{$cur_menu}[5]='ERASE';
5331 0           $hidedefaults=0;
5332 0           foreach my $key (keys %{$SaveNext}) {
  0            
5333 0           delete $SaveNext->{$key};
5334             }
5335 0 0         if ($picks{$numbor} eq '*') {
    0          
5336 0           delete $picks{$numbor};
5337 0           delete $items{$numbor};
5338 0           delete $Selected->{$cur_menu}{$numbor};
5339             } elsif ($picks{$numbor} ne ' ') {
5340 0           &delete_Selected($cur_menu,$numbor,
5341             $Selected,$SavePick,$SaveNext,$Persists);
5342 0           delete $picks{$numbor};
5343 0           delete $items{$numbor};
5344             }
5345             }
5346 0 0 0       if ($prev_menu && $prev_menu!=$numbor) {
5347             #$FullMenu->{$cur_menu}[5]='ERASE';
5348 0           $hidedefaults=0;
5349 0           &delete_Selected($cur_menu,$prev_menu,
5350             $Selected,$SavePick,$SaveNext,$Persists);
5351 0           delete $picks{$prev_menu};
5352 0           delete $items{$prev_menu};
5353             }
5354             } elsif (!$show_banner_only) {
5355             foreach my $key (keys %picks) {
5356             if (($start<=$key) || ($key<=$start+$choose_num)) {
5357             $numbor=$key;
5358             last;
5359             }
5360             }
5361             }
5362 0           my $next_menu_ref='';
5363 0 0         unless ($show_banner_only) {
5364             $next_menu_ref=$FullMenu->
5365             {$cur_menu}[2]
5366 0 0         {$all_menu_items_array[$numbor-1]}
5367             unless $filtered_menu;
5368 0   0       $next_menu_ref||='';
5369 0 0         delete $SavePick->{$next_menu_ref}
5370             unless $filtered_menu;
5371 0 0         $FullMenu->{$next_menu_ref}[11]=0
5372             unless $filtered_menu;
5373             %picks=() if (!$select_many &&
5374 0 0 0       !exists ${$MenuUnit_hash_ref}{Select}{$numbor});
  0            
5375 0 0 0       $picks{$numbor}='-' if !(keys %picks) || $numbor!~/^[Ff]$/;
5376             }
5377 0           ($FullMenu,$Conveyed,$SaveNext,$Persists,$Selected,
5378             $convey,$parent_menu)
5379             =$get_result->($cur_menu,
5380             \@all_menu_items_array,\%picks,
5381             $picks_from_parent,$FullMenu,$Conveyed,$Selected,
5382             $SaveNext,$Persists,$parent_menu);
5383 0           %{$SavePick->{$cur_menu}}=%picks;
  0            
5384 0           $Conveyed->{&pw($cur_menu)}=[];
5385 0 0         if (0<$#{[keys %picks]}) {
  0 0          
5386 0           foreach my $key (sort numerically keys %picks) {
5387 0           push @{$Conveyed->{&pw($cur_menu)}},
  0            
5388             $all_menu_items_array[$key-1];
5389             }
5390             } elsif ($numbor) {
5391 0           $Conveyed->{&pw($cur_menu)}=
5392             $all_menu_items_array[$numbor-1];
5393             }
5394 0           my $mcount=0;
5395 0 0         unless (exists $SaveMMap->{$cur_menu}) {
5396 0 0         if ($filtered_menu) {
    0          
5397 0           my $pmap=[];
5398 0           foreach my $kee (keys %{$SaveMMap}) {
  0            
5399             my $map=&Data::Dump::Streamer::Dump(
5400 0           $SaveMMap->{$kee})->Out();
5401 0           $map=~s/\$ARRAY\d*\s*=\s*//s;
5402 0           my $m=eval $map;
5403 0 0         $pmap=$m if $#{$pmap}<$#{$m};
  0            
  0            
5404             }
5405 0           $SaveMMap->{$cur_menu}=$pmap;
5406             $mcount=&get_Menu_map_count(
5407 0           $SaveMMap->{$cur_menu});
5408             } elsif ($parent_menu) {
5409             my $parent_map=&Data::Dump::Streamer::Dump(
5410 0           $SaveMMap->{$parent_menu})->Out();
5411 0           $parent_map=~s/\$ARRAY\d*\s*=\s*//s;
5412 0           $SaveMMap->{$cur_menu}=eval $parent_map;
5413             $mcount=&get_Menu_map_count(
5414 0           $SaveMMap->{$cur_menu});
5415             } else {
5416 0           $SaveMMap->{$cur_menu}=[];
5417             }
5418             }
5419 0 0         if (ref $convey eq 'ARRAY') {
5420 0           push @{$SaveMMap->{$cur_menu}},
  0            
5421             [ ++$mcount, $convey->[0] ];
5422             } else {
5423 0           push @{$SaveMMap->{$cur_menu}},
  0            
5424             [ ++$mcount, $convey ];
5425             }
5426 0 0         if ($filtered_menu) {
5427             return $FullMenu->
5428             {$cur_menu}[2]
5429 0           {$all_menu_items_array[$numbor-1]},$convey,
5430             $recurse_level,$FullMenu,
5431             $Selected,$Conveyed,$SavePick,
5432             $SaveMMap,$SaveNext,$Persists,
5433             $cur_menu,$no_wantarray;
5434             }
5435 0           $MenuMap=$SaveMMap->{$cur_menu};
5436 0           my $returned_FullMenu='';
5437 0           my $returned_Selected='';
5438 0           my $returned_Conveyed='';
5439 0           my $returned_SavePick='';
5440 0           my $returned_SaveMMap='';
5441 0           my $returned_SaveNext='';
5442 0           my $returned_Persists='';
5443 0           my $menu_result='';
5444 0 0         if (exists $Selected->{$cur_menu}
5445             {'__FA_Banner__'}) {
5446             $menu_result=$Selected->{$cur_menu}
5447 0           {'__FA_Banner__'};
5448 0 0         $menu_result=$menu_result->() if ref
5449             $menu_result eq 'CODE';
5450             } else {
5451             $menu_result=$FullMenu->{$cur_menu}[2]
5452 0           {$all_menu_items_array[$numbor-1]};
5453             }
5454 0           eval {
5455 0           ($menu_output,$returned_FullMenu,
5456             $returned_Selected,$returned_Conveyed,
5457             $returned_SavePick,$returned_SaveMMap,
5458             $returned_SaveNext,$returned_Persists)
5459             =&Menu($menu_result,$convey,
5460             $recurse_level,$FullMenu,
5461             $Selected,$Conveyed,$SavePick,
5462             $SaveMMap,$SaveNext,$Persists,
5463             $cur_menu,$no_wantarray);
5464             }; # MENU RETURN MENURETURN 7
5465 0 0         print "MENU RETURN 7\n" if $menu_return_debug;
5466 0 0         die $@ if $@;
5467 0 0 0       if (ref $menu_output eq 'ARRAY' &&
5468             $menu_output->[0]=~/^[{](.*)[}][<]$/) {
5469 0           delete $Selected->{$MenuUnit_hash_ref};
5470 0           delete $Conveyed->{$MenuUnit_hash_ref};
5471 0           delete $SavePick->{$MenuUnit_hash_ref};
5472 0           delete $SaveMMap->{$MenuUnit_hash_ref};
5473 0           delete $SaveNext->{$MenuUnit_hash_ref};
5474 0           delete $Persists->{$MenuUnit_hash_ref};
5475 0 0         if ($1 eq $MenuUnit_hash_ref->{Name}) {
5476 0           %picks=();
5477 0           my $remainder=0;my $curscreennum=0;
  0            
5478 0 0         $remainder=$num_pick % $choose_num if $num_pick;
5479 0 0         $curscreennum=($start+$remainder==$num_pick)?
5480             $start+$remainder:$start+$choose_num;
5481 0 0 0       if ($curscreennum<$MenuUnit_hash_ref->{Scroll}->[1]
5482             && $display_this_many_items<$num_pick-$start) {
5483 0           $start=$start+$display_this_many_items;
5484 0           $FullMenu->{$MenuUnit_hash_ref}[11]=$start;
5485 0 0         if ($start+$remainder==$num_pick) {
5486 0           $choose_num=$num_pick-$start;
5487             } else {
5488 0           $choose_num=$display_this_many_items;
5489             }
5490             }
5491 0           $show_banner_only=0;
5492 0           next;
5493             } else {
5494 0           delete $FullMenu->{$MenuUnit_hash_ref};
5495 0           return $menu_output,
5496             $FullMenu,$Selected,$Conveyed,
5497             $SavePick,$SaveMMap,$SaveNext,
5498             $Persists;
5499             }
5500             } else {
5501 0           $FullMenu=$returned_FullMenu;
5502 0           $Selected=$returned_Selected;
5503 0           $Conveyed=$returned_Conveyed;
5504 0           $SavePick=$returned_SavePick;
5505 0           $SaveMMap=$returned_SaveMMap;
5506 0           $SaveNext=$returned_SaveNext;
5507 0           $Persists=$returned_Persists;
5508             }
5509 0 0         chomp($menu_output) if !(ref $menu_output);
5510 0 0 0       if ($filtered_menu) {
    0          
    0          
    0          
    0          
    0          
5511 0 0         if (grep { /\+|\*/ } values %picks) {
  0            
5512 0           return '+',
5513             $FullMenu,$Selected,$Conveyed,
5514             $SavePick,$SaveMMap,$SaveNext,
5515             $Persists;
5516             } else {
5517 0           my %sp_copy=%{$SavePick->{$parent_menu}}
5518 0 0         if exists $SavePick->{$parent_menu};
5519 0           foreach my $key (keys %sp_copy) {
5520             $SavePick->{$parent_menu}->{$key}='-' if
5521 0 0         $sp_copy{$key} eq '+';
5522             }
5523 0           return '-',
5524             $FullMenu,$Selected,$Conveyed,
5525             $SavePick,$SaveMMap,$SaveNext,
5526             $Persists;
5527             }
5528             } elsif ($menu_output eq '-') {
5529 0           $return_from_child_menu='-';
5530             } elsif ($menu_output eq '+') {
5531 0           $return_from_child_menu='+';
5532             } elsif ($menu_output eq 'DONE_SUB') {
5533 0           return 'DONE_SUB';
5534             } elsif ($menu_output eq 'DONE' and 1<$recurse_level) {
5535 0           return 'DONE';
5536             } elsif ($menu_output) {
5537 0           return $menu_output;
5538             } else {
5539 0 0 0       if ($Term::Menus::fullauto && (!exists
      0        
      0        
5540             ${$MenuUnit_hash_ref}{'NoPlan'} ||
5541             !${$MenuUnit_hash_ref}{'NoPlan'}) &&
5542             defined $Net::FullAuto::FA_Core::makeplan) {
5543             #print "IN MAKEPLAN14\n";
5544 0 0 0       if (-1==$#{$Net::FullAuto::FA_Core::makeplan{'Plan'}}
  0            
5545             && !exists
5546             $Net::FullAuto::FA_Core::makeplan->{'Title'}) {
5547 0           $Net::FullAuto::FA_Core::makeplan->{'Title'}
5548             =$all_menu_items_array[$numbor-1];
5549             }
5550 0 0         unless ($got_default) {
5551 0           push @{$Net::FullAuto::FA_Core::makeplan->{'Plan'}},
5552             { Menu => &pw($MenuUnit_hash_ref),
5553             Number => $numbor,
5554             PlanID =>
5555             $Net::FullAuto::FA_Core::makeplan->{Number},
5556 0           Item => $all_menu_items_array[$numbor-1] }
5557             }
5558             }
5559 0 0         my $subfile=substr(
5560             $Term::Menus::fa_code,0,-3).'::'
5561             if $Term::Menus::fa_code;
5562 0   0       $subfile||='';
5563 0           foreach my $sub (&get_subs_from_menu($Selected)) {
5564 0           my @resu=();
5565 0 0         if (ref $sub eq 'CODE') {
5566 0 0 0       if ($Term::Menus::fullauto && (!exists
      0        
      0        
5567             ${$MenuUnit_hash_ref}{'NoPlan'} ||
5568             !${$MenuUnit_hash_ref}{'NoPlan'}) &&
5569             defined $Net::FullAuto::FA_Core::makeplan) {
5570             #print "IN MAKEPLAN15\n";
5571 0 0 0       if (-1==$#{$Net::FullAuto::FA_Core::makeplan{
5572 0           'Plan'}} && !exists
5573             $Net::FullAuto::FA_Core::makeplan->{
5574             'Title'}) {
5575 0           $Net::FullAuto::FA_Core::makeplan->{'Title'}
5576             =$all_menu_items_array[$numbor-1];
5577             }
5578 0           my $n='Numbor';
5579             push @{$Net::FullAuto::FA_Core::makeplan->{
5580 0           'Plan'}},
5581             { Menu => &pw($MenuUnit_hash_ref),
5582             Number => $numbor,
5583             PlanID =>
5584 0           $Net::FullAuto::FA_Core::makeplan->{$n},
5585             Item =>
5586             &Data::Dump::Streamer::Dump($sub)->Out()
5587             }
5588             }
5589 0           eval { @resu=$sub->() };
  0            
5590 0 0         if ($@) {
5591 0 0 0       if (10
5592             'FATAL ERROR') {
5593 0 0 0       if ($parent_menu && wantarray &&
      0        
5594             !$no_wantarray) {
5595 0           return '',$FullMenu,$Selected,$Conveyed,
5596             $SavePick,$SaveMMap,$SaveNext,
5597             $Persists,$parent_menu,$@;
5598             }
5599 0 0 0       if (defined $log_handle &&
5600             -1
5601 0           print $log_handle $@;
5602 0           close($log_handle);
5603             }
5604 0 0         if ($Term::Menus::fullauto) {
5605 0           &Net::FullAuto::FA_Core::handle_error($@);
5606 0           } else { die $@ }
5607             } else {
5608 0           my $die="\n FATAL ERROR! - The Local "
5609             ."System $Term::Menus::local_hostname "
5610             ."Conveyed\n"
5611             ." the Following "
5612             ."Unrecoverable Error Condition :\n\n"
5613             ." $@\n line ".__LINE__;
5614 0 0 0       if ($parent_menu && wantarray &&
      0        
5615             !$no_wantarray) {
5616 0           return '',$FullMenu,$Selected,$Conveyed,
5617             $SavePick,$SaveMMap,$SaveNext,
5618             $Persists,$parent_menu,$die;
5619             }
5620 0 0 0       if (defined $log_handle &&
5621             -1
5622 0           print $log_handle $die;
5623 0           close($log_handle);
5624             }
5625 0 0         if ($Term::Menus::fullauto) {
5626 0           &Net::FullAuto::FA_Core::handle_error($die);
5627 0           } else { die $die }
5628             }
5629             }
5630 0 0         if (-1<$#resu) {
5631 0 0         if ($resu[0] eq '<') {
5632 0           %picks=();
5633 0           $show_banner_only=0;
5634             next
5635 0           }
5636 0 0 0       if (0<$#resu && wantarray && !$no_wantarray) {
      0        
5637 0           return @resu;
5638             } else {
5639 0           return return_result($resu[0],
5640             $MenuUnit_hash_ref,$Conveyed);
5641             }
5642             }
5643 0           $done=1;last
5644 0           }
5645 0           eval {
5646 0 0         if ($subfile) {
5647 0           $sub=~s/^[&]//;
5648 0 0 0       if ($Term::Menus::fullauto && (!exists
      0        
      0        
5649             ${$MenuUnit_hash_ref}{'NoPlan'} ||
5650             !${$MenuUnit_hash_ref}{'NoPlan'}) &&
5651             defined $Net::FullAuto::FA_Core::makeplan) {
5652             #print "IN MAKEPLAN16\n";
5653 0 0 0       if (-1==$#{$Net::FullAuto::FA_Core::makeplan{
5654 0           'Plan'}} && !exists
5655             $Net::FullAuto::FA_Core::makeplan->{
5656             'Title'}) {
5657 0           $Net::FullAuto::FA_Core::makeplan->{'Title'}
5658             =$all_menu_items_array[$numbor-1];
5659             }
5660 0           my $n='Number';
5661             push @{$Net::FullAuto::FA_Core::makeplan->{
5662 0           'Plan'}},
5663             { Menu => &pw($MenuUnit_hash_ref),
5664             Number => $numbor,
5665             PlanID =>
5666 0           $Net::FullAuto::FA_Core::makeplan->{$n},
5667             Item => "&$subfile$sub" }
5668             }
5669 0           eval "\@resu=\&$subfile$sub";
5670 0   0       my $firsterr=$@||'';
5671 0 0 0       if ((-1
    0          
5672             (-1
5673 0 0         if ($sub!~/::/) {
5674 0           eval "\@resu=main::$sub";
5675             } else {
5676 0           eval "\@resu=$sub";
5677             }
5678 0   0       my $seconderr=$@||'';my $die='';
  0            
5679 0           my $c=$Term::Menus::fa_code;
5680 0 0         if ($seconderr=~/Undefined subroutine/) {
5681 0 0         if (${$FullMenu}{$MenuUnit_hash_ref}[2]
  0            
5682             {$all_menu_items_array[$numbor-1]}) {
5683             $die="The \"Result15 =>\" Setting"
5684 0           ."\n\t\t-> " . ${$FullMenu}
5685             {$MenuUnit_hash_ref}[2]
5686             {$all_menu_items_array[$numbor-1]}
5687             ."\n\t\tFound in the Menu Unit -> "
5688 0           .$MenuUnit_hash_ref->{Name}."\n\t\t"
5689             ."Specifies a Subroutine"
5690             ." that Does NOT Exist"
5691             ."\n\t\tin the User Code File "
5692             .$c.",\n\t\tnor was a routine with "
5693             ."that name\n\t\tlocated in the"
5694             ." main:: script.\n";
5695             } else {
5696 0           $die="$firsterr\n $seconderr"
5697             }
5698 0           } else { $die=$seconderr }
5699 0 0         if ($Term::Menus::fullauto) {
5700 0           &Net::FullAuto::FA_Core::handle_error($die);
5701             } else {
5702 0           die $die;
5703             }
5704             } elsif ($firsterr) {
5705 0 0         if ($Term::Menus::fullauto) {
5706 0           &Net::FullAuto::FA_Core::handle_error(
5707             $firsterr);
5708             } else {
5709 0           die $firsterr;
5710             }
5711             }
5712             } else {
5713 0 0         if ($sub!~/::/) {
5714 0           $sub=~s/^[&]//;
5715 0           eval "\@resu=main::$sub";
5716             } else {
5717 0           eval "\@resu=$sub";
5718             }
5719 0 0         die $@ if $@;
5720             }
5721             };
5722 0 0         if ($@) {
5723 0 0 0       if (10
5724             'FATAL ERROR') {
5725 0 0 0       if ($parent_menu && wantarray && !$no_wantarray) {
      0        
5726 0           return '',$FullMenu,$Selected,$Conveyed,
5727             $SavePick,$SaveMMap,$SaveNext,
5728             $Persists,$parent_menu,$@;
5729             }
5730 0 0 0       if (defined $log_handle &&
5731             -1
5732 0           print $log_handle $@;
5733 0           close($log_handle);
5734             }
5735 0 0         if ($Term::Menus::fullauto) {
5736 0           &Net::FullAuto::FA_Core::handle_error($@);
5737 0           } else { die $@ }
5738             } else {
5739 0           my $die="\n FATAL ERROR! - The Local "
5740             ."System $Term::Menus::local_hostname "
5741             ."Conveyed\n"
5742             ." the Following "
5743             ."Unrecoverable Error Condition :\n\n"
5744             ." $@\n line ".__LINE__;
5745 0 0 0       if ($parent_menu && wantarray && !$no_wantarray) {
      0        
5746 0           return '',$FullMenu,$Selected,$Conveyed,
5747             $SavePick,$SaveMMap,$SaveNext,
5748             $Persists,$parent_menu,$die;
5749             }
5750 0 0 0       if (defined $log_handle &&
5751             -1
5752 0           print $log_handle $die;
5753 0           close($log_handle);
5754             }
5755 0 0         if ($Term::Menus::fullauto) {
5756 0           &Net::FullAuto::FA_Core::handle_error($die);
5757 0           } else { die $die }
5758             }
5759             }
5760 0 0         if (-1<$#resu) {
5761 0 0         if ($resu[0] eq '<') {
5762 0           %picks=();
5763 0           $show_banner_only=0;
5764             next
5765 0           }
5766 0 0 0       if (0<$#resu && wantarray && !$no_wantarray) {
      0        
5767 0           return @resu;
5768             } else {
5769 0           return return_result($resu[0],
5770             $MenuUnit_hash_ref,$Conveyed);
5771             }
5772             }
5773             }
5774 0           return 'DONE_SUB';
5775             }
5776             }
5777             } elsif ($FullMenu && $caller eq $callertest &&
5778             ($select_many || (keys %{$MenuUnit_hash_ref->{Select}}))) {
5779 0 0 0       if ($numbor!~/^[Ff]$/ && exists $picks{$numbor}) {
5780 0 0         if ($picks{$numbor} eq '*') {
5781 0           delete $picks{$numbor};
5782 0           delete $items{$numbor};
5783 0           delete ${$Selected}{$MenuUnit_hash_ref}{$numbor};
  0            
5784             } else {
5785 0           &delete_Selected($MenuUnit_hash_ref,$numbor,
5786             $Selected,$SavePick,$SaveNext,$Persists);
5787 0           $SaveNext={%{$SavePick}};
  0            
5788 0           delete $picks{$numbor};
5789 0           delete $items{$numbor};
5790 0           } last;
5791             }
5792 0 0         if (keys %{$FullMenu->{$MenuUnit_hash_ref}[2]}) {
  0            
5793 0 0         $numbor=(keys %picks)[0] if $numbor=~/^[Ff]$/;
5794             my $test_result=
5795             $FullMenu->{$MenuUnit_hash_ref}[2]
5796 0           {$all_menu_items_array[$numbor-1]};
5797 0 0 0       if (ref $test_result eq 'CODE') {
    0 0        
    0 0        
5798 0           my $cd='';
5799             my $sub=$FullMenu->{$MenuUnit_hash_ref}[2]
5800 0           {$all_menu_items_array[$picknum-1]};
5801 0           my $select_ed=[];
5802 0 0         if (0<$#{[keys %picks]}) {
  0            
5803 0           foreach my $key (keys %picks) {
5804 0           push @{$select_ed}, $pn{$key}[0];
  0            
5805             }
5806             } else {
5807 0           $select_ed=$pn{$numbor}[0];
5808             }
5809 0 0         if ($Term::Menus::data_dump_streamer) {
5810 0           $cd=&Data::Dump::Streamer::Dump($sub)->Out();
5811             $cd=&transform_sicm($cd,$numbor,
5812             \@all_menu_items_array,\%picks,'',
5813             $return_from_child_menu,$log_handle,
5814 0           $MenuUnit_hash_ref->{Name});
5815             #print "CD3=$cd\n<=CD\n";;
5816 0           $cd=&transform_pmsi($cd,
5817             $Conveyed,$SaveMMap,
5818             $picks_from_parent);
5819             #print "CD4=$cd\n<=CD2\n";;
5820             }
5821 0           $cd=~s/\$CODE\d*\s*=\s*//s;
5822 0           $sub=eval $cd;
5823 0           my @resu=();
5824 0           eval { @resu=$sub->() };
  0            
5825 0 0         if ($@) {
5826 0 0 0       if (10
5827 0 0 0       if ($parent_menu && wantarray && !$no_wantarray) {
      0        
5828 0           return '',$FullMenu,$Selected,$Conveyed,
5829             $SavePick,$SaveMMap,$SaveNext,
5830             $Persists,$parent_menu,$@;
5831             }
5832 0 0 0       if (defined $log_handle &&
5833             -1
5834 0           print $log_handle $@;
5835 0           close($log_handle);
5836             }
5837 0 0         if ($Term::Menus::fullauto) {
5838 0           &Net::FullAuto::FA_Core::handle_error($@);
5839 0           } else { die $@ }
5840             } else {
5841 0           my $die="\n FATAL ERROR! - The Local "
5842             ."System $Term::Menus::local_hostname "
5843             ."Conveyed\n"
5844             ." the Following "
5845             ."Unrecoverable Error Condition :\n\n"
5846             ." $@\n line ".__LINE__;
5847 0 0 0       if ($parent_menu && wantarray && !$no_wantarray) {
      0        
5848 0           return '',$FullMenu,$Selected,$Conveyed,
5849             $SavePick,$SaveMMap,$SaveNext,
5850             $Persists,$parent_menu,$die;
5851             }
5852 0 0 0       if (defined $log_handle &&
5853             -1
5854 0           print $log_handle $die;
5855 0           close($log_handle);
5856             }
5857 0 0         if ($Term::Menus::fullauto) {
5858 0           &Net::FullAuto::FA_Core::handle_error($die);
5859 0           } else { die $die }
5860             }
5861             }
5862 0 0         if (-1<$#resu) {
5863 0 0         if ($resu[0] eq '<') { %picks=();next }
  0            
  0            
5864 0 0 0       if (0<$#resu && wantarray && !$no_wantarray) {
      0        
5865 0           return @resu;
5866             } else {
5867 0           return return_result($resu[0],
5868             $MenuUnit_hash_ref,$Conveyed);
5869             }
5870             }
5871             } elsif ($test_result &&
5872             ($test_result!~/^&?(?:.*::)*(\w+)\s*[(]?.*[)]?\s*$/ ||
5873             (!grep { $1 eq $_ } list_module('main',
5874             $Term::Menus::fa_code) && $picks{$numbor} ne '*'))) {
5875 0           my $die="The \"Result12 =>\" Setting\n -> "
5876             ."$test_result\n Found in the Menu "
5877             ."Unit -> ".$MenuUnit_hash_ref
5878             ."\n is NOT a Menu Unit\,"
5879             ."\ and it is NOT a Valid Subroutine.\n\n"
5880             ."\n Cannot Determine "
5881             ."if it is a Valid SubRoutine.\n\n";
5882 0           die $die;
5883             } elsif (!defined $pn{$numbor}[0] ||
5884             !exists ${$FullMenu}{$MenuUnit_hash_ref}[2]{
5885             $pn{$numbor}[0]}) {
5886 0           my @resu=map { $all_menu_items_array[$_-1] }
  0            
5887             sort numerically keys %picks;
5888 0           push @resu,\%picks,$MenuUnit_hash_ref;
5889 0 0 0       if (wantarray && !$no_wantarray) {
    0          
5890 0           return @resu;
5891             } elsif ($#resu==0) {
5892 0           return @resu;
5893             } else {
5894 0           return \@resu;
5895             }
5896             }
5897 0 0         if (${$FullMenu}{$MenuUnit_hash_ref}[2]
  0            
5898             {$pn{$numbor}[0]}) { }
5899 0           ($FullMenu,$Conveyed,$SaveNext,
5900             $Persists,$Selected,$convey,$parent_menu)
5901             =$get_result->($MenuUnit_hash_ref,
5902             \@all_menu_items_array,\%picks,$picks_from_parent,
5903             $FullMenu,$Conveyed,$Selected,$SaveNext,
5904             $Persists,$parent_menu);
5905 0           my %pick=();
5906 0           $pick{$numbor}='*';
5907 0           %{$SavePick->{$MenuUnit_hash_ref}}=%pick;
  0            
5908 0 0 0       if ($Term::Menus::fullauto && (!exists
      0        
      0        
5909             $MenuUnit_hash_ref->{'NoPlan'} ||
5910             !$MenuUnit_hash_ref->{'NoPlan'}) &&
5911             defined $Net::FullAuto::FA_Core::makeplan) {
5912             #print "IN MAKEPLAN17\n";
5913 0 0 0       if (-1==$#{$Net::FullAuto::FA_Core::makeplan{'Plan'}} &&
  0            
5914             !exists
5915             $Net::FullAuto::FA_Core::makeplan->{'Title'}) {
5916             $Net::FullAuto::FA_Core::makeplan->{'Title'}
5917 0           =$pn{$numbor}[0];
5918             }
5919 0 0         unless ($got_default) {
5920 0           push @{$Net::FullAuto::FA_Core::makeplan->{'Plan'}},
5921             { Menu => &pw($MenuUnit_hash_ref),
5922             Number => $numbor,
5923             PlanID =>
5924             $Net::FullAuto::FA_Core::makeplan->{Number},
5925 0           Item => $pn{$numbor}[0] }
5926             }
5927             }
5928 0 0         my $subfile=substr($Term::Menus::fa_code,0,-3)
5929             .'::' if $Term::Menus::fa_code;
5930 0   0       $subfile||='';
5931 0           foreach my $sub (&get_subs_from_menu($Selected)) {
5932 0           my @resu=();
5933 0 0         if (ref $sub eq 'CODE') {
5934 0 0 0       if ($Term::Menus::fullauto && (!exists
      0        
      0        
5935             ${$MenuUnit_hash_ref}{'NoPlan'} ||
5936             !${$MenuUnit_hash_ref}{'NoPlan'}) &&
5937             defined $Net::FullAuto::FA_Core::makeplan) {
5938             #print "IN MAKEPLAN18\n";
5939 0 0 0       if (-1==$#{$Net::FullAuto::FA_Core::makeplan{
5940 0           'Plan'}} && !exists
5941             $Net::FullAuto::FA_Core::makeplan->{
5942             'Title'}) {
5943             $Net::FullAuto::FA_Core::makeplan->{'Title'}
5944 0           =$pn{$numbor}[0];
5945             }
5946 0           my $n='Number';
5947             push @{$Net::FullAuto::FA_Core::makeplan->{
5948 0           'Plan'}},
5949             { Menu => &pw($MenuUnit_hash_ref),
5950             Number => $numbor,
5951             PlanID =>
5952 0           $Net::FullAuto::FA_Core::makeplan->{$n},
5953             Item =>
5954             &Data::Dump::Streamer::Dump($sub)->Out()
5955             }
5956             }
5957 0           eval { @resu=$sub->() };
  0            
5958 0 0         if ($@) {
5959 0 0 0       if (10
5960             eq 'FATAL ERROR') {
5961 0 0 0       if ($parent_menu && wantarray && !$no_wantarray) {
      0        
5962 0           return '',$FullMenu,$Selected,$Conveyed,
5963             $SavePick,$SaveMMap,$SaveNext,
5964             $Persists,$parent_menu,$@;
5965             }
5966 0 0 0       if (defined $log_handle &&
5967             -1
5968 0           print $log_handle $@;
5969 0           close($log_handle);
5970             }
5971 0 0         if ($Term::Menus::fullauto) {
5972 0           &Net::FullAuto::FA_Core::handle_error($@);
5973 0           } else { die $@ }
5974             } else {
5975 0           my $die="\n FATAL ERROR! - The Local "
5976             ."System $Term::Menus::local_hostname "
5977             ."Conveyed\n"
5978             ." the Following "
5979             ."Unrecoverable Error Condition :\n\n"
5980             ." $@\n line ".__LINE__;
5981 0 0 0       if ($parent_menu && wantarray && !$no_wantarray) {
      0        
5982 0           return '',$FullMenu,$Selected,$Conveyed,
5983             $SavePick,$SaveMMap,$SaveNext,
5984             $Persists,$parent_menu,$die;
5985             }
5986 0 0 0       if (defined $log_handle &&
5987             -1
5988 0           print $log_handle $die;
5989 0           close($log_handle);
5990             }
5991 0 0         if ($Term::Menus::fullauto) {
5992 0           &Net::FullAuto::FA_Core::handle_error($die);
5993 0           } else { die $die }
5994             }
5995             }
5996 0 0         if (-1<$#resu) {
5997 0 0         if ($resu[0] eq '<') { %picks=();next }
  0            
  0            
5998 0 0 0       if (0<$#resu && wantarray && !$no_wantarray) {
      0        
5999 0           return @resu;
6000             } else {
6001 0           return return_result($resu[0],
6002             $MenuUnit_hash_ref,$Conveyed);
6003             }
6004             }
6005 0           $done=1;last
6006 0           }
6007 0           eval {
6008 0 0         if ($subfile) {
6009 0           $sub=~s/^[&]//;
6010 0 0 0       if ($Term::Menus::fullauto && (!exists
      0        
      0        
6011             ${$MenuUnit_hash_ref}{'NoPlan'} ||
6012             !${$MenuUnit_hash_ref}{'NoPlan'}) &&
6013             defined $Net::FullAuto::FA_Core::makeplan) {
6014             #print "IN MAKEPLAN19\n";
6015 0 0 0       if (-1==$#{$Net::FullAuto::FA_Core::makeplan{
6016 0           'Plan'}} && !exists
6017             $Net::FullAuto::FA_Core::makeplan->{
6018             'Title'}) {
6019             $Net::FullAuto::FA_Core::makeplan->{'Title'}
6020 0           =$pn{$numbor}[0];
6021             }
6022 0           my $n='Number';
6023             push @{$Net::FullAuto::FA_Core::makeplan->{
6024 0           'Plan'}},
6025             { Menu => &pw($MenuUnit_hash_ref),
6026             Number => $numbor,
6027             PlanID =>
6028 0           $Net::FullAuto::FA_Core::makeplan->{$n},
6029             Item => "&$subfile$sub" }
6030             }
6031 0           eval "\@resu=\&$subfile$sub";
6032 0   0       my $firsterr=$@||'';
6033 0 0 0       if ((-1
    0          
6034             (-1
6035 0 0         if ($sub!~/::/) {
6036 0           eval "\@resu=main::$sub";
6037             } else {
6038 0           eval "\@resu=$sub";
6039             }
6040 0   0       my $seconderr=$@||'';my $die='';
  0            
6041 0 0         if ($seconderr=~/Undefined subroutine/) {
6042 0 0         if (${$FullMenu}{$MenuUnit_hash_ref}
  0            
6043             [2]{$all_menu_items_array[$numbor-1]}) {
6044             $die="The \"Result15 =>\" Setting"
6045 0           ."\n\t\t-> " . ${$FullMenu}
6046             {$MenuUnit_hash_ref}[2]
6047             {$all_menu_items_array[$numbor-1]}
6048             ."\n\t\tFound in the Menu Unit -> "
6049 0           .$MenuUnit_hash_ref->{Name}."\n\t\t"
6050             ."Specifies a Subroutine"
6051             ." that Does NOT Exist"
6052             ."\n\t\tin the User Code File "
6053             .$Term::Menus::fa_code
6054             .",\n\t\tnor was a routine with "
6055             ."that name\n\t\tlocated in the"
6056             ." main:: script.\n";
6057 0           } else { $die="$firsterr\n $seconderr" }
6058 0           } else { $die=$seconderr }
6059 0           &Net::FullAuto::FA_Core::handle_error($die);
6060             } elsif ($firsterr) {
6061 0           &Net::FullAuto::FA_Core::handle_error($firsterr);
6062             }
6063             } else {
6064 0 0         if ($sub!~/::/) {
6065 0           $sub=~s/^[&]//;
6066 0           eval "\@resu=main::$sub";
6067             } else {
6068 0           eval "\@resu=$sub";
6069             }
6070 0 0         die $@ if $@;
6071             }
6072             };
6073 0 0         if ($@) {
6074 0 0 0       if (10
6075 0 0 0       if ($parent_menu && wantarray && !$no_wantarray) {
      0        
6076 0           return '',$FullMenu,$Selected,$Conveyed,
6077             $SavePick,$SaveMMap,$SaveNext,
6078             $Persists,$parent_menu,$@;
6079             }
6080 0 0 0       if (defined $log_handle &&
6081             -1
6082 0           print $log_handle $@;
6083 0           close($log_handle);
6084             }
6085 0 0         if ($Term::Menus::fullauto) {
6086 0           &Net::FullAuto::FA_Core::handle_error($@);
6087 0           } else { die $@ }
6088             } else {
6089 0           my $die="\n FATAL ERROR! - The Local "
6090             ."System $Term::Menus::local_hostname "
6091             ."Conveyed\n"
6092             ." the Following "
6093             ."Unrecoverable Error Condition :\n\n"
6094             ." $@\n line ".__LINE__;
6095 0 0 0       if ($parent_menu && wantarray && !$no_wantarray) {
      0        
6096 0           return '',$FullMenu,$Selected,$Conveyed,
6097             $SavePick,$SaveMMap,$SaveNext,
6098             $Persists,$parent_menu,$die;
6099             }
6100 0 0 0       if (defined $log_handle &&
6101             -1
6102 0           print $log_handle $die;
6103 0           close($log_handle);
6104             }
6105 0 0         if ($Term::Menus::fullauto) {
6106 0           &Net::FullAuto::FA_Core::handle_error($die);
6107 0           } else { die $die }
6108             }
6109             }
6110 0 0         if (-1<$#resu) {
6111 0 0         if ($resu[0] eq '<') { %picks=();next }
  0            
  0            
6112 0 0 0       if (0<$#resu && wantarray && !$no_wantarray) {
      0        
6113 0           return @resu;
6114             } else {
6115 0           return return_result($resu[0],
6116             $MenuUnit_hash_ref,$Conveyed);
6117             }
6118             }
6119 0           $done=1;last
6120 0           }
6121 0           } else { $done=1;last }
  0            
6122 0           return 'DONE_SUB';
6123             } elsif (($show_banner_only && exists $MenuUnit_hash_ref->
6124             {Result} && ref $MenuUnit_hash_ref->{Result}
6125 0           eq 'CODE')||(keys %{$FullMenu->{$MenuUnit_hash_ref}[2]}
6126             && exists $FullMenu->{$MenuUnit_hash_ref}[2]
6127             {$pn{$numbor}[0]})) {
6128 0           my $test_result='';
6129 0 0         if ($show_banner_only) {
6130 0           $test_result=$MenuUnit_hash_ref->{Result};
6131 0           $numbor=1;
6132             } else {
6133             $test_result=
6134 0           $FullMenu->{$MenuUnit_hash_ref}[2]{$pn{$numbor}[0]};
6135             }
6136 0 0 0       if (ref $test_result eq 'CODE') {
    0          
6137 0           my @resu=();
6138 0           my $test_result_loop=$test_result;
6139 0           while (1) {
6140 0           my $look_at_test_result=
6141             &Data::Dump::Streamer::Dump(
6142             $test_result_loop)->Out();
6143 0           my $tspmi_regex=qr/\](!)?t(?:e+st[-_]*)*[p|s]*
6144             (?:r+vious[-_]*|e+lected[-_]*)
6145             *m*(?:e+nu[-_]*)*i*(?:t+ems[-_]*)*\[/xi;
6146 0           my $sicm_regex=
6147             qr/\](!)?s(?:e+lected[-_]*)*i*(?:t+ems[-_]*)
6148             *c*(?:u+rrent[-_]*)*m*(?:e+nu[-_]*)*\[/xi;
6149 0           my $tbii_regex=qr/\](!)?i(?:n+put[-_]*)*b*(?:a+nner[-_]*)
6150             *m*(?:e+nu[-_]*)*i*(?:t+ems[-_]*)*\[/xi;
6151 0           my $trim_look=$look_at_test_result;
6152 0           $trim_look=~s/^.*(\$CODE\d+\s*=\s*.*$)/$1/s;
6153 0 0 0       if ((($trim_look!~/Item_/s &&
      0        
      0        
      0        
      0        
6154             $trim_look!~/[']Result['][,]/s) ||
6155             $trim_look=~/=\s*[']Item_/s) ||
6156             $look_at_test_result=~/$tspmi_regex/ ||
6157             $trim_look=~/$sicm_regex/ ||
6158             $trim_look=~/$tbii_regex/) {
6159 0 0         %picks=() unless $select_many;
6160 0           $picks{$numbor}='';
6161 0           ($FullMenu,$Conveyed,$SaveNext,$Persists,
6162             $Selected,$convey,$parent_menu)
6163             =$get_result->($MenuUnit_hash_ref,
6164             \@all_menu_items_array,\%picks,$picks_from_parent,
6165             $FullMenu,$Conveyed,$Selected,$SaveNext,
6166             $Persists,$parent_menu);
6167 0 0         my $item=($show_banner_only)?'__FA_Banner__':$numbor;
6168             $test_result_loop=
6169             $Selected->{$MenuUnit_hash_ref}->{$item}
6170 0 0         if $Selected->{$MenuUnit_hash_ref}->{$item};
6171 0           my $cd=&Data::Dump::Streamer::Dump(
6172             $test_result_loop)->Out();
6173 0           $cd=&transform_pmsi($cd,
6174             $Conveyed,$SaveMMap,
6175             $picks_from_parent);
6176 0           $cd=&transform_mbir($cd,$Conveyed,$MenuUnit_hash_ref,
6177             $log_handle);
6178 0           $cd=~s/\$CODE\d*\s*=\s*//s;
6179 0           eval { $test_result_loop=eval $cd };
  0            
6180             }
6181 0           eval { @resu=$test_result_loop->() };
  0            
6182 0 0         if ($@) {
6183 0 0 0       if (10
6184 0 0 0       if ($parent_menu && wantarray && !$no_wantarray) {
      0        
6185 0           return '',$FullMenu,$Selected,$Conveyed,
6186             $SavePick,$SaveMMap,$SaveNext,
6187             $Persists,$parent_menu,$@;
6188             }
6189 0 0 0       if (defined $log_handle &&
6190             -1
6191 0           print $log_handle $@;
6192 0           close($log_handle);
6193             }
6194 0 0         if ($Term::Menus::fullauto) {
6195 0           &Net::FullAuto::FA_Core::handle_error($@);
6196 0           } else { die $@ }
6197             } else {
6198 0           my $die="\n FATAL ERROR! - The Local "
6199             ."System $Term::Menus::local_hostname "
6200             ."Conveyed\n"
6201             ." the Following "
6202             ."Unrecoverable Error Condition :\n\n"
6203             ." $@\n line ".__LINE__;
6204 0 0 0       if ($parent_menu && wantarray && !$no_wantarray) {
      0        
6205 0           return '',$FullMenu,$Selected,$Conveyed,
6206             $SavePick,$SaveMMap,$SaveNext,
6207             $Persists,$parent_menu,$die;
6208             }
6209 0 0 0       if (defined $log_handle &&
6210             -1
6211 0           print $log_handle $die;
6212 0           close($log_handle);
6213             }
6214 0 0         if ($Term::Menus::fullauto) {
6215 0           &Net::FullAuto::FA_Core::handle_error($die);
6216 0           } else { die $die }
6217             }
6218             }
6219 0 0 0       if (0==$#resu && ref $resu[0] eq 'CODE') {
6220 0           $test_result_loop=$resu[0];
6221 0           $SaveNext->{$MenuUnit_hash_ref}=$resu[0];
6222 0           next;
6223             } else {
6224 0           last;
6225             }
6226             }
6227 0 0         if (-1<$#resu) {
6228 0 0         if ($resu[0] eq '<') { %picks=();next }
  0            
  0            
6229 0 0 0       if (0<$#resu && wantarray && !$no_wantarray) {
    0 0        
6230 0           return \@resu;
6231             } elsif (ref $resu[0] eq 'HASH') {
6232 0 0 0       if (grep { /Item_/ } keys %{$resu[0]} && $parent_menu) {
  0            
6233 0 0         if (exists $FullMenu->{$parent_menu}[2]
6234             {'__FA_Banner__'}) {
6235             $FullMenu->{$MenuUnit_hash_ref}[2]
6236 0           {'__FA_Banner__'}=$resu[0];
6237             } else {
6238             $FullMenu->{$MenuUnit_hash_ref}[2]
6239 0           {$pn{$numbor}[0]}=$resu[0];
6240             }
6241             } else {
6242 0           $FullMenu->{$MenuUnit_hash_ref}[2]{'__FA_Banner__'}=
6243             $resu[0];
6244             }
6245             } else {
6246 0           return return_result($resu[0],
6247             $MenuUnit_hash_ref,$Conveyed);
6248             }
6249             }
6250             } elsif ($test_result!~/^&?(?:.*::)*(\w+)\s*[(]?.*[)]?\s*$/ ||
6251             !grep { $1 eq $_ } list_module(
6252             'main',$Term::Menus::fa_code)) {
6253 0           my $die="The \"Result14 =>\" Setting\n -> "
6254             .$test_result
6255             ."\n Found in the Menu Unit -> "
6256             .$MenuUnit_hash_ref
6257             ."\n is not a Menu Unit\,"
6258             ." and not a Valid SubRoutine.\n\n";
6259 0           die $die;
6260             }
6261 0 0         %picks=() unless $select_many;
6262 0           $picks{$numbor}='';
6263 0           ($FullMenu,$Conveyed,$SaveNext,$Persists,
6264             $Selected,$convey,$parent_menu)
6265             =$get_result->($MenuUnit_hash_ref,
6266             \@all_menu_items_array,\%picks,$picks_from_parent,
6267             $FullMenu,$Conveyed,$Selected,$SaveNext,
6268             $Persists,$parent_menu);
6269 0           my $show_banner_only=0;
6270 0           my $test_item='';
6271 0 0         if (exists $Selected->{$MenuUnit_hash_ref}{'__FA_Banner__'}) {
6272 0           $test_item=$Selected->{$MenuUnit_hash_ref}{'__FA_Banner__'};
6273 0           $show_banner_only=1;
6274             } else {
6275             $test_item=$FullMenu->{$MenuUnit_hash_ref}[2]
6276 0           {$pn{$numbor}[0]};
6277             }
6278 0   0       $test_item||='';
6279 0 0 0       if ((ref $test_item eq 'HASH' &&
      0        
6280 0           grep { /Item_/ } keys %{$test_item}) ||
  0            
6281             $show_banner_only) {
6282 0           $Conveyed->{&pw($MenuUnit_hash_ref)}=[];
6283 0 0         if (0<$#{[keys %picks]}) {
  0            
6284 0           foreach my $key (sort numerically keys %picks) {
6285 0           push @{$Conveyed->{&pw($MenuUnit_hash_ref)}},
  0            
6286             $all_menu_items_array[$key-1];
6287             }
6288             } else {
6289 0           $Conveyed->{&pw($MenuUnit_hash_ref)}=
6290             $all_menu_items_array[$numbor-1];
6291             }
6292 0           my $mcount=0;
6293 0 0         unless (exists $SaveMMap->{$MenuUnit_hash_ref}) {
6294 0 0         if ($filtered_menu) {
    0          
6295 0           my $pmap=[];
6296 0           foreach my $kee (keys %{$SaveMMap}) {
  0            
6297             my $map=&Data::Dump::Streamer::Dump(
6298 0           $SaveMMap->{$kee})->Out();
6299 0           $map=~s/\$ARRAY\d*\s*=\s*//s;
6300 0           my $m=eval $map;
6301 0 0         $pmap=$m if $#{$pmap}<$#{$m};
  0            
  0            
6302             }
6303 0           $SaveMMap->{$MenuUnit_hash_ref}=$pmap;
6304             $mcount=&get_Menu_map_count(
6305 0           $SaveMMap->{$MenuUnit_hash_ref});
6306             } elsif ($parent_menu) {
6307             my $parent_map=&Data::Dump::Streamer::Dump(
6308 0           $SaveMMap->{$parent_menu})->Out();
6309 0           $parent_map=~s/\$ARRAY\d*\s*=\s*//s;
6310 0           $SaveMMap->{$MenuUnit_hash_ref}=eval $parent_map;
6311             $mcount=&get_Menu_map_count(
6312 0           $SaveMMap->{$MenuUnit_hash_ref});
6313             } else {
6314 0           $SaveMMap->{$MenuUnit_hash_ref}=[];
6315             }
6316             }
6317 0 0         if (ref $convey eq 'ARRAY') {
6318 0           push @{$SaveMMap->{$MenuUnit_hash_ref}},
  0            
6319             [ ++$mcount, $convey->[0] ];
6320             } else {
6321 0           push @{$SaveMMap->{$MenuUnit_hash_ref}},
  0            
6322             [ ++$mcount, $convey ];
6323             }
6324 0           $MenuMap=$SaveMMap->{$MenuUnit_hash_ref};
6325 0           my $returned_FullMenu='';
6326 0           my $returned_Selected='';
6327 0           my $returned_Conveyed='';
6328 0           my $returned_SavePick='';
6329 0           my $returned_SaveMMap='';
6330 0           my $returned_SaveNext='';
6331 0           my $returned_Persists='';
6332 0           my $menu_result='';
6333 0 0         if ($show_banner_only) {
6334 0           $menu_result=$test_item;
6335             } else {
6336             $menu_result=$FullMenu->{$MenuUnit_hash_ref}[2]
6337 0           {$all_menu_items_array[$numbor-1]};
6338             }
6339             $SaveNext->{$MenuUnit_hash_ref}=$menu_result
6340 0 0         unless exists $SaveNext->{$MenuUnit_hash_ref};
6341 0           eval {
6342 0           ($menu_output,$returned_FullMenu,
6343             $returned_Selected,$returned_Conveyed,
6344             $returned_SavePick,$returned_SaveMMap,
6345             $returned_SaveNext,$returned_Persists)
6346             =&Menu($menu_result,$convey,
6347             $recurse_level,$FullMenu,
6348             $Selected,$Conveyed,$SavePick,
6349             $SaveMMap,$SaveNext,$Persists,
6350             $MenuUnit_hash_ref,$no_wantarray);
6351             }; # MENU RETURN MENURETURN 8
6352 0 0         print "MENU RETURN 8\n" if $menu_return_debug;
6353 0 0         die $@ if $@;
6354 0 0         chomp($menu_output) if !(ref $menu_output);
6355 0           my $test_for_menu_name=$MenuUnit_hash_ref->{Name};
6356 0 0 0       if ($menu_output eq '-') {
    0 0        
    0          
    0          
    0          
    0          
6357 0           $return_from_child_menu='-';
6358 0           next;
6359             } elsif ($menu_output eq '+') {
6360 0           $return_from_child_menu='+';
6361 0           next;
6362             } elsif ($menu_output eq 'DONE_SUB') {
6363 0           return 'DONE_SUB';
6364             } elsif ($menu_output eq 'DONE' and 1<$recurse_level) {
6365 0           return 'DONE';
6366             } elsif (ref $menu_output eq 'ARRAY' &&
6367             $menu_output->[0]=~
6368             /^[{]$test_for_menu_name[}][<]$/) {
6369 0           delete $Selected->{$MenuUnit_hash_ref};
6370 0           delete $Conveyed->{$MenuUnit_hash_ref};
6371 0           delete $SavePick->{$MenuUnit_hash_ref};
6372 0           delete $SaveMMap->{$MenuUnit_hash_ref};
6373 0           delete $SaveNext->{$MenuUnit_hash_ref};
6374 0           delete $Persists->{$MenuUnit_hash_ref};
6375             delete $FullMenu->{$MenuUnit_hash_ref}[2]
6376 0           {'__FA_Banner__'};
6377 0           %picks=();
6378             $start=$FullMenu->{$MenuUnit_hash_ref}[11]-1 if
6379 0 0         $start+$choose_num<$FullMenu->{$MenuUnit_hash_ref}[11];
6380 0 0         $choose_num=$num_pick-$start if
6381             $display_this_many_items>=$num_pick-$start;
6382 0           next;
6383             } elsif ($menu_output) {
6384 0           return $menu_output;
6385             } else {
6386 0           $FullMenu=$returned_FullMenu;
6387 0           $Selected=$returned_Selected;
6388 0           $Conveyed=$returned_Conveyed;
6389 0           $SavePick=$returned_SavePick;
6390 0           $SaveMMap=$returned_SaveMMap;
6391 0           $SaveNext=$returned_SaveNext;
6392 0           $Persists=$returned_Persists;
6393             }
6394             }
6395 0           my %pick=();
6396 0           $pick{$numbor}='*';
6397 0           %{$SavePick->{$MenuUnit_hash_ref}}=%pick;
  0            
6398 0 0         my $subfile=($Term::Menus::fullauto)
6399             ?substr($Term::Menus::fa_code,0,-3).'::'
6400             :'';
6401 0           foreach my $sub (&get_subs_from_menu($Selected)) {
6402 0           my @resu=();
6403 0 0         if (ref $sub eq 'CODE') {
6404 0 0 0       if ($Term::Menus::fullauto && (!exists
      0        
      0        
6405             $MenuUnit_hash_ref->{'NoPlan'} ||
6406             !$MenuUnit_hash_ref->{'NoPlan'}) &&
6407             defined $Net::FullAuto::FA_Core::makeplan) {
6408             #print "IN MAKEPLAN20\n";
6409 0 0 0       if (-1==$#{$Net::FullAuto::FA_Core::makeplan{
6410 0           'Plan'}} && !exists
6411             $Net::FullAuto::FA_Core::makeplan->{
6412             'Title'}) {
6413             $Net::FullAuto::FA_Core::makeplan->{'Title'}
6414 0           =$pn{$numbor}[0];
6415             }
6416             push @{$Net::FullAuto::FA_Core::makeplan->{
6417 0           'Plan'}},
6418             { Menu => &pw($MenuUnit_hash_ref),
6419             Number => $numbor,
6420             PlanID =>
6421             $Net::FullAuto::FA_Core::makeplan->{Number},
6422 0           Item =>
6423             &Data::Dump::Streamer::Dump($sub)->Out() }
6424             }
6425 0           eval { @resu=$sub->() };
  0            
6426 0 0         if ($@) {
6427 0 0 0       if (10
6428 0 0 0       if ($parent_menu && wantarray && !$no_wantarray) {
      0        
6429 0           return '',$FullMenu,$Selected,$Conveyed,
6430             $SavePick,$SaveMMap,$SaveNext,
6431             $Persists,$parent_menu,$@;
6432             }
6433 0 0 0       if (defined $log_handle &&
6434             -1
6435 0           print $log_handle $@;
6436 0           close($log_handle);
6437             }
6438 0 0         if ($Term::Menus::fullauto) {
6439 0           &Net::FullAuto::FA_Core::handle_error($@);
6440 0           } else { die $@ }
6441             } else {
6442 0           my $die="\n FATAL ERROR! - The Local "
6443             ."System $Term::Menus::local_hostname "
6444             ."Conveyed\n"
6445             ." the Following "
6446             ."Unrecoverable Error Condition :\n\n"
6447             ." $@\n line ".__LINE__;
6448 0 0 0       if ($parent_menu && wantarray && !$no_wantarray) {
      0        
6449 0           return '',$FullMenu,$Selected,$Conveyed,
6450             $SavePick,$SaveMMap,$SaveNext,
6451             $Persists,$parent_menu,$die;
6452             }
6453 0 0 0       if (defined $log_handle &&
6454             -1
6455 0           print $log_handle $die;
6456 0           close($log_handle);
6457             }
6458 0 0         if ($Term::Menus::fullauto) {
6459 0           &Net::FullAuto::FA_Core::handle_error($die);
6460 0           } else { die $die }
6461             }
6462             }
6463 0 0         if (-1<$#resu) {
6464 0 0         if ($resu[0] eq '<') { %picks=();next }
  0            
  0            
6465 0 0         if ($resu[0]=~/^[{](.*)[}][<]$/) {
6466 0 0         if ($1 eq $MenuUnit_hash_ref->{Name}) {
6467 0           %picks=();next;
  0            
6468             } else {
6469 0           return $resu[0];
6470             }
6471             }
6472 0 0 0       if (0<$#resu && wantarray && !$no_wantarray) {
      0        
6473 0           return @resu;
6474             } else {
6475 0           return return_result($resu[0],
6476             $MenuUnit_hash_ref,$Conveyed);
6477             }
6478             }
6479 0           $done=1;last
6480 0           }
6481 0           eval {
6482 0 0         if ($subfile) {
6483 0           $sub=~s/^[&]//;
6484 0 0 0       if ($Term::Menus::fullauto && (!exists
      0        
      0        
6485             ${$MenuUnit_hash_ref}{'NoPlan'} ||
6486             !${$MenuUnit_hash_ref}{'NoPlan'}) &&
6487             defined $Net::FullAuto::FA_Core::makeplan) {
6488             #print "IN MAKEPLAN21\n";
6489 0 0 0       if (-1==$#{$Net::FullAuto::FA_Core::makeplan{
6490 0           'Plan'}} && !exists
6491             $Net::FullAuto::FA_Core::makeplan->{
6492             'Title'}) {
6493             $Net::FullAuto::FA_Core::makeplan->{'Title'}
6494 0           =$pn{$numbor}[0];
6495             }
6496 0           my $n='Number';
6497             push @{$Net::FullAuto::FA_Core::makeplan->{
6498 0           'Plan'}},
6499             { Menu => &pw($MenuUnit_hash_ref),
6500             Number => $numbor,
6501             PlanID =>
6502 0           $Net::FullAuto::FA_Core::makeplan->{$n},
6503             Item => "&$subfile$sub" }
6504             }
6505             $sub=&transform_sicm($sub,$numbor,
6506             \@all_menu_items_array,\%picks,\%pn,
6507             $return_from_child_menu,$log_handle,
6508 0           $MenuUnit_hash_ref->{Name});
6509 0           $sub=&transform_pmsi($sub,
6510             $Conveyed,$SaveMMap,
6511             $picks_from_parent);
6512 0           eval "\@resu=\&$subfile$sub";
6513 0   0       my $firsterr=$@||'';
6514 0 0 0       if ((-1
    0          
6515             (-1
6516 0 0         if ($sub!~/::/) {
6517 0           eval "\@resu=main::$sub";
6518             } else {
6519 0           eval "\@resu=$sub";
6520             }
6521 0   0       my $seconderr=$@||'';my $die='';
  0            
6522 0 0         if ($seconderr=~/Undefined subroutine/) {
6523 0 0         if (${$FullMenu}{$MenuUnit_hash_ref}
  0            
6524             [2]{$all_menu_items_array[$numbor-1]}) {
6525             $die="The \"Result15 =>\" Setting"
6526 0           ."\n\t\t-> " . ${$FullMenu}
6527             {$MenuUnit_hash_ref}[2]
6528             {$all_menu_items_array[$numbor-1]}
6529             ."\n\t\tFound in the Menu Unit -> "
6530 0           .$MenuUnit_hash_ref->{Name}."\n\t\t"
6531             ."Specifies a Subroutine"
6532             ." that Does NOT Exist"
6533             ."\n\t\tin the User Code File "
6534             .$Term::Menus::fa_code
6535             .",\n\t\tnor was a routine with "
6536             ."that name\n\t\tlocated in the"
6537             ." main:: script.\n";
6538 0           } else { $die="$firsterr\n $seconderr" }
6539 0           } else { $die=$seconderr }
6540 0           &Net::FullAuto::FA_Core::handle_error($die.
6541             "\n\n line ".__LINE__);
6542             } elsif ($firsterr) {
6543 0 0         if ($Term::Menus::fullauto) {
6544 0           &Net::FullAuto::FA_Core::handle_error($firsterr.
6545             "\n\n line ".__LINE__);
6546             } else {
6547 0           die "$firsterr\n\n line ".__LINE__;
6548             }
6549             }
6550             } else {
6551             $sub=&transform_sicm($sub,$numbor,
6552             \@all_menu_items_array,\%picks,\%pn,
6553             $return_from_child_menu,$log_handle,
6554 0           $MenuUnit_hash_ref->{Name});
6555 0           $sub=&transform_pmsi($sub,
6556             $Conveyed,$SaveMMap,
6557             $picks_from_parent);
6558 0 0         if ($sub!~/::/) {
6559 0           $sub=~s/^[&]//;
6560 0           eval "\@resu=main::$sub";
6561             } else {
6562 0           eval "\@resu=$sub";
6563             }
6564 0 0         if ($@) {
6565 0           my $er=$@."\n line ";
6566 0           die $er.__LINE__;
6567             }
6568             }
6569             };
6570 0 0         if ($@) {
6571 0 0 0       if (10
6572 0 0 0       if ($parent_menu && wantarray && !$no_wantarray) {
      0        
6573 0           return '',$FullMenu,$Selected,$Conveyed,
6574             $SavePick,$SaveMMap,$SaveNext,
6575             $Persists,$parent_menu,$@;
6576             }
6577 0 0 0       if (defined $log_handle &&
6578             -1
6579 0           print $log_handle $@;
6580 0           close($log_handle);
6581             }
6582 0 0         if ($Term::Menus::fullauto) {
6583 0           &Net::FullAuto::FA_Core::handle_error($@);
6584 0           } else { die $@ }
6585             } else {
6586 0           my $die="\n FATAL ERROR! - The Local "
6587             ."System $Term::Menus::local_hostname "
6588             ."Conveyed\n"
6589             ." the Following "
6590             ."Unrecoverable Error Condition :\n\n"
6591             ." $@\n line ".__LINE__;
6592 0 0 0       if ($parent_menu && wantarray && !$no_wantarray) {
      0        
6593 0           return '',$FullMenu,$Selected,$Conveyed,
6594             $SavePick,$SaveMMap,$SaveNext,
6595             $Persists,$parent_menu,$die;
6596             }
6597 0 0 0       if (defined $log_handle &&
6598             -1
6599 0           print $log_handle $die;
6600 0           close($log_handle);
6601             }
6602 0 0         if ($Term::Menus::fullauto) {
6603 0           &Net::FullAuto::FA_Core::handle_error($die);
6604 0           } else { die $die }
6605             }
6606             }
6607 0 0         if (-1<$#resu) {
6608 0 0         if ($resu[0] eq '<') { %picks=();next }
  0            
  0            
6609 0 0         if ($resu[0]=~/^[{](.*)[}][<]$/) {
6610 0 0         if ($1 eq $MenuUnit_hash_ref->{Name}) {
6611 0           %picks=();next;
  0            
6612             } else {
6613 0           return $resu[0];
6614             }
6615             }
6616 0 0 0       if (0<$#resu && wantarray && !$no_wantarray) {
      0        
6617 0           return @resu;
6618             } else {
6619 0           return return_result($resu[0],
6620             $MenuUnit_hash_ref,$Conveyed);
6621             }
6622             }
6623 0           $done=1;last
6624 0           }
6625 0           return 'DONE_SUB';
6626             } elsif ($return_from_child_menu &&
6627             !exists $SavePick->{$MenuUnit_hash_ref}->{$pn{$numbor}}) {
6628 0           delete_Selected($MenuUnit_hash_ref);
6629 0           $done=1;last;
  0            
6630 0           } else { $done=1 }
6631 0 0         last if !$return_from_child_menu;
6632             }
6633 0 0         } last if $done;
6634             }
6635 0 0 0       if ($select_many ||
      0        
6636 0           (exists ${$MenuUnit_hash_ref}{Select}{(keys %picks)[0]||''})) {
6637 0           my @picks=();
6638 0           foreach (sort numerically keys %picks) {
6639 0           my $pik=$all_menu_items_array[$_-1];
6640 0           push @picks, $pik;
6641 0           } undef @all_menu_items_array;
6642 0 0         if ($MenuUnit_hash_ref) {
6643 0           push @picks,\%picks;
6644 0           push @picks,$MenuUnit_hash_ref;
6645 0           return \@picks,
6646             $FullMenu,$Selected,$Conveyed,
6647             $SavePick,$SaveMMap,$SaveNext,
6648             $Persists,$parent_menu;
6649             } else {
6650 0           return @picks;
6651             }
6652             }
6653 0           my $pick='';
6654 0 0         if ($filtered_menu) {
    0          
6655 0           $pick=${$FullMenu}{$MenuUnit_hash_ref}[10]->[$numbor-1];
  0            
6656             } elsif ($numbor=~/^\d+$/) {
6657 0           $pick=$all_menu_items_array[$numbor-1];
6658             }
6659 0           undef @all_menu_items_array;
6660 0 0 0       if ($Term::Menus::fullauto && (!exists ${$MenuUnit_hash_ref}{'NoPlan'} ||
      0        
      0        
6661             !${$MenuUnit_hash_ref}{'NoPlan'}) &&
6662             defined $Net::FullAuto::FA_Core::makeplan) {
6663             #print "IN MAKEPLAN23\n";
6664 0 0 0       if (-1==$#{$Net::FullAuto::FA_Core::makeplan{'Plan'}} &&
  0            
6665             !exists $Net::FullAuto::FA_Core::makeplan->{'Title'}) {
6666 0           $Net::FullAuto::FA_Core::makeplan->{'Title'}=$pick;
6667             }
6668 0 0         unless ($got_default) {
6669 0           push @{$Net::FullAuto::FA_Core::makeplan->{'Plan'}},
6670             { Menu => &pw($MenuUnit_hash_ref),
6671             Number => $numbor,
6672             PlanID =>
6673             $Net::FullAuto::FA_Core::makeplan->{Number},
6674 0           Item => $pick }
6675             }
6676             }
6677 0 0         if (wantarray) {
6678 0           return $pick,
6679             $FullMenu,$Selected,$Conveyed,
6680             $SavePick,$SaveMMap,$SaveNext,
6681             $Persists,$parent_menu;
6682             } else {
6683 0           return $pick;
6684             }
6685            
6686             }
6687            
6688             sub return_result {
6689            
6690 0     0 0   my $result_string=$_[0];
6691 0           my $MenuUnit_hash_ref=$_[1];
6692 0           my $Conveyed=$_[2];
6693 0           $Conveyed->{&pw($MenuUnit_hash_ref)}=$result_string;
6694 0           my $result_array=[];
6695 0 0 0       if ((-1
6696             (-1
6697 0           $result_string=~s/^\s*\]\[\[\s*//s;
6698 0           $result_string=~s/\s*\]\]\[\s*$//s;
6699 0           my @elems=split /\s*\]\|\[\s*/,$result_string;
6700 0           foreach my $elem (@elems) {
6701 0 0         if (unpack('a5',$elem) eq 'eval ') {
6702 0           $elem=unpack('x5 a*',$elem);
6703 0           push @{$result_array}, eval $elem;
  0            
6704             } else {
6705 0           push @{$result_array}, $elem;
  0            
6706             }
6707             }
6708 0           } return [ $result_string ];
6709            
6710             }
6711            
6712             sub escape_quotes {
6713            
6714 0     0 0   my $sub=$_[0];
6715 0 0         return $sub if -1==index $sub,'"';
6716 0           my $routine=substr($sub,0,(index $sub,'(')+1);
6717 0           my $args=substr($sub,(index $sub,'(')+1,-1);
6718 0           $args=~s/[']/!%!'%!%/g;
6719 0           $args=~s/^\s*(["]|!%!)//;$args=~s/(["]|%!%)\s*$//;
  0            
6720 0           my @args=split /(?:["]|%!%)\s*,\s*(?:["]|!%!)/, $args;
6721 0           my @newargs=();
6722 0           foreach my $arg (@args) {
6723 0           $arg=~s/(!%!|%!%)//g;
6724 0 0         if ($arg=~/^[']/) {
6725 0           push @newargs, $arg;
6726             } else {
6727 0           $arg=~s/["]/\\"/g;
6728 0           push @newargs, '"'.$arg.'"';
6729             }
6730             }
6731 0           $sub=$routine;
6732 0           foreach my $arg (@newargs) {
6733 0           $sub.=$arg.",";
6734             }
6735 0           chop $sub;
6736 0           $sub.=')';
6737 0           return $sub;
6738            
6739             }
6740            
6741             1;
6742            
6743             package TMMemHandle;
6744            
6745 1     1   15 use strict;
  1         5  
  1         387  
6746             sub TIEHANDLE {
6747 0     0     my $class = shift;
6748 0           bless [], $class;
6749             }
6750            
6751             sub PRINT {
6752 0     0     my $self = shift;
6753 0           push @$self, join '', @_;
6754             }
6755            
6756             sub PRINTF {
6757 0     0     my $self = shift;
6758 0           my $fmt = shift;
6759 0           push @$self, sprintf $fmt, @_;
6760             }
6761            
6762             sub READLINE {
6763 0     0     my $self = shift;
6764 0           shift @$self;
6765             }
6766            
6767             1;
6768            
6769             __END__;