Plagger/Plugin/Filter/TTP.pm untested

filter: Statementstmt 0.0% 0 / 25 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 33 CC 2 SCAR 12.0
CC
2
Cov
0%
filter
6.0
BEGIN
2.0
BEGIN
2.0
CRAP 3.3
1 package Plagger::Plugin::Filter::TTP;
2 use strict;
3 use base qw( Plagger::Plugin::Filter::Base );
4  
5 use URI::Find;
6 use URI::http;
7  
8 sub filter {
9 my($self, $body) = @_;
10  
11 local @URI::ttp::ISA = qw(URI::http);
12  
13 my $count = 0;
14 my $finder = URI::Find->new(sub {
15 my ($uri, $orig_uri) = @_;
16 if ($uri->scheme eq 'ttp') {
17 $count++;
18 return qq{<a href="h$orig_uri">$orig_uri</a>};
19 } else {
20 return $orig_uri;
21 }
22 });
23  
24 $finder->find(\$body);
25 ($count, $body);
26 }
27  
28 1;
29  
30 __END__