File Coverage

lib/B/Keywords.pm
Criterion Covered Total %
statement 43 43 100.0
branch n/a
condition n/a
subroutine 15 15 100.0
pod n/a
total 58 58 100.0


line stmt bran cond sub pod time code
1             ## no critic (PodSections,UseWarnings,Interpolation,EndWithOne,NoisyQuotes)
2              
3             package B::Keywords;
4              
5 3     3   203233 use strict;
  3         5  
  3         170  
6              
7             require Exporter;
8             *import = *import = \&Exporter::import;
9              
10 3     3   16 use vars qw( @EXPORT_OK %EXPORT_TAGS );
  3         4  
  3         264  
11             @EXPORT_OK = qw( @Scalars @Arrays @Hashes @Filehandles @Symbols
12             @Functions @Barewords @TieIOMethods @UNIVERSALMethods
13             @ExporterSymbols );
14             %EXPORT_TAGS = ( 'all' => \@EXPORT_OK );
15              
16 3     3   16 use vars '$VERSION';
  3         4  
  3         236  
17             $VERSION = '1.29';
18             my $CPERL = $^V =~ /c$/ ? 1 : 0;
19              
20 3     3   15 use vars '@Scalars';
  3         3  
  3         480  
21             @Scalars = (
22             qw( $a
23             $b
24             $_ $ARG
25             $& $MATCH
26             $` $PREMATCH
27             $' $POSTMATCH
28             $+ $LAST_PAREN_MATCH ),
29             ($] < 5.008001 ?
30             qw( $* $MULTILINE_MATCHING) : ()),
31             qw( $. $INPUT_LINE_NUMBER $NR
32             $/ $INPUT_RECORD_SEPARATOR $RS
33             $| $OUTPUT_AUTOFLUSH ),
34             '$,', qw( $OUTPUT_FIELD_SEPARATOR $OFS ),
35             '$\\', qw( $OUTPUT_RECORD_SEPARATOR $ORS ),
36             qw(
37             $" $LIST_SEPARATOR
38             $; $SUBSCRIPT_SEPARATOR $SUBSEP
39             ), '$#', qw( $OFMT
40             $% $FORMAT_PAGE_NUMBER
41             $= $FORMAT_LINES_PER_PAGE
42             $- $FORMAT_LINES_LEFT
43             $~ $FORMAT_NAME
44             $^ $FORMAT_TOP_NAME
45             $: $FORMAT_LINE_BREAK_CHARACTERS
46             $? $CHILD_ERROR $^CHILD_ERROR_NATIVE
47             $! $ERRNO $OS_ERROR
48             $@ $EVAL_ERROR
49             $$ $PROCESS_ID $PID
50             $< $REAL_USER_ID $UID
51             $> $EFFECTIVE_USER_ID $EUID ),
52             '$(', qw( $REAL_GROUP_ID $GID ),
53             '$)', qw( $EFFECTIVE_GROUP_ID $EGID
54             $0 $PROGRAM_NAME
55             $[
56             $]
57             $^A $ACCUMULATOR
58             $^C $COMPILING
59             $^CHILD_ERROR_NATIVE
60             $^D $DEBUGGING
61             $^E $EXTENDED_OS_ERROR
62             $^ENCODING
63             $^F $SYSTEM_FD_MAX
64             $^GLOBAL_PHASE
65             $^H
66             $^I $INPLACE_EDIT
67             $^L $FORMAT_FORMFEED
68             $^LAST_FH
69             $^M
70             $^MATCH
71             $^N $LAST_SUBMATCH_RESULT
72             $^O $OSNAME
73             $^OPEN
74             $^P $PERLDB
75             $^PREMATCH $^POSTMATCH
76             $^R $LAST_REGEXP_CODE_RESULT
77             $^RE_DEBUG_FLAGS
78             $^RE_TRIE_MAXBUF
79             $^S $EXCEPTIONS_BEING_CAUGHT
80             $^T $BASETIME
81             $^TAINT
82             $^UNICODE
83             $^UTF8CACHE
84             $^UTF8LOCALE
85             $^V $PERL_VERSION
86             $^W $WARNING $^WARNING_BITS
87             $^WIDE_SYSTEM_CALLS
88             $^WIN32_SLOPPY_STAT
89             $^X $EXECUTABLE_NAME
90             $ARGV
91             ),
92             );
93              
94 3     3   20 use vars '@Arrays';
  3         2  
  3         116  
95             @Arrays = qw(
96             @+ $LAST_MATCH_END
97             @- @LAST_MATCH_START
98             @ARGV
99             @F
100             @INC
101             @_ @ARG
102             );
103              
104 3     3   8 use vars '@Hashes';
  3         3  
  3         235  
105             @Hashes = qw(
106             %main
107             %CORE
108             %CORE::GLOBAL::
109             %OVERLOAD
110             %+ %LAST_MATCH_END
111             %- %LAST_MATCH_START
112             %! %OS_ERROR %ERRNO
113             %^H
114             %INC
115             %ENV
116             %SIG
117             );
118              
119 3     3   11 use vars '@Filehandles';
  3         4  
  3         159  
120             @Filehandles = qw(
121             *ARGV ARGV
122             *_ _
123             ARGVOUT
124             DATA
125             STDIN
126             STDOUT
127             STDERR
128             );
129              
130 3     3   10 use vars '@Functions';
  3         6  
  3         1111  
131             @Functions = (
132             ($] >= 5.015006 ? qw(
133             __SUB__
134             ) : ()), qw(
135             AUTOLOAD
136             BEGIN
137             DESTROY
138             END ),
139             # STOP was between 5.5.64 - 5.6.0
140             ($] >= 5.005064 && $] < 5.006
141             ? qw(STOP) : qw(CHECK)),
142             # INIT was called RESTART before 5.004_50
143             ($] >= 5.006
144             ? qw(INIT) : qw(RESTART)),
145             # removed with 855a8c432447
146             ($] < 5.007003 ? qw(
147             EQ GE GT LE LT NE
148             ) : ()),
149             ($] >= 5.009005 ? qw(
150             UNITCHECK
151             ) : ()), qw(
152             abs
153             accept ),
154             ($] >= 5.041007 ? qw(
155             any
156             all
157             ) : ()), qw(
158             alarm
159             atan2
160             bind
161             binmode
162             bless ),
163             ($] >= 5.009003 && ($] < 5.027007 || $] >= 5.027008 || $CPERL) ? qw(
164             break
165             ) : ()), qw(
166             caller
167             chdir
168             chmod
169             chomp
170             chop
171             chown
172             chr
173             chroot
174             close
175             closedir
176             connect
177             cos
178             crypt
179             dbmclose
180             dbmopen ),
181             ($] >= 5.009003 && ($] < 5.027007 || $CPERL) ? qw(
182             default
183             ) : ()), qw(
184             defined
185             delete
186             die
187             dump
188             each
189             endgrent
190             endhostent
191             endnetent
192             endprotoent
193             endpwent
194             endservent
195             eof
196             eval ),
197             ($] >= 5.015005 ? qw(
198             evalbytes
199             ) : ()), qw(
200             exec
201             exists
202             exit
203             exp ),
204             ($] >= 5.029 && $CPERL ? qw(
205             extern
206             ) : ()),
207             ($] >= 5.015008 ? qw(
208             fc
209             ) : ()), qw(
210             fcntl
211             fileno
212             flock
213             fork
214             format
215             formline
216             getc
217             getgrent
218             getgrgid
219             getgrnam
220             gethostbyaddr
221             gethostbyname
222             gethostent
223             getlogin
224             getnetbyaddr
225             getnetbyname
226             getnetent
227             getpeername
228             getpgrp
229             getppid
230             getpriority
231             getprotobyname
232             getprotobynumber
233             getprotoent
234             getpwent
235             getpwnam
236             getpwuid
237             getservbyname
238             getservbyport
239             getservent
240             getsockname
241             getsockopt ),
242             ($] >= 5.009003 ? qw(
243             given
244             ) : ()), qw(
245             glob
246             gmtime
247             goto
248             grep
249             hex
250             index
251             int
252             ioctl ),
253             ($] >= 5.031007 ? qw(
254             isa
255             ) : ()), qw(
256             join
257             keys
258             kill
259             last
260             lc
261             lcfirst
262             length
263             link
264             listen
265             local
266             localtime ),
267             ($] >= 5.004 ? qw(
268             lock
269             ) : ()), qw(
270             log
271             lstat
272             map
273             mkdir
274             msgctl
275             msgget
276             msgrcv
277             msgsnd
278             my
279             next
280             not
281             oct
282             open
283             opendir
284             ord ),
285             ($] >= 5.005061 ? qw(
286             our
287             ) : ()), qw(
288             pack
289             pipe
290             pop
291             pos
292             print
293             printf
294             prototype
295             push
296             quotemeta
297             rand
298             read
299             readdir
300             readline
301             readlink
302             readpipe
303             recv
304             redo
305             ref
306             rename
307             require
308             reset
309             return
310             reverse
311             rewinddir
312             rindex
313             rmdir ),
314             ($] >= 5.009003 ? qw(
315             say
316             ) : ()), qw(
317             scalar
318             seek
319             seekdir
320             select
321             semctl
322             semget
323             semop
324             send
325             setgrent
326             sethostent
327             setnetent
328             setpgrp
329             setpriority
330             setprotoent
331             setpwent
332             setservent
333             setsockopt
334             shift
335             shmctl
336             shmget
337             shmread
338             shmwrite
339             shutdown
340             sin
341             sleep
342             socket
343             socketpair
344             sort
345             splice
346             split
347             sprintf
348             sqrt
349             srand
350             stat
351             study
352             substr
353             symlink
354             syscall
355             sysopen
356             sysread
357             sysseek
358             system
359             syswrite
360             tell
361             telldir
362             tie
363             tied
364             time
365             times
366             truncate
367             uc
368             ucfirst
369             umask
370             undef
371             unlink
372             unpack
373             unshift
374             untie
375             use
376             utime
377             values
378             vec
379             wait
380             waitpid
381             wantarray
382             warn ),
383             ($] >= 5.009003 && ($] < 5.027007 || $] >= 5.027008 || $CPERL) ? qw(
384             when
385             ) : ($] >= 5.009003 && !$CPERL) ? qw(
386             whereis
387             whereso
388             ) : ()), qw(
389             write
390              
391             -r -w -x -o
392             -R -W -X -O -e -z -s
393             -f -d -l -p -S -b -c -t
394             -u -g -k
395             -T -B
396             -M -A -C
397             ));
398              
399 3     3   17 use vars '@Barewords';
  3         4  
  3         568  
400             @Barewords = (
401             qw(
402             __FILE__
403             __LINE__
404             __PACKAGE__
405             __DATA__
406             __END__
407             NULL
408             and ),
409             #removed with a96df643850d22bc4a94
410             ($] >= 5.000 && $] < 5.019010 ? qw(
411             CORE
412             ) : ()),
413             ($CPERL && $] >= 5.027001 ? qw(
414             class method role multi has
415             ) : ()), qw(
416             cmp
417             continue
418             do
419             else
420             elsif
421             eq ),
422             # added with dor (c963b151157d), removed with f23102e2d6356
423             # in fact this was never in keywords.h for some reason
424             ($] >= 5.008001 && $] < 5.010 ? qw(
425             err
426             ) : ()),
427             qw(
428             for
429             foreach
430             ge
431             gt
432             if
433             le
434             lock
435             lt
436             m
437             ne
438             no
439             or
440             package
441             q
442             qq ),
443             ($] >= 5.004072 ? qw(
444             qr
445             ) : ()),
446             ($] == 5.007003 ? qw(
447             qu
448             ) : ()), qw(
449             qw
450             qx
451             s
452             sub
453             tr
454             unless
455             until
456             while
457             x
458             xor
459             y
460             ),
461             # also with default, say
462             ($] >= 5.009003 ? qw(
463             break
464             given
465             when
466             ) : ()
467             ),
468             # removed as useless with 5.27.7, re-added with 7896dde7482a2851
469             ($] >= 5.009003 && ($] < 5.027007 || $] >= 5.027008) ? qw(
470             default
471             ) : ()
472             ),
473             ($] >= 5.009004 ? qw(
474             state
475             ) : ()
476             ),
477             ($] >= 5.033007 ? qw(
478             try
479             catch
480             ) : ()
481             ),
482             ($] >= 5.035004 ? qw(
483             defer
484             ) : ()
485             ),
486             ($] >= 5.035008 ? qw(
487             finally
488             ) : ()
489             ),
490             ($] >= 5.038000 ? qw(
491             ADJUST
492             class
493             field
494             method
495             ) : ()
496             ),
497             ($] >= 5.039002 ? qw{
498             __CLASS__
499             } : ()
500             ),
501             );
502              
503             # Extra barewords not in keywords.h (import was never in keywords)
504 3     3   16 use vars '@BarewordsExtra';
  3         5  
  3         146  
505             @BarewordsExtra = qw(
506             import
507             unimport
508             );
509              
510 3     3   12 use vars '@TieIOMethods';
  3         6  
  3         270  
511             @TieIOMethods = qw(
512             BINMODE CLEAR CLEARERR CLONE CLONE_SKIP CLOSE DELETE EOF
513             ERROR EXISTS EXTEND FDOPEN FETCH FETCHSIZE FILENO FILL FIRSTKEY FLUSH
514             GETC NEXTKEY OPEN POP POPPED PRINT PRINTF PUSH PUSHED READ READLINE
515             SCALAR SEEK SETLINEBUF SHIFT SPLICE STORE STORESIZE SYSOPEN TELL
516             TIEARRAY TIEHANDLE TIEHASH TIESCALAR UNREAD UNSHIFT UNTIE UTF8 WRITE
517             );
518              
519 3     3   13 use vars '@UNIVERSALMethods';
  3         4  
  3         121  
520             @UNIVERSALMethods = qw(
521             can isa DOES VERSION
522             );
523              
524 3     3   13 use vars '@ExporterSymbols';
  3         4  
  3         206  
525             @ExporterSymbols = qw(
526             @EXPORT @EXPORT_OK @EXPORT_FAIL
527             @EXPORT_TAGS _push_tags _rebuild_cache as_heavy export export_fail
528             export_fail_in export_ok_tags export_tags export_to_level heavy_export
529             heavy_export_ok_tags heavy_export_tags heavy_export_to_level
530             heavy_require_version require_version
531             );
532              
533 3     3   16 use vars '@Symbols';
  3         4  
  3         169  
534             @Symbols = ( @Scalars, @Arrays, @Hashes, @Filehandles, @Functions );
535              
536             # This quote is blatantly copied from ErrantStory.com, Michael Poe's
537             # comic.
538 3     3   365 BEGIN { $^W = 0 }
539             "You know, when you stop and think about it, Cthulhu is a bit a Mary Sue isn't he?"
540              
541             __END__
542              
543             =encoding UTF-8
544              
545             =head1 NAME
546              
547             B::Keywords - Lists of reserved barewords and symbol names
548              
549             =head1 SYNOPSIS
550              
551             use B::Keywords qw( @Symbols @Barewords );
552             print join "\n", @Symbols,
553             @Barewords;
554              
555             =head1 DESCRIPTION
556              
557             C<B::Keywords> supplies several arrays of exportable keywords:
558             C<@Scalars>, C<@Arrays>, C<@Hashes>, C<@Filehandles>, C<@Symbols>,
559             C<@Functions>, C<@Barewords>, C<@BarewordsExtra>, C<@TieIOMethods>,
560             C<@UNIVERSALMethods> and C<@ExporterSymbols>.
561              
562             The C<@Symbols> array includes the contents of each
563             of C<@Scalars>, C<@Arrays>, C<@Hashes>, C<@Functions> and C<@Filehandles>.
564              
565             Similarly, C<@Barewords> adds a few non-function keywords and
566             operators to the C<@Functions> array.
567              
568             C<@BarewordsExtra> adds a few barewords which are not in keywords.h.
569              
570             All additions and modifications are welcome.
571              
572             The perl parser uses a static list of keywords from
573             F<regen/keywords.pl> which constitutes the strict list of keywords
574             @Functions and @Barewords, though some @Functions are not functions
575             in the strict sense.
576             Several library functions use more special symbols, handles and methods.
577              
578             =head1 DATA
579              
580             =over
581              
582             =item C<@Scalars>
583              
584             =item C<@Arrays>
585              
586             =item C<@Hashes>
587              
588             =item C<@Filehandles>
589              
590             =item C<@Functions>
591              
592             The above are lists of variables, special file handles, and built in
593             functions.
594              
595             =item C<@Symbols>
596              
597             This is just the combination of all of the above: variables, file
598             handles, and functions.
599              
600             =item C<@Barewords>
601              
602             This is a list of other special keywords in perl including operators
603             and all the control structures.
604              
605             =item C<@BarewordsExtra>
606              
607             This is a list of barewords which are missing from keywords.h, handled
608             extra in the tokenizer.
609              
610             =item C<@TieIOMethods>
611              
612             Those are special tie or PerlIO methods called by the perl core,
613             namely for tieing or PerlIO::via (or both of those) or threads.
614              
615             =item C<@UNIVERSALMethods>
616              
617             Methods defined by the core package UNIVERSAL.
618              
619             =item C<@ExporterSymbols>
620              
621             Variables or functions used by Exporter (some internal), which is
622             almost as good as being keywords, for you mustn't use them for any
623             other purpose in any package that isa Exporter, which is quite common.
624              
625             =back
626              
627             =head1 EXPORT
628              
629             Anything can be exported if you desire. Use the :all tag to get
630             everything.
631              
632             =head1 SEE ALSO
633              
634             F<regen/keywords.pl> from the perl source, L<perlvar>, L<perlfunc>,
635             L<perldelta>.
636              
637             =head1 BUGS
638              
639             Please report any bugs or feature requests to C<bug-B-Keywords at
640             rt.cpan.org>, or through the web interface at
641             L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=B-Keywords>. I will be
642             notified, and then you'll automatically be notified of progress on
643             your bug as I make changes.
644              
645             =head1 SUPPORT
646              
647             You can find documentation for this module with the perldoc command.
648              
649             perldoc B::Keywords
650              
651             You can also look for information at:
652              
653             =over
654              
655             =item * RT: CPAN's request tracker
656              
657             L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=B-Keywords>
658              
659             =item * GIT repository
660              
661             L<http://github.com/rurban/b-keywords/>
662              
663             =item * AnnoCPAN: Annotated CPAN documentation
664              
665             L<http://annocpan.org/dist/B-Keywords>
666              
667             =item * CPAN Ratings
668              
669             L<http://cpanratings.perl.org/d/B-Keywords>
670              
671             =item * Search CPAN
672              
673             L<http://search.cpan.org/dist/B-Keywords>
674              
675             =back
676              
677             =head1 ACKNOWLEDGEMENTS
678              
679             Michael G Schwern, Reini Urban, Florian Ragwitz and Zsbán Ambrus
680             for patches and releases.
681              
682             =head1 COPYRIGHT AND LICENSE
683              
684             Copyright 2009 Joshua ben Jore, All rights reserved.
685             Copyright 2013, 2015, 2017-2021 Reini Urban, All rights reserved.
686              
687             This program is free software; you can redistribute it and/or modify
688             it under the terms of either:
689              
690             a) the GNU General Public License as published by the Free Software
691             Foundation; version 2, or
692              
693             b) the "Artistic License" which comes with Perl.
694              
695             =head1 SOURCE AVAILABILITY
696              
697             This source is in Github: L<git://github.com/rurban/b-keywords.git>
698              
699             =head1 AUTHOR
700              
701             Joshua ben Jore <jjore@cpan.org>
702              
703             =head1 MAINTAINER
704              
705             Reini Urban <rurban@cpan.org>