| 1 | # | ||
| 2 | # Copyright (c) 2004-2022 Christian Jaeger, copying@christianjaeger.ch | ||
| 3 | # | ||
| 4 | # This is free software, offered under either the same terms as perl 5 | ||
| 5 | # or the terms of the Artistic License version 2 or the terms of the | ||
| 6 | # MIT License (Expat version). See the file COPYING.md that came | ||
| 7 | # bundled with this file. | ||
| 8 | # | ||
| 9 | |||
| 10 | # Depends: () | ||
| 11 | |||
| 12 | =head1 NAME | ||
| 13 | |||
| 14 | FP::Repl::corefuncs | ||
| 15 | |||
| 16 | =head1 SYNOPSIS | ||
| 17 | |||
| 18 | =head1 DESCRIPTION | ||
| 19 | |||
| 20 | Returns a list of all perl CORE functions | ||
| 21 | |||
| 22 | =head1 NOTE | ||
| 23 | |||
| 24 | This is alpha software! Read the status section in the package README | ||
| 25 | or on the L<website|http://functional-perl.org/>. | ||
| 26 | |||
| 27 | =cut | ||
| 28 | |||
| 29 | package FP::Repl::corefuncs; | ||
| 30 | 2 | ▶ | use Exporter "import"; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 31 | 2 | our @EXPORT = qw(corefuncs); | |
| 32 | |||
| 33 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 34 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 35 | 2 | ▶ | use warnings FATAL => 'uninitialized'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 36 | |||
| 37 | { | ||
| 38 | # for some reason I can't seem to find out how to get at that otherwise. | ||
| 39 | 2 | my $txt = <<'END'; | |
| 40 | |||
| 41 | Functions for SCALARs or strings | ||
| 42 | "chomp", "chop", "chr", "crypt", "hex", "index", "lc", "lcfirst", "length", | ||
| 43 | "oct", "ord", "pack", "q/STRING/", "qq/STRING/", "reverse", "rindex", | ||
| 44 | "sprintf", "substr", "tr///", "uc", "ucfirst", "y///" | ||
| 45 | |||
| 46 | Regular expressions and pattern matching | ||
| 47 | "m//", "pos", "quotemeta", "s///", "split", "study", "qr//" | ||
| 48 | |||
| 49 | Numeric functions | ||
| 50 | "abs", "atan2", "cos", "exp", "hex", "int", "log", "oct", "rand", "sin", | ||
| 51 | "sqrt", "srand" | ||
| 52 | |||
| 53 | Functions for real @ARRAYs | ||
| 54 | "pop", "push", "shift", "splice", "unshift" | ||
| 55 | |||
| 56 | Functions for list data | ||
| 57 | "grep", "join", "map", "qw/STRING/", "reverse", "sort", "unpack" | ||
| 58 | |||
| 59 | Functions for real %HASHes | ||
| 60 | "delete", "each", "exists", "keys", "values" | ||
| 61 | |||
| 62 | Input and output functions | ||
| 63 | "binmode", "close", "closedir", "dbmclose", "dbmopen", "die", "eof", "fileno", | ||
| 64 | "flock", "format", "getc", "print", "printf", "read", "readdir", "rewinddir", | ||
| 65 | "seek", "seekdir", "select", "syscall", "sysread", "sysseek", "syswrite", | ||
| 66 | "tell", "telldir", "truncate", "warn", "write" | ||
| 67 | |||
| 68 | Functions for fixed length data or records | ||
| 69 | "pack", "read", "syscall", "sysread", "syswrite", "unpack", "vec" | ||
| 70 | |||
| 71 | Functions for filehandles, files, or directories | ||
| 72 | "-X", "chdir", "chmod", "chown", "chroot", "fcntl", "glob", "ioctl", "link", | ||
| 73 | "lstat", "mkdir", "open", "opendir", "readlink", "rename", "rmdir", "stat", | ||
| 74 | "symlink", "umask", "unlink", "utime" | ||
| 75 | |||
| 76 | Keywords related to the control flow of your perl program | ||
| 77 | "caller", "continue", "die", "do", "dump", "eval", "exit", "goto", "last", | ||
| 78 | "next", "redo", "return", "sub", "wantarray" | ||
| 79 | |||
| 80 | Keywords related to scoping | ||
| 81 | "caller", "import", "local", "my", "our", "package", "use" | ||
| 82 | |||
| 83 | Miscellaneous functions | ||
| 84 | "defined", "dump", "eval", "formline", "local", "my", "our", "reset", "scalar", | ||
| 85 | "undef", "wantarray" | ||
| 86 | |||
| 87 | Functions for processes and process groups | ||
| 88 | "alarm", "exec", "fork", "getpgrp", "getppid", "getpriority", "kill", "pipe", | ||
| 89 | "qx/STRING/", "setpgrp", "setpriority", "sleep", "system", "times", "wait", | ||
| 90 | "waitpid" | ||
| 91 | |||
| 92 | Keywords related to perl modules | ||
| 93 | "do", "import", "no", "package", "require", "use" | ||
| 94 | |||
| 95 | Keywords related to classes and object-orientedness | ||
| 96 | "bless", "dbmclose", "dbmopen", "package", "ref", "tie", "tied", "untie", "use" | ||
| 97 | |||
| 98 | Low-level socket functions | ||
| 99 | "accept", "bind", "connect", "getpeername", "getsockname", "getsockopt", "lis | ||
| 100 | ten", "recv", "send", "setsockopt", "shutdown", "socket", "socketpair" | ||
| 101 | |||
| 102 | System V interprocess communication functions | ||
| 103 | "msgctl", "msgget", "msgrcv", "msgsnd", "semctl", "semget", "semop", "shmctl", | ||
| 104 | "shmget", "shmread", "shmwrite" | ||
| 105 | |||
| 106 | Fetching user and group info | ||
| 107 | "endgrent", "endhostent", "endnetent", "endpwent", "getgrent", "getgrgid", | ||
| 108 | "getgrnam", "getlogin", "getpwent", "getpwnam", "getpwuid", "setgrent", "setp | ||
| 109 | went" | ||
| 110 | |||
| 111 | Fetching network info | ||
| 112 | "endprotoent", "endservent", "gethostbyaddr", "gethostbyname", "gethostent", | ||
| 113 | "getnetbyaddr", "getnetbyname", "getnetent", "getprotobyname", "getprotobynum | ||
| 114 | ber", "getprotoent", "getservbyname", "getservbyport", "getservent", "sethos | ||
| 115 | tent", "setnetent", "setprotoent", "setservent" | ||
| 116 | |||
| 117 | Time-related functions | ||
| 118 | "gmtime", "localtime", "time", "times" | ||
| 119 | |||
| 120 | Functions new in perl5 | ||
| 121 | "abs", "bless", "chomp", "chr", "exists", "formline", "glob", "import", "lc", | ||
| 122 | "lcfirst", "map", "my", "no", "our", "prototype", "qx", "qw", "readline", | ||
| 123 | "readpipe", "ref", "sub*", "sysopen", "tie", "tied", "uc", "ucfirst", "untie", | ||
| 124 | "use" | ||
| 125 | END | ||
| 126 | |||
| 127 | 2 | $txt =~ s/(\w)[-]\s*(\w)/$1$2/sg | |
| 128 | ; # careful: the - are two different chars. | ||
| 129 | #print $txt; | ||
| 130 | 2 | my @corefuncs = grep { length($_) >= 3 } $txt =~ /"(\w+)"/g; | |
| 131 | 2 | ▶ | no warnings 'redefine'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 132 | 1 | ▶ | *corefuncs = sub { |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 133 | @corefuncs | ||
| 134 | 1 | }; | |
| 135 | } | ||
| 136 | |||
| 137 | 2 | *FP::Repl::corefuncs = \&corefuncs; | |
| 138 | |||
| 139 | 2 | 1 | |