| 1 | # | ||||||||||
| 2 | # This file is part of Config-Model | ||||||||||
| 3 | # | ||||||||||
| 4 | # This software is Copyright (c) 2005-2022 by Dominique Dumont. | ||||||||||
| 5 | # | ||||||||||
| 6 | # This is free software, licensed under: | ||||||||||
| 7 | # | ||||||||||
| 8 | # The GNU Lesser General Public License, Version 2.1, February 1999 | ||||||||||
| 9 | # | ||||||||||
| 10 | package Config::Model::Role::HelpAsText 2.169; | ||||||||||
| 11 | |||||||||||
| 12 | # ABSTRACT: Translate element help from pod to text | ||||||||||
| 13 | |||||||||||
| 14 | 59 | ▶ | use Mouse::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | 59 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | 59 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | 59 | ▶ | use Pod::Text; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 18 | 59 | ▶ | use Pod::Simple 3.23; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | 59 | ▶ | use v5.20; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 20 | |||||||||||
| 21 | 59 | ▶ | use feature qw/postderef signatures/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 22 | 59 | ▶ | no warnings qw/experimental::postderef experimental::signatures/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 23 | |||||||||||
| 24 | 59 | requires('get_help'); | |||||||||
| 25 | |||||||||||
| 26 | 159 | ▶ | sub get_help_as_text ($self, @args) { | ||||||||
|
Subroutine
get_help_as_text: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 27 | 159 | my $pod = $self->get_help(@args) ; | |||||||||
| 28 | 159 | ▶ | return unless defined $pod; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 29 | |||||||||||
| 30 | 120 | my $parser = Pod::Text->new( | |||||||||
| 31 | indent => 0, | ||||||||||
| 32 | nourls => 1, | ||||||||||
| 33 | ); | ||||||||||
| 34 | |||||||||||
| 35 | # require Pod::Simple 3.23 | ||||||||||
| 36 | 120 | $parser->parse_characters('utf8'); | |||||||||
| 37 | |||||||||||
| 38 | 120 | my $output = ''; | |||||||||
| 39 | 120 | $parser->output_string(\$output); | |||||||||
| 40 | |||||||||||
| 41 | 120 | $parser->parse_string_document("=pod\n\n" . $pod); | |||||||||
| 42 | 120 | $output =~ s/[\n\s]+$//; | |||||||||
| 43 | |||||||||||
| 44 | 120 | return $output; | |||||||||
| 45 | } | ||||||||||
| 46 | |||||||||||
| 47 | 59 | 1; | |||||||||
| 48 | |||||||||||
| 49 | __END__ | ||||||||||