Perl-ToPerl6
view release on metacpan or search on metacpan
lib/Perl/ToPerl6/Utils.pm view on Meta::CPAN
Readonly::Hash my %BUILTINS_WHICH_TAKE_NO_ARGUMENTS =>
hashify(
qw{
endgrent
endhostent
endnetent
endprotoent
endpwent
endservent
fork
format
getgrent
gethostent
getlogin
getnetent
getppid
getprotoent
getpwent
getservent
setgrent
setpwent
split
time
times
wait
wantarray
}
);
sub is_perl_builtin_with_no_arguments {
my $elem = shift;
return
exists
$BUILTINS_WHICH_TAKE_NO_ARGUMENTS{
_name_for_sub_or_stringified_element($elem)
};
}
#-----------------------------------------------------------------------------
Readonly::Hash my %BUILTINS_WHICH_TAKE_ONE_ARGUMENT =>
hashify(
qw{
closedir
dbmclose
delete
each
exists
fileno
getgrgid
getgrnam
gethostbyname
getnetbyname
getpeername
getpgrp
getprotobyname
getprotobynumber
getpwnam
getpwuid
getsockname
goto
keys
local
prototype
readdir
readline
readpipe
rewinddir
scalar
sethostent
setnetent
setprotoent
setservent
telldir
tied
untie
values
}
);
sub is_perl_builtin_with_one_argument {
my $elem = shift;
return
exists
$BUILTINS_WHICH_TAKE_ONE_ARGUMENT{
_name_for_sub_or_stringified_element($elem)
};
}
#-----------------------------------------------------------------------------
Readonly::Hash my %BUILTINS_WHICH_TAKE_OPTIONAL_ARGUMENT =>
hashify(
grep { not exists $BUILTINS_WHICH_TAKE_ONE_ARGUMENT{ $_ } }
grep { not exists $BUILTINS_WHICH_TAKE_NO_ARGUMENTS{ $_ } }
grep { not exists $BUILTINS_WHICH_TAKE_MULTIPLE_ARGUMENTS{ $_ } }
@B::Keywords::Functions
);
## use mogrify
sub is_perl_builtin_with_optional_argument {
my $elem = shift;
return
exists
$BUILTINS_WHICH_TAKE_OPTIONAL_ARGUMENT{
_name_for_sub_or_stringified_element($elem)
};
}
#-----------------------------------------------------------------------------
sub is_perl_builtin_with_zero_and_or_one_arguments {
my $elem = shift;
return if not $elem;
my $name = _name_for_sub_or_stringified_element($elem);
( run in 2.010 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )