File Coverage

blib/lib/Parse/Keyword.pm
Criterion Covered Total %
statement 35 35 100.0
branch n/a
condition n/a
subroutine 9 9 100.0
pod n/a
total 44 44 100.0


line stmt bran cond sub pod time code
1             package Parse::Keyword;
2             BEGIN {
3 13     13   548055 $Parse::Keyword::AUTHORITY = 'cpan:DOY';
4             }
5             {
6             $Parse::Keyword::VERSION = '0.08';
7             }
8 13     13   133 use strict;
  13         30  
  13         594  
9 13     13   1073 use warnings;
  13         29  
  13         2634  
10 13     13   411 use 5.014;
  13         47  
  13         612  
11             # ABSTRACT: DEPRECATED: write syntax extensions in perl
12              
13 13     13   51631 use Devel::CallParser;
  13         95941  
  13         949  
14 13     13   123 use XSLoader;
  13         47  
  13         2528  
15              
16             XSLoader::load(
17             __PACKAGE__,
18             exists $Parse::Keyword::{VERSION} ? ${ $Parse::Keyword::{VERSION} } : (),
19             );
20              
21              
22              
23             sub import {
24 14     14   412 my $package = shift;
25 14         35 my ($keywords) = @_;
26              
27 14         31 my $caller = caller;
28              
29 14         60 for my $keyword (keys %$keywords) {
30 16         24 my $sub = do {
31 13     13   81 no strict 'refs';
  13         32  
  13         1903  
32 16         24 \&{ $caller . '::' . $keyword };
  16         114  
33             };
34 16         105 install_keyword_handler($sub, $keywords->{$keyword});
35             }
36              
37 14         63 my @helpers = qw(
38             lex_peek
39             lex_read
40             lex_read_space
41             lex_stuff
42             parse_block
43             parse_stmtseq
44             parse_fullstmt
45             parse_barestmt
46             parse_fullexpr
47             parse_listexpr
48             parse_termexpr
49             parse_arithexpr
50             compiling_package
51             );
52              
53 14         33 for my $helper (@helpers) {
54 13     13   76 no strict 'refs';
  13         26  
  13         1870  
55 182         190 *{ $caller . '::' . $helper } = \&{ __PACKAGE__ . '::' . $helper };
  182         2847  
  182         446  
56             }
57             }
58              
59              
60             1;
61              
62             __END__