• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item7796: TWiki with current Perl: Make CGI::Carp work from TWiki's distribution

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Engine   Normal Closed TWiki:Main.HaraldJoerg patch 6.1.0

Edit Form Data

Reported By:
Applies To:
Current State:
Waiting For:
Target Release:
Released In:


In TWiki's scripts, CGI::Carp is required before we have a chance to add TWiki's own lib directories which provide it. This breaks in Perl versions where CGI is no longer part of the Perl core because of incompatible changes in current CPAN versions. See TWiki:Codev.TWikiWithCurrentPerl for details.
  • Done in Rev. 30317 (not shown here??) and Rev. 30319. No problems so far, should be good to go. -- TWiki:Main/HaraldJoerg - 2017-05-26

-- TWiki:Main/HaraldJoerg - 2017-04-07

-- TWiki:Main.HaraldJoerg - 2017-07-06

Second try.... all files in the bin directory are patched as shown in the attachment nocgi.diff. Now, the procedure is like this:

  1. Immediately at start, activate Carp::confess as a die handler. Carp.pm is in Perl core since at least version 5.8.8. This works for CLI and CGI environment, regardless of whether CGI.pm comes with Perl, or is installed on the system, or neither of both.
  2. Set $TWiki::cfg{Engine} according to the environment, but do not switch to CGI::Carp for a CGI environment right now.
  3. Add the current directory to @INC and require 'setlib.cfg'.
    • Since we've already activated a die handler, problems in setlib.cfg or LocalLib.cfg will provide a stacktrace as confess does (unless suppressed by eval).
  4. Now, after setlib.cfg is done, it is safe to switch to CGI::Carp only in a CGI environment and establish CGI::Carp::confess as die handler. At this stage the fallback provided by TWiki's own copy of CGI::Carp is available!

The last step could also be factored out into the equivalent BEGIN block in TWiki.pm.

-- TWiki:Main.HaraldJoerg - 2017-11-02

This seems to be fixed now, marking it ready for release. If needed, open a new item.

-- TWiki:Main.PeterThoeny - 2018-07-15

Summary TWiki with current Perl: Make CGI::Carp work from TWiki's distribution
ReportedBy TWiki:Main.HaraldJoerg
Codebase ~twiki4, 6.0.2
SVN Range TWiki-6.0.2-trunk, Sun, 12 Feb 2017, build 30309
AppliesTo Engine

Priority Normal
CurrentState Closed
WaitingFor TWiki:Main.HaraldJoerg
Checkins TWikirev:30319 TWikirev:30371 TWikirev:30372 TWikirev:30402
TargetRelease patch
ReleasedIn 6.1.0
Topic attachments
I Attachment History Action Size Date Who Comment
Unknown file formatdiff nocgi.diff r1 manage 0.4 K 2017-11-02 - 15:14 HaraldJoerg Diff file appied to every file in core/bin
Edit | Attach | Watch | Print version | History: r12 < r11 < r10 < r9 < r8 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r12 - 2018-07-17 - PeterThoeny
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2023 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback