reinstate the right glob in XML::Tags (RT#120071)
[catagits/Web-Simple.git] / lib / XML / Tags.pm
index 9249691..6a0ea5c 100644 (file)
@@ -17,6 +17,7 @@ sub import {
   my $target = $class->_find_target(0, $opts);
   my @tags = $class->_find_tags(@args);
   my $unex = $class->_export_tags_into($target => @tags);
+  if ($INC{"bareword/filehandles.pm"}) { bareword::filehandles->import }
   $class->_install_unexporter($unex);
   $IN_SCOPE = 1;
 }
@@ -26,7 +27,11 @@ sub to_xml_string {
     ref($_)
       ? (ref $_ eq 'SCALAR' ? $$_ : $_)
       : do { local $_ = $_; # copy
-          s/&/&amp;/g; s/"/&quot;/g; s/</&lt;/g; s/>/&gt;/g; $_;
+          if (defined) {
+            s/&/&amp;/g; s/"/&quot;/g; s/</&lt;/g; s/>/&gt;/g; $_;
+          } else {
+            ''
+          }
         }
   } @_
 }
@@ -68,7 +73,7 @@ sub _export_tags_into {
       no strict 'refs';
       delete ${"${into}::"}{$tag}
     }
-    _set_glob(\&File::Glob::glob);
+    _set_glob(\&File::Glob::csh_glob);
     overload::remove_constant('q');
     $IN_SCOPE = 0;
   };
@@ -76,7 +81,7 @@ sub _export_tags_into {
 
 sub _install_unexporter {
   my ($class, $unex) = @_;
-  $^H |= 0x120000; # localize %^H
+  $^H |= 0x20000; # localize %^H
   $^H{'XML::Tags::Unex'} = bless($unex, 'XML::Tags::Unex');
 }