Commits

Anonymous committed 4cd1834

Extract a method to output the info string in its own "-- " line.

It formats the string as " -- Something" and was used in three places.

Comments (0)

Files changed (1)

XML-Grammar-Fortune/module/lib/XML/Grammar/Fortune/ToText.pm

     return $content;
 }
 
+sub _output_info_value
+{
+    my ($self, $string) = @_;
+
+    return $self->_out((' ' x 4) . '-- ' . $string . "\n");
+}
+
 sub _out_info_field_node
 {
     my ($self, $info_node, $field_node) = @_;
 
     if ($name eq "author")
     {
-        $self->_out((" " x 4) . "-- " . $value . "\n");
+        $self->_output_info_value($value);
     }
     elsif (($name eq "work") || ($name eq "tagline"))
     {
         my $url = "";
+
         if ($field_node->hasAttribute("href"))
         {
             $url = " ( " . $field_node->getAttribute("href") . " )";
         }
-        $self->_out(
-              (" " x 4) . "-- "
-            . $value
-            . $url
-            . "\n"
-        );
+
+        $self->_output_info_value($value.$url);
     }
     elsif ($name eq "channel")
     {
         my $channel = $field_node->textContent();
         my $network = $info_node->findnodes("network")->shift()->textContent();
         
-        $self->_out(
-            (" " x 4) . "-- "
-            . "$channel, $network"
-            . "\n"
-        );
+        $self->_output_info_value( "$channel, $network" );
     }
 
     return;