Commits

Shlomi Fish committed 886e522

Avoid duplicate code (and a bug) in _undefize.

Made it a class method.

Comments (0)

Files changed (3)

XML-GrammarBase/lib/XML/GrammarBase/Role/DataDir.pm

 
 sub _undefize
 {
+    my $class = shift;
     my $v = shift;
 
     return defined($v) ? $v : "(undef)";

XML-GrammarBase/lib/XML/GrammarBase/Role/RelaxNG.pm

     else
     {
         confess "RelaxNG validation failed [\$ret_code == "
-            . _undefize($ret_code) . " ; $@]"
+            . $self->_undefize($ret_code) . " ; $@]"
             ;
     }
 

XML-GrammarBase/lib/XML/GrammarBase/Role/XSLT/Global.pm

     return $self->_xslt_parser->parse_stylesheet($style_doc);
 }
 
-sub _undefize
-{
-    my $v = shift;
-
-    return defined($v) ? $v : "(undef)";
-}
-
 sub _calc_and_ret_dom_without_validate
 {
     my $self = shift;
     else
     {
         confess "RelaxNG validation failed [\$ret_code == "
-            . _undefize($ret_code) . " ; $@]"
+            . $self->_undefize($ret_code) . " ; $@]"
             ;
     }