File Coverage

examples/content_processor_plugin.pl
Criterion Covered Total %
statement 28 29 96.5
branch n/a
condition n/a
subroutine 7 7 100.0
pod n/a
total 35 36 97.2


line stmt bran cond sub pod time code
1 1     1   5614 use warnings;
  1         2  
  1         102  
2 1     1   25 use 5.020;
  1         4  
3 1     1   572 use experimental qw( signatures );
  1         5011  
  1         9  
4 1     1   895 use Data::Section::Pluggable;
  1         5  
  1         134  
5              
6 1         288952 package Data::Section::Pluggable::Plugin::MyPlugin {
7 1     1   657 use Role::Tiny::With;
  1         6935  
  1         84  
8 1     1   9 use Class::Tiny qw( extensions );
  1         2  
  1         7  
9 1         9 with 'Data::Section::Pluggable::Role::ContentProcessorPlugin';
10              
11 1     1   2 sub process_content ($self, $dsp, $content) {
  1         2  
  1         2  
  1         2  
  1         1  
12 1         9 $content =~ s/\s*\z//; # trim trailing whitespace
13 1         6 return "[$content]";
14             }
15 0         0 }
16              
17 1         421 my $dsp = Data::Section::Pluggable->new
18             ->add_plugin('my_plugin', extensions => ['txt']);
19              
20             # prints '[Welcome to Perl]'
21 1         5 say $dsp->get_data_section('hello.txt');
22              
23             __DATA__