Skip to content

Commit

Permalink
Eliminates EVAL from rendering
Browse files Browse the repository at this point in the history
It's now using Pod::Load for all the "external" pod rendering
needs. Closes #55
  • Loading branch information
JJ committed Dec 14, 2018
1 parent 8b32091 commit 22d0418
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 1 addition & 3 deletions lib/Pod/To/HTML.pm
@@ -1,7 +1,5 @@
unit class Pod::To::HTML;

use MONKEY-SEE-NO-EVAL;

use URI::Escape;
use Template::Mustache;
use Pod::Load;
Expand Down Expand Up @@ -33,7 +31,7 @@ multi method render(IO::Path $file, Str :$header = '', Str :$footer = '', Str :h
}

multi method render(Str $pod-string, Str :$header = '', Str :$footer = '', Str :head-fields($head) = '', :$default-title = '', :$lang = 'en') {
pod2html(EVAL($pod-string ~ "\n\$=pod"), :$header, :$footer, :$head, :$default-title, :$lang);
pod2html($pod-string, :$header, :$footer, :$head, :$default-title, :$lang);
}

# FIXME: this code's a horrible mess. It'd be really helpful to have a module providing a generic
Expand Down
9 changes: 8 additions & 1 deletion t/011-external.t
@@ -1,6 +1,6 @@
use Test; # -*- mode: perl6 -*-
use Pod::To::HTML;
plan 8;
plan 9;

use MONKEY-SEE-NO-EVAL;

Expand All @@ -22,3 +22,10 @@ sub test-files( $possible-file-path ) {
$r = pod2html($pod, :header(''), :footer(''), :head(''), :default-title(''), :lang('en'));
unlike( $r, /Pod\:\:To/, "Is not prepending class name" );
}

my $class = q:to/EOC/;
#| Hello!
class XYZ {}
EOC
my $rendered= Pod::To::HTML.render($class);
unlike( $rendered, /Pod\:\:To/, "Is not prepending class name" );

0 comments on commit 22d0418

Please sign in to comment.