Commits

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

Refactored ::FromProto to use ->_short_isa.

  • Participants
  • Parent commits 9eb2dd5

Comments (0)

Files changed (2)

File perl/modules/XML-Grammar-Fiction/lib/XML/Grammar/Fiction/FromProto.pm

 {
     my ($self, $elem) = @_;
 
-    if ($elem->isa("XML::Grammar::Fiction::FromProto::Node::Saying"))
+    if ($elem->_short_isa("Saying"))
     {
         return ["saying", 'character' => $elem->character()];
     }
-    elsif ($elem->isa("XML::Grammar::Fiction::FromProto::Node::Description"))
+    elsif ($elem->_short_isa("Description"))
     {
         return ["description"];
     }
     {
         $self->_writer->characters($elem);
     }
-    elsif ($elem->isa("XML::Grammar::Fiction::FromProto::Node::Text"))
+    elsif ($elem->_short_isa("Text"))
     {
         foreach my $child (@{$elem->_get_childs()})
         {
             $self->_write_elem({ elem => $child,},);
         }
     }
-    elsif ($elem->isa("XML::Grammar::Fiction::FromProto::Node::Paragraph"))
+    elsif ($elem->_short_isa("Paragraph"))
     {
         $self->_output_tag_with_childs(
             {
             },
         );
     }
-    elsif ($elem->isa("XML::Grammar::Fiction::FromProto::Node::List"))
+    elsif ($elem->_short_isa("List"))
     {
         foreach my $child (@{$elem->contents()})
         {
             $self->_write_elem({elem => $child, });
         }
     }
-    elsif ($elem->isa("XML::Grammar::Fiction::FromProto::Node::Element"))
+    elsif ($elem->_short_isa("Element"))
     {
         if ($elem->name() eq "title")
         {
         {
             $self->_writer->emptyTag("br");
         }
-        elsif ($elem->isa("XML::Grammar::Fiction::FromProto::Node::InnerDesc"))
+        elsif ($elem->_short_isa("InnerDesc"))
         {
             $self->_output_tag_with_childs(
                 {
             );
         }
     }
-    elsif ($elem->isa("XML::Grammar::Fiction::FromProto::Node::Text"))
+    elsif ($elem->_short_isa("Text"))
     {
         $self->_output_tag_with_childs(
             {
             },
         );
     }
-    elsif ($elem->isa("XML::Grammar::Fiction::FromProto::Node::Comment"))
+    elsif ($elem->_short_isa("Comment"))
     {
         $self->_writer->comment($elem->text());
     }

File perl/modules/XML-Grammar-Fiction/lib/XML/Grammar/Fiction/FromProto/Nodes.pm

 
 use Moose;
 
+extends("XML::Grammar::Fiction::FromProto::Node");
+
 has 'contents' => (isa => "ArrayRef", is => "rw");
 
 package XML::Grammar::Fiction::FromProto::Node::Text;