create new tag
, view all tags

Feature Proposals » TWiki to run under the current perl version


Current State: Developer: Reason: Date: Concerns By: Bug Tracking: Proposed For:
UnderInvestigation HaraldJoerg None 2017-04-01     KampalaRelease

Edit Form

DateOfCommitment:   Format: YYYY-MM-DD


This is a recurring action, and right now the topic is "Perl 5.24.1". While it is generally a good idea to check that TWiki works with up-to-date Perl, it gets somewhat urgent when this Perl version is found in the wild.

Description and Documentation

The most notable difference in Perl 5.24 is that CGI.pm is no longer part of the Perl core. It is, of course, available as a package from CPAN and from Debian (libcgi-pm-perl), but both of them come in versions which are not compatible with TWiki. As we have learned, CgiContrib is not a complete solution to the problem.


Right now, Strawberry Perl is available with Perl 5.24, and within 2017 I'd expect the release of Debian Stretch, which ships with Perl 5.24.


Without some action, TWiki can't be installed on Debian Stretch and will not work with current Strawberry Perl.

WhatDoesItAffect: Install


I'd hope that the effort is rather small. One known issue is the early invocation of CGI::Carp in the TWikiScripts which is not caught properly by CgiContrib.

The plan:

  • Run TWiki from SVN using Perl 5.24 and the PSGI Engine to check for other pitfalls. First results:
    • Basic viewing and editing just works, because PSGI avoids the CGI::Carp problem.
    • configure breaks with Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/}{ <-- HERE / at lib/TWiki/Configure/UI.pm line 100. (and perhaps more to come). This is "only" a warning, but in configure, every warning raises a fatal error (which is a good thing).
  • Run the test suite under 5.24 (CPAN:App::perlbrew to the rescue)
    • Doing so, it turns out that there are plenty of this unescaped left braces in TWiki regexes. Unfortunately the TWiki syntax %FOO{ is often examined by a regex /\%FOO{.../ which should in Perl 5.24 be written as /\%FOO\{.../. The escaped version works in any Perl version back to 5.8, so we're safe to change it though it is tedious. -- Harald Jörg - 2017-03-25
    • The count for the unescaped left brace issue is about a dozen in core, and about 200 in plugins. Every request causes several warnings to the web server error log, for persistent interpreters there's just one warning per module. Fortunately, the fix can be applied per program: Write a test script, parse the resulting warnings which are pretty precise about files and lines, and fix these lines. Patch available (2455 lines). -- haj 2017-04-01
  • Finally, of course, fix the CGI::Carp issue.
    • Two news on that item: First, the fix is a small one, albeit a bit ugly. It is not sufficient to simply move TWiki's lib magic. We must also avoid to use the module within the BEGIN block, because use outruns require. An example diff for view is attached. Second, I discovered by accident that TWiki 6.0.2 will work with Perl 5.26 if both the system's CGI (from CPAN or Linux distribution) and TWiki's CgiContrib are installed: In that case, CGI::Carp is taken from the system (before TWiki adds its own libraries), and CGI later on from CgiContrib. I caught the system library by installing CGI::Session which depends on CGI. I would prefer not to rely on such a construction. -- haj 2017-04-01

-- Contributors: Harald Jörg - 2017-03-21


Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatdiff cgi_carp.diff r1 manage 0.7 K 2017-04-01 - 16:36 HaraldJoerg An example diff how to avoid the CGI::Carp issue in Perl without CGI.pm
Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r3 - 2017-04-01 - HaraldJoerg
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.