What is the best way to get all Perl built-in functions as a list?

I am trying to update an xml file to highlight syntax, and so I was wondering what is the easiest way to get a list of all Perl built-in functions.

+6
source share
4 answers

Here is a brief implementation of the cnicutar idea:

use Pod::Find qw(pod_where); my $perlfunc_path = pod_where({ -inc => 1 }, 'perlfunc'); open my $in, "<", $perlfunc_path or die "$perlfunc_path: $!"; while(<$in>) { last if /=head2 Alphabetical/; } while(<$in>) { print "$1\n" if /=item (.{2,})/; } 

Gives you a list including the following options:

 -X FILEHANDLE -X EXPR -X DIRHANDLE -X abs VALUE abs ... 
+9
source

See the toke.c file in the perl source:

  $ perl -nE 'next unless /case KEY_(\S+):/; say $1' toke.c | sort | uniq 

You will find many things that will not be displayed in perlfunc. However, it depends on how you want to segment those different things that you want to color.

You can also look at PPI , the static Perl parser, or existing Perl syntax syntaxes.

+5
source

I would analyze perldoc perlfunc (part of "Perl Functions by Category").

+3
source

I came across the same question and now

 egrep '^=item' /usr/lib/perl5/5.10.0/pod/perlfunc.pod | perl -anle '$F[1]=~s/\W//g; print $F[1]' | sort | uniq 

worked for me (but, be careful, this is not ideal)

0
source

Source: https://habr.com/ru/post/892926/


All Articles