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