package Psh
::Strategy
::Perlfunc
;
Tries to detect perl builtins - this is helpful if you e.g. have
a print command on your system. This is a small, minimal version
without options which will react on your own sub's or on a limited
list of important perl builtins. Please also see the strategy
@Psh::Strategy
::Perlfunc
::ISA
=('Psh::Strategy');
sub new
{ Psh
::Strategy
::new
(@_) }
return Psh
::Strategy
::CONSUME_TOKENS
;
return qw(perlscript auto_resume executable);
print 1 printf 1 push 1 pop 1 shift 1 unshift 1 system 1
chop 1 chomp 1 use 1 for 1 foreach 1 sub 1 do 1
# catch "join(':',@foo)" here as well:
$fnname = (split('\(', $fnname))[0];
if (exists $perl_builtins{$fnname}) {
my $needArgs = $perl_builtins{$fnname};
or scalar(@
{$_[2]}) >= $needArgs)) {
} elsif( $fnname =~ /^([a-zA-Z0-9_]+)\:\:([a-zA-Z0-9_:]+)$/) {
my $needArgs = $perl_builtins{$2};
and ($parenthesized or scalar(@
{$_[2]}) >= $needArgs)) {
$qPerlFunc = (Psh
::PerlEval
::protected_eval
("defined(&{'$fnname'})"))[0];
} elsif( $fnname =~ /^[a-zA-Z0-9_]+$/) {
$qPerlFunc = (Psh
::PerlEval
::protected_eval
("defined(&{'$fnname'})"))[0];
return $line if $qPerlFunc;
return Psh
::Strategy
::Eval
::execute
(@args);