diff --git a/docs/about/changelog.md b/docs/about/changelog.md index aa3560c24d..44e7374fa2 100644 --- a/docs/about/changelog.md +++ b/docs/about/changelog.md @@ -9,6 +9,8 @@ Release history of PerlOnJava. See [Roadmap](roadmap.md) for future plans. - Fix numeric-zero results from failed `s///` substitutions. - Preserve references in `utf8::downgrade`. - Fix RFC 2047 header decoding for Email::MIME. +- Fix XML::Parser streaming from native filehandles before `IO::Handle` has + been explicitly loaded. - Bundle the complete CPAN `File::Path` 2.18 implementation, including modern `rmtree`/`remove_tree` options such as `keep_root`, `error`, `result`, `safe`, and `verbose`. diff --git a/src/main/perl/lib/XML/Parser/Expat.pm b/src/main/perl/lib/XML/Parser/Expat.pm index 410901f63c..2acafaef21 100644 --- a/src/main/perl/lib/XML/Parser/Expat.pm +++ b/src/main/perl/lib/XML/Parser/Expat.pm @@ -473,11 +473,14 @@ sub parse { if ( defined $arg ) { local *@; + # PerlOnJava recognizes native filehandles as IO::Handle objects before + # their Perl package is loaded. Load the method provider before either + # branch can call input_record_separator below. + require IO::Handle; if ( ref($arg) and UNIVERSAL::isa( $arg, 'IO::Handle' ) ) { $ioref = $arg; } else { - require IO::Handle; eval { no strict 'refs'; if ( ref $arg eq 'GLOB' ) {