Skip to content

feat: bundle CPAN Text::CSV 2.06 with Text::CSV_PP backend#462

Merged
fglock merged 2 commits into
masterfrom
feature/text-csv-bundled-tests
Apr 8, 2026
Merged

feat: bundle CPAN Text::CSV 2.06 with Text::CSV_PP backend#462
fglock merged 2 commits into
masterfrom
feature/text-csv-bundled-tests

Conversation

@fglock
Copy link
Copy Markdown
Owner

@fglock fglock commented Apr 8, 2026

Summary

Replace the custom Java-backed Text::CSV.pm with the official CPAN Text::CSV 2.06 wrapper + Text::CSV_PP (pure Perl) implementation. This gives us a complete, spec-compliant CSV module that passes 38/40 CPAN test files.

Architecture

  • Text::CSV.pm: CPAN 2.06 thin wrapper (146 lines, replaces 632-line custom implementation)
  • Text::CSV_PP.pm: CPAN pure-Perl CSV implementation (6454 lines, complete Text::CSV_XS-compatible)
  • Text::CSV_XS.pm: New stub that inherits from CSV_PP with VERSION 1.61 to satisfy the >= 1.60 version check

Key Changes

  • TextCsv.java: Disabled XS method registration (now a no-op) since CPAN CSV_PP handles all functionality
  • DataSection.java: Added reset() method to clear stale DATA/END state between JUnit test runs
  • PerlLanguageProvider.java: Call DataSection.reset() from resetAll()
  • Text::CSV_XS.pm: Install PublicMethods in stash so CSV.pm alias lookup works
  • Test resources: Added lib/Text/CSV_PP.pm symlink for tests that read error messages from the PP source

Test Results

  • 38/38 included CPAN tests pass (all Text-CSV module tests green)
  • 2 tests excluded from suite:
    • 00_pod.t: Requires Test::Pod (documentation quality test, not functional)
    • 70_rt.t: Contains raw non-UTF-8 bytes that the JUnit test harness corrupts when reading as UTF-8
  • All 113 existing unit tests in text_csv.t continue to pass
  • All XML-Parser module tests continue to pass
  • Full make passes with no regressions

Test plan

  • make passes (all unit tests)
  • make test-bundled-modules passes (XML-Parser + Text-CSV)
  • JPERL_TEST_FILTER=Text-CSV ./gradlew testModule - 38/38 pass
  • Existing text_csv.t unit test - 113/113 pass

Generated with Devin

@fglock fglock changed the title feat: Text::CSV bundled module CPAN tests feat: bundle CPAN Text::CSV 2.06 with Text::CSV_PP backend Apr 8, 2026
fglock and others added 2 commits April 8, 2026 11:10
Add 40 original CPAN Text::CSV 2.06 test files to
src/test/resources/module/Text-CSV/ for testing the bundled
Java-backed Text::CSV implementation.

Initial Text::CSV.pm improvements:
- Add version(), status(), error_input(), is_pp(), is_xs(), module()
- Add attribute validation in new() with known attribute allowlist
- Add global error state for class-method error_diag()
- Fix new() to handle object-method calls (ref $class || $class)
- Fix quote_char/sep_char setters to accept undef
- Add attribute aliases: sep, quote, escape, quote_always, verbose_diag

Baseline: 2/40 tests pass. Plan documented in
dev/modules/text_csv_bundled_tests_plan.md

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Replace the custom Java-backed Text::CSV.pm with the official CPAN
Text::CSV 2.06 wrapper + Text::CSV_PP (pure Perl) implementation.

Architecture:
- Text::CSV.pm: CPAN 2.06 thin wrapper (146 lines, replaces 632-line custom)
- Text::CSV_PP.pm: CPAN pure-Perl CSV implementation (6454 lines)
- Text::CSV_XS.pm: Stub inheriting from CSV_PP with VERSION 1.61

Key changes:
- Disabled TextCsv.java XS registration (now a no-op)
- Added DataSection.reset() to fix __DATA__/__END__ stale state between
  JUnit test runs
- Installed PublicMethods in CSV_XS stash so CSV.pm alias lookup works
- Added lib/Text/CSV_PP.pm symlink in test resources

Test results: 38/38 included CPAN tests pass
- Excluded: 00_pod.t (needs Test::Pod), 70_rt.t (non-UTF-8 bytes)
- All 113 unit tests in text_csv.t continue to pass

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@fglock fglock force-pushed the feature/text-csv-bundled-tests branch from 125c4f1 to 9f43104 Compare April 8, 2026 09:10
@fglock fglock merged commit 3a2e0c6 into master Apr 8, 2026
2 checks passed
@fglock fglock deleted the feature/text-csv-bundled-tests branch April 8, 2026 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant