} @_
}
+sub _glob_glob { eval '\*CORE::GLOBAL::glob' }
+
sub _find_tags { shift; @_ }
sub _find_target {
return (caller($level))[0];
}
-{
- my $setup;
-
- sub _setup_glob_override {
- return if $setup;
- $setup = 1;
- no warnings 'redefine';
- *CORE::GLOBAL::glob = sub {
- for ($_[0]) {
- # unless it smells like </foo> or <foo bar="baz">
- return File::Glob::glob($_[0]) unless (/^\/\w+$/ || /^\w+\s+\w+="/);
- }
- return \('<'.$_[0].'>');
- };
- }
+sub _setup_glob_override {
+ no warnings 'redefine';
+ delete ${CORE::GLOBAL::}{glob};
+ *{_glob_glob()} = sub {
+ return \('<'.$_[0].'>');
+ };
}
sub _export_tags_into {
no strict 'refs';
delete ${"${into}::"}{$tag}
}
+ delete ${CORE::GLOBAL::}{glob};
+ *{_glob_glob()} = \&File::Glob::glob;
$IN_SCOPE = 0;
};
}
use HTML::Tags;
<html>, <body id="spoon">, "YAY", </body>, </html>;
}
+
+ sub globbery {
+ <t/globbery/*>;
+ }
}
is(
'<html><body id="spoon">YAY</body></html>',
'HTML tags ok'
);
+
+is(
+ join(', ', Foo::globbery),
+ 't/globbery/one, t/globbery/two',
+ 'real glob re-installed ok'
+);