File Coverage

blib/lib/Goo/Thing/pm/Perl5.pm
Criterion Covered Total %
statement 3 8 37.5
branch n/a
condition n/a
subroutine 1 4 25.0
pod 3 3 100.0
total 7 15 46.6


line stmt bran cond sub pod time code
1             package Goo::Thing::pm::Perl5;
2              
3             ###############################################################################
4             # Nigel Hamilton
5             #
6             # Copyright Nigel Hamilton 2005
7             # All Rights Reserved
8             #
9             # Author: Nigel Hamilton
10             # Filename: Goo::Thing::pm::Perl5.pm
11             # Description: Model Perl5 things
12             #
13             # Date Change
14             # -----------------------------------------------------------------------------
15             # 12/03/2005 Auto generated file
16             # 12/03/2005 Needed to locate builtin functions
17             #
18             ###############################################################################
19              
20 1     1   4 use strict;
  1         2  
  1         261  
21              
22             # lists functions not reserved words
23             my @functions = qw(abs accept alarm atan2 binmode binmode bless caller chdir chmod chomp chomp chown chr chroot close closedir connect continue close crypt data dbmclose dbmopen defined delete die do dump each endgrent endhostent endnetent endprotoent endpwent endservent eof eval exec exists exit exp fcntl fileno fixed flock for foreach fork format formline getc getgrent getgrgid getgrnam gethostbyaddr gethostbyname gethostent getlogin getnetbyaddr getnetbyname getnetent getpeername getpgrp getppid getpriority getprotobyname getprotobynumber getprotoent getpwent getpwnam getpwuid getservbyname getservbyport getservent getsockname getsockopt glob gmtime goto grep hex import index int ioctl join keys kill last lc lcfirst length link listen local localtime log lstat map mkdir msgctl msgget msgrcv msgsnd my next no oct open opendir ord ord pack package pipe pop pos print printf prototype push quotemeta qw qx rand read readdir readline readlink readpipe records recv redo ref rename require reset return reverse rewinddir rindex rmdir scalar seek seekdir select semctl semget semop send setgrent sethostent setnetent setpgrp setpriority setprotoent setpwent setservent setsockopt shift shmctl shmget shmread shmwrite shutdown sprintf sleep socket socketpair sort splice split sprintf sqrt srand stat study sub substr uc symlink syscall sysopen sysread sysseek system syswrite tell telldir tie tied time times truncate uc ucfirst umask undef unlink unpack unshift untie use utime values vec wait waitpid wantarray warn write);
24              
25             # common functions and reserved words
26             my @common = qw(abs accept binmode bless caller chdir chmod chomp chown chr chroot close continue defined delete
27             die do each else eval exec exists exit flock for foreach fork format glob gmtime goto grep hex if import index int ioctl join keys last lc lcfirst length link listen local localtime log map mkdir my next oct open ord pack package pipe pop pos print printf prototype push quotemeta rand read readdir readline ref rename require reset return reverse rindex rmdir scalar seek seekdir select shift sort splice split sprintf sqrt srand stat study sub substr uc sysopen sysread sysseek system syswrite tie tied time times truncate uc ucfirst umask undef unlink unpack unshift untie use utime values vec wantarray warn while write);
28              
29             my %builtins = map { $_ => 1 } @functions;
30              
31             # hold a hash of common reserved words
32             my %reserved = map { $_ => 1 } @common;
33              
34              
35             ###############################################################################
36             #
37             # is_built_in_function - is the function a core perl5?
38             #
39             ###############################################################################
40              
41             sub is_built_in_function {
42              
43 0     0 1   my ($function) = @_;
44            
45 0           return exists $builtins{$function};
46              
47             }
48              
49              
50             ###############################################################################
51             #
52             # is_reserved_word - is this a reserved word?
53             #
54             ###############################################################################
55              
56             sub is_reserved_word {
57              
58 0     0 1   my ($word) = @_;
59            
60 0           return exists $reserved{$word};
61              
62             }
63              
64              
65             ###############################################################################
66             #
67             # get_common_words - return a list of reserved words
68             #
69             ###############################################################################
70              
71             sub get_common_words {
72              
73 0     0 1   return @common;
74              
75             }
76              
77             1;
78              
79              
80             __END__
81              
82             =head1 NAME
83              
84             Goo::Thing::pm::Perl5 - Model Perl5 reserved words
85              
86             =head1 SYNOPSIS
87              
88             use Goo::Thing::pm::Perl5;
89              
90             =head1 DESCRIPTION
91              
92             =head1 METHODS
93              
94             =over
95              
96             =item is_built_in_function
97              
98             is the function a core perl5 function?
99              
100             =item is_reserved_word
101              
102             is this a reserved word?
103              
104             =item get_common_words
105              
106             return a list of reserved words
107              
108             =back
109              
110             =head1 AUTHOR
111              
112             Nigel Hamilton <nigel@trexy.com>
113              
114             =head1 SEE ALSO