Zoom-Meeting
view release on metacpan or search on metacpan
local/lib/perl5/PPIx/Utils/Classification.pm view on Meta::CPAN
}
my %BUILTINS = map { $_ => 1 } @B::Keywords::Functions;
sub is_perl_builtin {
my $elem = shift;
return undef if !$elem;
return exists $BUILTINS{ _name_for_sub_or_stringified_element($elem) };
}
my %BAREWORDS = map { $_ => 1 } @B::Keywords::Barewords;
sub is_perl_bareword {
my $elem = shift;
return undef if !$elem;
return exists $BAREWORDS{ _name_for_sub_or_stringified_element($elem) };
}
sub _build_globals_without_sigils {
my @globals =
map { substr $_, 1 }
@B::Keywords::Arrays,
@B::Keywords::Hashes,
@B::Keywords::Scalars;
# Not all of these have sigils
foreach my $filehandle (@B::Keywords::Filehandles) {
(my $stripped = $filehandle) =~ s< \A [*] ><>x;
push @globals, $stripped;
}
return @globals;
}
my %GLOBALS = map { $_ => 1 } _build_globals_without_sigils();
sub is_perl_global {
my $elem = shift;
return undef if !$elem;
my $var_name = "$elem"; #Convert Token::Symbol to string
$var_name =~ s{\A [\$@%*] }{}x; #Chop off the sigil
return exists $GLOBALS{ $var_name };
}
my %FILEHANDLES = map { $_ => 1 } @B::Keywords::Filehandles;
sub is_perl_filehandle {
my $elem = shift;
return undef if !$elem;
return exists $FILEHANDLES{ _name_for_sub_or_stringified_element($elem) };
}
# egrep '=item.*LIST' perlfunc.pod
my %BUILTINS_WHICH_PROVIDE_LIST_CONTEXT =
map { $_ => 1 }
qw{
chmod
chown
die
exec
formline
grep
import
join
kill
map
no
open
pack
print
printf
push
reverse
say
sort
splice
sprintf
syscall
system
tie
unlink
unshift
use
utime
warn
};
sub is_perl_builtin_with_list_context {
my $elem = shift;
return
exists
$BUILTINS_WHICH_PROVIDE_LIST_CONTEXT{
_name_for_sub_or_stringified_element($elem)
};
}
# egrep '=item.*[A-Z],' perlfunc.pod
my %BUILTINS_WHICH_TAKE_MULTIPLE_ARGUMENTS =
map { $_ => 1 }
qw{
accept
atan2
bind
binmode
bless
connect
crypt
dbmopen
fcntl
flock
gethostbyaddr
getnetbyaddr
getpriority
getservbyname
getservbyport
getsockopt
index
( run in 1.055 second using v1.01-cache-2.11-cpan-5511b514fd6 )