- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
sub pfexec { args "pfexec", @_ unless $1.$2 eq "pfexec";
local ( $_, $lp, @rep ) = @_; $lp ||= 1;
die 'Command string must not contain $$ sequences' if m/\$\$/o;
1 while s/\(([^()]*)\)/'$$'.push(@rep,$1)/eo;
# print $_,"REP:\n","=>",join( "\n=>", @rep),"\n";
unshift @rep, ""; s/\s+/ /g;
LOOP: while ( $lp-- ) {
foreach ( split ";" ){
my @cmd = split " "; $_ = shift @cmd; last unless m/^(\w{2})(\w+)/o;
CMD: foreach (@cmd){
1 while s/\$\$(\d+)/'('.$rep[$1].')'/eo; s/^\(\s*(.*?)\s*\)$/$1/so;
s/^\%(\d+)->(\w+)=// and ${$HASH[$1]} ->{$2} = $_ and next;
/^\%(\d+)->(\w+)/ and $_ = ${$HASH[$1]} ->{$2} and redo CMD;
/^%%(\d+)/ and $_ = $HASH[$1] || ( $HASH[$1] = \{} ) and next;
/^\%(\d+)/ and $_ = ${$HASH[$1]} and next;
/^\#\#(\d+)/ and $_ = $CHAN[$1] || ( $CHAN[$1] = \{} ) and next;
/^\#(\d+)/ and $_ = ${$CHAN[$1]} and next;
}
$_ = $::control{$1} && $::control{$1}{$2};
s/\^(\d+)/$cmd[$1-1]/geo and print "Expanded to: $_\n"
and pfexec( $_ ) if !ref;
args $1.$2, @cmd and eval { $_->(@cmd) } if "CODE" eq ref;
last LOOP if $@;
}
}