| 1 | package Pod::Simple::XHTML::BlendedCode; | ||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use 5.008001; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 4 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 5 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 6 | 3 | ▶ | use parent qw(Pod::Simple::XHTML); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 7 | 3 | ▶ | use List::Util qw(first); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 8 | 3 | ▶ | use Pod::Simple::XHTML::BlendedCode::Blender 1.000 qw(); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 9 | 3 | ▶ | use IO::String 1.08 qw(); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 10 | 3 | ▶ | use Carp qw(croak); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||
| 12 | 3 | our $VERSION = '1.003'; | |||||||||||||||||||||||||||||||
| 13 | 3 | $VERSION =~ s/_//ms; | |||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||
| 15 | 2 | ▶ | sub new { | ||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 16 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||
| 17 | 2 | my $new = $self->SUPER::new(@_); | |||||||||||||||||||||||||||||||
| 18 | 2 | $new->_accessorize( | |||||||||||||||||||||||||||||||
| 19 | 'internal_modules_hash', 'internal_url_postfix', | ||||||||||||||||||||||||||||||||
| 20 | 'internal_url_prefix', 'internal_url_divide_slashes', | ||||||||||||||||||||||||||||||||
| 21 | ); | ||||||||||||||||||||||||||||||||
| 22 | 2 | $new->internal_url_divide_slashes(1); | |||||||||||||||||||||||||||||||
| 23 | 2 | $new->internal_modules_hash( {} ); | |||||||||||||||||||||||||||||||
| 24 | 2 | return $new; | |||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||
| 27 | ## We cheat by processing through a preprocessor first. | ||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||
| 29 | 1 | ▶ | sub parse_file { | ||||||||||||||||||||||||||||||
|
Subroutine
parse_file: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 30 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||
| 31 | 1 | my $in_file = shift; | |||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||
| 33 | 1 | my $pod = q{}; | |||||||||||||||||||||||||||||||
| 34 | 1 | my $pod_handle = IO::String->new($pod); | |||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||
| 36 | 1 | my $preprocessor = Pod::Simple::XHTML::BlendedCode::Blender->new(); | |||||||||||||||||||||||||||||||
| 37 | 1 | $preprocessor->parseopts( '-want_nonPODs' => 1 ); | |||||||||||||||||||||||||||||||
| 38 | 1 | $preprocessor->parse_from_file( $in_file, $pod_handle ); | |||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||
| 40 | 1 | return $self->SUPER::parse_string_document($pod); | |||||||||||||||||||||||||||||||
| 41 | } ## end sub parse_file | ||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||
| 43 | 1 | ▶ | sub parse_string_document { | ||||||||||||||||||||||||||||||
|
Subroutine
parse_string_document: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 44 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||
| 45 | 1 | my $in_string = shift; | |||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||
| 47 | 1 | my $in_handle = IO::String->new($in_string); | |||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||
| 49 | 1 | my $pod = q{}; | |||||||||||||||||||||||||||||||
| 50 | 1 | my $pod_handle = IO::String->new($pod); | |||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||
| 52 | 1 | my $preprocessor = Pod::Simple::XHTML::BlendedCode::Blender->new(); | |||||||||||||||||||||||||||||||
| 53 | 1 | $preprocessor->parseopts( '-want_nonPODs' => 1 ); | |||||||||||||||||||||||||||||||
| 54 | 1 | $preprocessor->parse_from_file( $in_handle, $pod_handle ); | |||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||
| 56 | 1 | return $self->SUPER::parse_string_document($pod); | |||||||||||||||||||||||||||||||
| 57 | } ## end sub parse_string_document | ||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||
| 59 | 11 | ▶ | sub resolve_pod_page_link { | ||||||||||||||||||||||||||||||
|
Subroutine
resolve_pod_page_link: called CC=9 SCAR=35.6
Pod
documented
| |||||||||||||||||||||||||||||||||
| 60 | 11 | my ( $self, $to, $section ) = @_; | |||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||
| 62 | 11 | ▶ | croak | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 63 | q{The parser's internal_modules_hash method is not returning a hashref} | ||||||||||||||||||||||||||||||||
| 64 | if ( 'HASH' ne ref( $self->internal_modules_hash() ) ); | ||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||
| 66 | 11 | my $key; | |||||||||||||||||||||||||||||||
| 67 | 11 | ▶ | if ( defined $to ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 68 | 10 | ▶ | $key = first { $to =~ m{\A$_\z}ms } | ||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 69 | 0 | sort { $a cmp $b } keys %{ $self->internal_modules_hash() }; | |||||||||||||||||||||||||||||||
| 70 | 11 | ▶ | return $self->SUPER::resolve_pod_page_link( $to, $section ) | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 71 | if not defined $key; | ||||||||||||||||||||||||||||||||
| 72 | } else { | ||||||||||||||||||||||||||||||||
| 73 | 0 | return $self->SUPER::resolve_pod_page_link( $to, $section ); | |||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||
| 76 | 0 | my $processed_to; | |||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||
| 78 | 0 | ▶ | if ( $self->internal_url_divide_slashes() ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 79 | 0 | $processed_to = $to; | |||||||||||||||||||||||||||||||
| 80 | 0 | $processed_to =~ s{::}{/}msg; | |||||||||||||||||||||||||||||||
| 81 | } else { | ||||||||||||||||||||||||||||||||
| 82 | 0 | $processed_to = encode_entities($to); | |||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||
| 85 | 0 | ▶ | if ( defined $section ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 86 | 0 | $section = q{#} . $self->idify( $section, 1 ); | |||||||||||||||||||||||||||||||
| 87 | } else { | ||||||||||||||||||||||||||||||||
| 88 | 0 | $section = q{}; | |||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||
| 91 | return | ||||||||||||||||||||||||||||||||
| 92 | ( $self->internal_url_prefix() || q{} ) | ||||||||||||||||||||||||||||||||
| 93 | 0 | ▶ | . ( $self->internal_modules_hash->{$key} || q{} ) | ||||||||||||||||||||||||||||||
|
Condition0%0/6
$self->internal_url_prefix || ''
$self->internal_modules_hash->{$key} || ''
$self->internal_url_postfix || ''
MC/DC0%0/1
$self->internal_url_prefix || ''
$self->internal_url_prefix
MC/DC0%0/1
$self->internal_modules_hash->{$key} || ''
$self->internal_modules_hash->{$key}
MC/DC0%0/1
$self->internal_url_postfix || ''
$self->internal_url_postfix
Truth table0%0/2
A
A= $self->internal_url_prefix
Truth table0%0/2
A
A= $self->internal_modules_hash->{$key}
Truth table0%0/2
A
A= $self->internal_url_postfix
| |||||||||||||||||||||||||||||||||
| 94 | . $processed_to | ||||||||||||||||||||||||||||||||
| 95 | . $section | ||||||||||||||||||||||||||||||||
| 96 | . ( $self->internal_url_postfix() || q{} ); | ||||||||||||||||||||||||||||||||
| 97 | } ## end sub resolve_pod_page_link | ||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||
| 100 | 3 | 1; # Magic true value required at end of module | |||||||||||||||||||||||||||||||
| 101 | __END__ | ||||||||||||||||||||||||||||||||