| 1 | package Pod::ProjectDocs::Template; | ||||||||||
| 2 | |||||||||||
| 3 | 4 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 4 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 4 | our $VERSION = '0.53'; # VERSION | |||||||||
| 7 | |||||||||||
| 8 | 4 | ▶ | use Moose::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 4 | ▶ | use Template; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 4 | ▶ | use File::Basename; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 4 | ▶ | use File::Spec; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 4 | ▶ | use Carp(); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | |||||||||||
| 15 | 4 | has '_curpath' => ( | |||||||||
| 16 | is => 'rw', | ||||||||||
| 17 | isa => 'Str', | ||||||||||
| 18 | default => '', | ||||||||||
| 19 | ); | ||||||||||
| 20 | |||||||||||
| 21 | has '_tt' => ( | ||||||||||
| 22 | is => 'ro', | ||||||||||
| 23 | isa => 'Object', | ||||||||||
| 24 | 12 | ▶ | default => sub { | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.6
| |||||||||||
| 25 | 12 | my $self = shift; | |||||||||
| 26 | Template->new( | ||||||||||
| 27 | { | ||||||||||
| 28 | FILTERS => { | ||||||||||
| 29 | 9 | ▶ | relpath => sub { | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 30 | 9 | my $path = shift; | |||||||||
| 31 | 9 | my $curpath = $self->_curpath(); | |||||||||
| 32 | 9 | my ( $name, $dir ) = fileparse $curpath, qr/\.html/; | |||||||||
| 33 | 9 | return File::Spec->abs2rel( $path, $dir ); | |||||||||
| 34 | }, | ||||||||||
| 35 | 0 | ▶ | return2br => sub { | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 36 | 0 | my $text = shift; | |||||||||
| 37 | 0 | $text =~ s!\r\n!<br />!g; | |||||||||
| 38 | 0 | $text =~ s!\n!<br />!g; | |||||||||
| 39 | 0 | return $text; | |||||||||
| 40 | } | ||||||||||
| 41 | }, | ||||||||||
| 42 | } | ||||||||||
| 43 | 12 | ); | |||||||||
| 44 | }, | ||||||||||
| 45 | 4 | ); | |||||||||
| 46 | |||||||||||
| 47 | 8 | ▶ | sub process { | ||||||||
|
Subroutine
process: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||
| 48 | 8 | my ( $self, $doc, $data, $output ) = @_; | |||||||||
| 49 | 8 | $self->_curpath( $doc->get_output_path ); | |||||||||
| 50 | 8 | ▶ | $self->_tt()->process( \$data, $output, \my $text ) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 51 | or Carp::croak( $self->_tt()->error ); | ||||||||||
| 52 | 8 | $self->_curpath(''); | |||||||||
| 53 | 8 | return $text; | |||||||||
| 54 | } | ||||||||||
| 55 | |||||||||||
| 56 | 4 | ▶ | no Moose::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 57 | |||||||||||
| 58 | 4 | 1; | |||||||||
| 59 | __END__ | ||||||||||