Commits

Shlomi Fish committed c22d12b

Refactoring: extract the _on_output higher-level method.

Comments (0)

Files changed (1)

modules/App-XML-DocBook-Docmake/lib/App/XML/DocBook/Docmake.pm

     }
 }
 
+sub _on_output
+{
+    my ($self, $meth, $args) = @_;
+
+    return $self->_has_output() ? $self->$meth($args) : ();
+}
+
+sub _calc_output_params
+{
+    my ($self,$args) = @_;
+
+    return
+    (
+        output => $self->_calc_output_param_for_xslt($args),
+        make_output => $self->_calc_make_output_param_for_xslt($args),
+    );
+}
+
+sub _calc_template_o_flag
+{
+    my ($self,$args) = @_;
+
+    return ("-o", $self->_output_cmd_comp());
+}
+
 sub _run_xslt
 {
     my $self = shift;
     return $self->_run_input_output_cmd(
         {
             input => $self->_input_path(),
-            ($self->_has_output()
-                ? (
-                    output => $self->_calc_output_param_for_xslt($args),
-                    make_output =>
-                        $self->_calc_make_output_param_for_xslt($args),
-                )
-                : ()
-            ),
+            $self->_on_output('_calc_output_params', $args),
             template =>
             [
                 "xsltproc",
-                $self->_has_output() ? ("-o", $self->_output_cmd_comp()) : (),
+                $self->_on_output('_calc_template_o_flag', $args),
                 (map { ("--stringparam", @$_ ) } @{$self->_xslt_stringparams()}),
                 @base_path_params,
                 @stylesheet_params,
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.