| 1 | package Aitextcleaner::FormattingResidue; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use Exporter qw(import); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 1 | our $VERSION = '0.2.0'; | |||||||||||||||||||||||||||
| 8 | 1 | our @EXPORT_OK = qw(clean_formatting_residue); | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 1 | ▶ | sub clean_formatting_residue { | ||||||||||||||||||||||||||
|
Subroutine
clean_formatting_residue: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 11 | 1 | my ($text) = @_; | |||||||||||||||||||||||||||
| 12 | 1 | ▶ | die 'text must be a string' if !defined($text) || ref($text); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
not defined $text or ref $text
MC/DC0%0/2
not defined $text or ref $text
not defined $text
ref $text
Truth table33%1/3
not(A) or B
A= not defined $textB= ref $text
| |||||||||||||||||||||||||||||
| 13 | 1 | $text =~ s{</?(?:address|article|blockquote|br|div|li|p|pre|section)\b[^>]*>}{\n}gi; | |||||||||||||||||||||||||||
| 14 | 1 | $text =~ s{<[^>]*>}{}g; | |||||||||||||||||||||||||||
| 15 | 1 | $text =~ s/&/\&/g; | |||||||||||||||||||||||||||
| 16 | 1 | $text =~ s/</</g; | |||||||||||||||||||||||||||
| 17 | 1 | $text =~ s/>/>/g; | |||||||||||||||||||||||||||
| 18 | 1 | $text =~ s/"/"/g; | |||||||||||||||||||||||||||
| 19 | 1 | $text =~ s/'|'/'/g; | |||||||||||||||||||||||||||
| 20 | 1 | $text =~ s/ / /g; | |||||||||||||||||||||||||||
| 21 | 1 | $text =~ s/“/"/g; | |||||||||||||||||||||||||||
| 22 | 1 | $text =~ s/”/"/g; | |||||||||||||||||||||||||||
| 23 | 1 | $text =~ s/‘/'/g; | |||||||||||||||||||||||||||
| 24 | 1 | $text =~ s/’/'/g; | |||||||||||||||||||||||||||
| 25 | 1 | $text =~ s/–/-/g; | |||||||||||||||||||||||||||
| 26 | 1 | $text =~ s/—/-/g; | |||||||||||||||||||||||||||
| 27 | 1 | $text =~ s/…/.../g; | |||||||||||||||||||||||||||
| 28 | 1 | $text =~ s/[ \t]+\n/\n/g; | |||||||||||||||||||||||||||
| 29 | 1 | $text =~ s/\n{3,}/\n\n/g; | |||||||||||||||||||||||||||
| 30 | 1 | $text =~ s/^\s+//; | |||||||||||||||||||||||||||
| 31 | 1 | $text =~ s/\s+$//; | |||||||||||||||||||||||||||
| 32 | 1 | return $text; | |||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 1 | 1; | |||||||||||||||||||||||||||