File Coverage

examples/content_processor_plugin_class.pl
Criterion Covered Total %
statement 29 30 96.6
branch n/a
condition n/a
subroutine 7 7 100.0
pod n/a
total 36 37 97.3


line stmt bran cond sub pod time code
1 1     1   6145 use warnings;
  1         3  
  1         63  
2 1     1   21 use 5.020;
  1         4  
3 1     1   607 use experimental qw( signatures );
  1         5459  
  1         7  
4 1     1   964 use Data::Section::Pluggable;
  1         4  
  1         115  
5              
6 1         296362 package Data::Section::Pluggable::Plugin::MyPlugin {
7 1     1   652 use Role::Tiny::With;
  1         8067  
  1         2033  
8 1         10 with 'Data::Section::Pluggable::Role::ContentProcessorPlugin';
9              
10 1     1   2 sub extensions ($class) {
  1         2  
  1         2  
11 1         4 return ('txt');
12             }
13              
14 1     1   2 sub process_content ($class, $dsp, $content) {
  1         2  
  1         2  
  1         1  
  1         2  
15 1         10 $content =~ s/\s*\z//; # trim trailing whitespace
16 1         6 return "[$content]";
17             }
18 0         0 }
19              
20 1         389 my $dsp = Data::Section::Pluggable->new
21             ->add_plugin('my_plugin');
22              
23             # prints '[Welcome to Perl]'
24 1         5 say $dsp->get_data_section('hello.txt');
25              
26             __DATA__