File Coverage

blib/lib/PPI/Singletons.pm
Criterion Covered Total %
statement 6 6 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 8 8 100.0


line stmt bran cond sub pod time code
1             package PPI::Singletons;
2              
3             # exports some singleton variables to avoid aliasing magic
4              
5 69     69   1800 use strict;
  69         1622  
  69         3288  
6 69     69   3329 use Exporter ();
  69         3586  
  69         46018  
7              
8             our $VERSION = '1.291';
9              
10             our @ISA = 'Exporter';
11             our @EXPORT_OK = qw{ %_PARENT %_POSITION_CACHE %OPERATOR %MAGIC %LAYER $CURLY_SYMBOL %QUOTELIKE %KEYWORDS };
12              
13             our %_PARENT; # Master Child -> Parent index
14             our %_POSITION_CACHE; # cache for position in parent
15              
16             # operator index
17             our %OPERATOR = map { $_ => 1 } (
18             qw{
19             -> ++ -- ** ! ~ + -
20             =~ !~ * / % x . << >>
21             < > <= >= lt gt le ge
22             == != <=> eq ne cmp ~~
23             & | ^ && || // .. ...
24             &. |. ^. ~.
25             ? :
26             = **= += -= .= *= /= %= x= &= |= ^= <<= >>= &&= ||= //=
27             &.= |.= ^.= ~.=
28             => <> <<>>
29             and or xor not
30             }, ',' # Avoids "comma in qw{}" warning
31             );
32              
33             # Magic variables taken from perlvar.
34             # Several things added separately to avoid warnings.
35             our %MAGIC = map { $_ => 1 } qw{
36             $1 $2 $3 $4 $5 $6 $7 $8 $9
37             $_ $& $` $' $+ @+ %+ $* $. $/ $|
38             $\\ $" $; $% $= $- @- %- $)
39             $~ $^ $: $? $! %! $@ $$ $< $>
40             $( $0 $[ $] @_ @*
41              
42             $^L $^A $^E $^C $^D $^F $^H
43             $^I $^M $^N $^O $^P $^R $^S
44             $^T $^V $^W $^X %^H
45              
46             $::|
47             }, '$}', '$,', '$#', '$#+', '$#-';
48              
49             our %LAYER = ( 1 => [], 2 => [] ); # Registered function store
50              
51             our $CURLY_SYMBOL = qr{\G\^[[:upper:]_]\w+\}};
52              
53             our %QUOTELIKE = (
54             'q' => 'Quote::Literal',
55             'qq' => 'Quote::Interpolate',
56             'qx' => 'QuoteLike::Command',
57             'qw' => 'QuoteLike::Words',
58             'qr' => 'QuoteLike::Regexp',
59             'm' => 'Regexp::Match',
60             's' => 'Regexp::Substitute',
61             'tr' => 'Regexp::Transliterate',
62             'y' => 'Regexp::Transliterate',
63             );
64              
65             # List of keywords is from regen/keywords.pl in the perl source.
66             our %KEYWORDS = map { $_ => 1 } qw{
67             abs accept alarm and atan2 bind binmode bless break caller chdir chmod
68             chomp chop chown chr chroot close closedir cmp connect continue cos
69             crypt dbmclose dbmopen default defined delete die do dump each else
70             elsif endgrent endhostent endnetent endprotoent endpwent endservent
71             eof eq eval evalbytes exec exists exit exp fc fcntl fileno flock for
72             foreach fork format formline ge getc getgrent getgrgid getgrnam
73             gethostbyaddr gethostbyname gethostent getlogin getnetbyaddr
74             getnetbyname getnetent getpeername getpgrp getppid getpriority
75             getprotobyname getprotobynumber getprotoent getpwent getpwnam
76             getpwuid getservbyname getservbyport getservent getsockname
77             getsockopt given glob gmtime goto grep gt hex if index int ioctl join
78             keys kill last lc lcfirst le length link listen local localtime lock
79             log lstat lt m map mkdir msgctl msgget msgrcv msgsnd my ne next no
80             not oct open opendir or ord our pack package pipe pop pos print
81             printf prototype push q qq qr quotemeta qw qx rand read readdir
82             readline readlink readpipe recv redo ref rename require reset return
83             reverse rewinddir rindex rmdir s say scalar seek seekdir select semctl
84             semget semop send setgrent sethostent setnetent setpgrp
85             setpriority setprotoent setpwent setservent setsockopt shift shmctl
86             shmget shmread shmwrite shutdown sin sleep socket socketpair sort
87             splice split sprintf sqrt srand stat state study sub substr symlink
88             syscall sysopen sysread sysseek system syswrite tell telldir tie tied
89             time times tr truncate uc ucfirst umask undef unless unlink unpack
90             unshift untie until use utime values vec wait waitpid wantarray warn
91             when while write x xor y
92             };
93              
94             1;