Commits

shl...@52c325ad-5fd0-0310-8a0f-c43feede02cc  committed edc9750

Extract _get_info_node_fields.

  • Participants
  • Parent commits d482f60

Comments (0)

Files changed (1)

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

     return;
 }
 
+sub _get_info_node_fields
+{
+    my ($self, $info_node) = @_;
+
+    return
+        reverse
+        sort {
+            $self->_info_field_value($a) <=> $self->_info_field_value($b)
+        }
+        $info_node->findnodes("*")
+    ;
+
+}
+
 sub _render_info
 {
     my ($self) = @_;
     $self->_start_new_line;
 
     my ($info) = $fortune->findnodes("descendant::info");
-    
-    my @fields = $info->findnodes("*");
 
-    foreach my $field_node (
-        reverse(
-        sort { 
-            $self->_info_field_value($a) <=> $self->_info_field_value($b)
-        }
-        @fields)
-    )
+    foreach my $field_node ($self->_get_info_node_fields($info))
     {
         $self->_out_info_field_node($info, $field_node);
     }