Permalink
Browse files

Item14366: Reorder initialization to allow local CGI::Carp

Latest perl does not ship with CGI or CGI::Carp.  By using a "use"
statement in the BEGIN block, it's not possible to provide this module
via setlib path overide.  Change to a "require" and reorder
initialization to call setlib before setting up CGI::Carp
  • Loading branch information...
gac410 committed Apr 8, 2017
1 parent 1b50aad commit 8a9c3c4c43c84c8ee74fb35e92b466fccfdb8319
@@ -6,20 +6,22 @@ use warnings;
use File::Spec;
BEGIN {
my ( $volume, $binDir, $action ) = File::Spec->splitpath(__FILE__);
my $setlib = File::Spec->catpath( $volume, $binDir, 'setlib.cfg' );
@INC = ( '.', grep { $_ ne '.' } @INC ) unless $binDir;
require $setlib;
if ( defined $ENV{GATEWAY_INTERFACE} || defined $ENV{MOD_PERL} ) {
$Foswiki::cfg{Engine} = 'Foswiki::Engine::CGI';
use CGI::Carp qw(fatalsToBrowser);
require CGI::Carp;
CGI::Carp->import(qw(fatalsToBrowser));
$SIG{__DIE__} = \&CGI::Carp::confess;
}
else {
$Foswiki::cfg{Engine} = 'Foswiki::Engine::CLI';
require Carp;
$SIG{__DIE__} = \&Carp::confess;
}
my ( $volume, $binDir, $action ) = File::Spec->splitpath(__FILE__);
my $setlib = File::Spec->catpath( $volume, $binDir, 'setlib.cfg' );
@INC = ( '.', grep { $_ ne '.' } @INC ) unless $binDir;
require $setlib;
$action =~ s/\..*$//; # Remove eventual file extension
$ENV{FOSWIKI_ACTION} = $action;
}
@@ -30,7 +32,7 @@ $Foswiki::engine->run();
__END__
Foswiki - The Free and Open Source Wiki, http://foswiki.org/
Copyright (C) 2008-2014 Foswiki Contributors. Foswiki Contributors
Copyright (C) 2008-2010 Foswiki Contributors. Foswiki Contributors
are listed in the AUTHORS file in the root of this distribution.
NOTE: Please extend that file, not this notice.
@@ -6,20 +6,22 @@ use warnings;
use File::Spec;
BEGIN {
my ( $volume, $binDir, $action ) = File::Spec->splitpath(__FILE__);
my $setlib = File::Spec->catpath( $volume, $binDir, 'setlib.cfg' );
@INC = ( '.', grep { $_ ne '.' } @INC ) unless $binDir;
require $setlib;
if ( defined $ENV{GATEWAY_INTERFACE} || defined $ENV{MOD_PERL} ) {
$Foswiki::cfg{Engine} = 'Foswiki::Engine::CGI';
use CGI::Carp qw(fatalsToBrowser);
require CGI::Carp;
CGI::Carp->import(qw(fatalsToBrowser));
$SIG{__DIE__} = \&CGI::Carp::confess;
}
else {
$Foswiki::cfg{Engine} = 'Foswiki::Engine::CLI';
require Carp;
$SIG{__DIE__} = \&Carp::confess;
}
my ( $volume, $binDir, $action ) = File::Spec->splitpath(__FILE__);
my $setlib = File::Spec->catpath( $volume, $binDir, 'setlib.cfg' );
@INC = ( '.', grep { $_ ne '.' } @INC ) unless $binDir;
require $setlib;
$action =~ s/\..*$//; # Remove eventual file extension
$ENV{FOSWIKI_ACTION} = $action;
}
@@ -30,7 +32,7 @@ $Foswiki::engine->run();
__END__
Foswiki - The Free and Open Source Wiki, http://foswiki.org/
Copyright (C) 2008-2014 Foswiki Contributors. Foswiki Contributors
Copyright (C) 2008-2010 Foswiki Contributors. Foswiki Contributors
are listed in the AUTHORS file in the root of this distribution.
NOTE: Please extend that file, not this notice.
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" date="1421599902" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" date="1491685944" format="1.1" version="1"}%
%META:TOPICPARENT{name="CompareRevisionsAddOn"}%
---+ !CompareRevisionsAddOn Plugin
@@ -32,6 +32,7 @@ Test: <nop>CompareRevisionsAddOnPlugin is %IF{"context CompareRevisionsAddOnPlug
| Version: | %$VERSION% |
| Release: | %$RELEASE% |
| Change History: | <!-- versions below in reverse order -->&nbsp; |
| 08 Apr 2017 (1.115) | Foswikitask:Item14366: Reorder initialization to allow local CGI::Carp. |
| 01 May 2014 (1.112) | Foswikitask:Item12407: Don't decode entities during comparson. Convert to simple decimal version. |
| 10 Feb 2014 | Foswikitask:Item12741: Formatting parameters not passed on the referenced scripts |
| 23 Oct 2013 (1.1.11) | Foswikitask:Item12423: fix double encoding in header on UTF-8 sites |
@@ -2,12 +2,12 @@ package Foswiki::Contrib::CompareRevisionsAddOn;
use strict;
# Also update CompareRevisionsAddOnPlugin
our $VERSION = '1.114';
our $VERSION = '1.115';
# This is a free-form string you can use to "name" your own plugin version.
# It is *not* used by the build automation tools, but is reported as part
# of the version number in PLUGINDESCRIPTIONS. Keep in sync with $VERSION
our $RELEASE = '1.114';
our $RELEASE = '08 Apr 2017';
our $SHORTDESCRIPTION =
'Compares two revisions of a document. In contrast to normal _rdiff_, the comparison is done with the rendered HTML output.';
@@ -16,7 +16,7 @@ our $SHORTDESCRIPTION =
__END__
Foswiki - The Free and Open Source Wiki, http://foswiki.org/
Copyright (C) 2008-2015 Foswiki Contributors. Foswiki Contributors
Copyright (C) 2008-2017 Foswiki Contributors. Foswiki Contributors
are listed in the AUTHORS file in the root of this distribution.
NOTE: Please extend that file, not this notice.
@@ -6,20 +6,22 @@ use warnings;
use File::Spec;
BEGIN {
my ( $volume, $binDir, $action ) = File::Spec->splitpath(__FILE__);
my $setlib = File::Spec->catpath( $volume, $binDir, 'setlib.cfg' );
@INC = ( '.', grep { $_ ne '.' } @INC ) unless $binDir;
require $setlib;
if ( defined $ENV{GATEWAY_INTERFACE} || defined $ENV{MOD_PERL} ) {
$Foswiki::cfg{Engine} = 'Foswiki::Engine::CGI';
use CGI::Carp qw(fatalsToBrowser);
require CGI::Carp;
CGI::Carp->import(qw(fatalsToBrowser));
$SIG{__DIE__} = \&CGI::Carp::confess;
}
else {
$Foswiki::cfg{Engine} = 'Foswiki::Engine::CLI';
require Carp;
$SIG{__DIE__} = \&Carp::confess;
}
my ( $volume, $binDir, $action ) = File::Spec->splitpath(__FILE__);
my $setlib = File::Spec->catpath( $volume, $binDir, 'setlib.cfg' );
@INC = ( '.', grep { $_ ne '.' } @INC ) unless $binDir;
require $setlib;
$action =~ s/\..*$//; # Remove eventual file extension
$ENV{FOSWIKI_ACTION} = $action;
}
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" date="1491355273" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" date="1491685944" format="1.1" version="1"}%
%META:TOPICPARENT{name="Plugins"}%
---+!! Configure Plugin
%FORMFIELD{"Description"}%
@@ -42,7 +42,8 @@ The plugin uses the =JsonRpcContrib=, which must be installed.
---++ Change History
| 04 Apr 2017: | (1.08) Foswikitask:Item13883: Updated base template to suggest solutions when configure shows base login page. |
| 04 Apr 2017: | (1.08) Foswikitask:Item13883: Updated base template to suggest solutions when configure shows base login page.<br/>\
Foswikitask:Item14366: Reorder initialization to allow local CGI::Carp |
| 23 Jan 2017: | (1.07) Foswikitask:Item14287: Configure needs to encode reported configuration values. |
| 28 Nov 2016: | (1.06) Foswikitask:Item13206: Upgrade to latest jquery-ui |
| 11 Apr 2016: | (1.05) Foswikitask:Item14049: fixed jsonrpc endpoint |
View
@@ -1,46 +1,58 @@
#! /usr/bin/env perl
# Foswiki - The Free and Open Source Wiki, http://foswiki.org/
#
# Copyright (C) 2011-2015 Michael Daum http://michaeldaumconsulting.com
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version. For
# more details read LICENSE in the root of this distribution.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# As per the GPL, removal of this notice is prohibited.
#! /usr/bin/env perl
# See bottom of file for license and copyright information
use strict;
use warnings;
use File::Spec;
BEGIN {
my ( $volume, $binDir, $action ) = File::Spec->splitpath(__FILE__);
my $setlib = File::Spec->catpath( $volume, $binDir, 'setlib.cfg' );
@INC = ( '.', grep { $_ ne '.' } @INC ) unless $binDir;
require $setlib;
if ( defined $ENV{GATEWAY_INTERFACE} || defined $ENV{MOD_PERL} ) {
$Foswiki::cfg{Engine} = 'Foswiki::Engine::CGI';
use CGI::Carp qw(fatalsToBrowser);
require CGI::Carp;
CGI::Carp->import(qw(fatalsToBrowser));
$SIG{__DIE__} = \&CGI::Carp::confess;
}
else {
$Foswiki::cfg{Engine} = 'Foswiki::Engine::CLI';
require Carp;
$SIG{__DIE__} = \&Carp::confess;
}
my ( $volume, $binDir, $action ) = File::Spec->splitpath(__FILE__);
my $setlib = File::Spec->catpath( $volume, $binDir, 'setlib.cfg' );
@INC = ( '.', grep { $_ ne '.' } @INC ) unless $binDir;
require $setlib;
$action =~ s/\..*$//; # Remove eventual file extension
$ENV{FOSWIKI_ACTION} = $action;
}
use Foswiki ();
use Foswiki::UI ();
$Foswiki::engine->run();
__END__
Foswiki - The Free and Open Source Wiki, http://foswiki.org/
Copyright (C) 2008-2017 Foswiki Contributors. Foswiki Contributors
are listed in the AUTHORS file in the root of this distribution.
NOTE: Please extend that file, not this notice.
Additional copyrights apply to some or all of the code in this
file as follows:
Copyright (C) 2011-2015 Michael Daum http://michaeldaumconsulting.com
Copyright (C) 1999-2007 Peter Thoeny, peter@thoeny.org
and TWiki Contributors. All Rights Reserved. TWiki Contributors
are listed in the AUTHORS file in the root of this distribution.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. For
more details read LICENSE in the root of this distribution.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1;
As per the GPL, removal of this notice is prohibited.
@@ -1,4 +1,4 @@
%META:TOPICINFO{author="ProjectContributor" comment="" date="1480189276" format="1.1" version="1"}%
%META:TOPICINFO{author="ProjectContributor" comment="" date="1491685944" format="1.1" version="1"}%
---+!! %TOPIC%
%FORMFIELD{"Description"}%
@@ -216,6 +216,7 @@ If a namespace, method, or parameters are specified as part of a JSON-RPC reques
%$DEPENDENCIES%
---++ Change History
| 08 Apr 2017: (2.28) | Foswikitask:Item14366: Reorder initialization to allow local CGI::Carp. |
| 26 Nov 2016: (2.27) | Released with Foswiki 2.1.3.<br>\
Foswikitask:Item14204: redirectto incorrectly encodes Anchors. |
| 04 Apr 2016: (2.26) | Foswikitask:Item14025: Fix issues with JSON::XS 3.02 in some environments. |
@@ -21,8 +21,8 @@ BEGIN {
=cut
our $VERSION = '2.27';
our $RELEASE = '26 Nov 2016';
our $VERSION = '2.28';
our $RELEASE = '08 Apr 2017';
our $SHORTDESCRIPTION = 'JSON-RPC interface for Foswiki';
our $NO_PREFS_IN_TOPIC = 1;
our $SERVER;
@@ -49,7 +49,7 @@ sub getServer {
__END__
# Plugin for Foswiki - The Free and Open Source Wiki, http://foswiki.org/
#
# JsonRpcContrib is Copyright (C) 2011-2016 Michael Daum http://michaeldaumconsulting.com
# JsonRpcContrib is Copyright (C) 2011-2017 Michael Daum http://michaeldaumconsulting.com
# and Foswiki Contributors.
#
# This program is free software; you can redistribute it and/or
View
@@ -6,20 +6,22 @@ use warnings;
use File::Spec;
BEGIN {
my ( $volume, $binDir, $action ) = File::Spec->splitpath(__FILE__);
my $setlib = File::Spec->catpath( $volume, $binDir, 'setlib.cfg' );
@INC = ( '.', grep { $_ ne '.' } @INC ) unless $binDir;
require $setlib;
if ( defined $ENV{GATEWAY_INTERFACE} || defined $ENV{MOD_PERL} ) {
$Foswiki::cfg{Engine} = 'Foswiki::Engine::CGI';
use CGI::Carp qw(fatalsToBrowser);
require CGI::Carp;
CGI::Carp->import(qw(fatalsToBrowser));
$SIG{__DIE__} = \&CGI::Carp::confess;
}
else {
$Foswiki::cfg{Engine} = 'Foswiki::Engine::CLI';
require Carp;
$SIG{__DIE__} = \&Carp::confess;
}
my ( $volume, $binDir, $action ) = File::Spec->splitpath(__FILE__);
my $setlib = File::Spec->catpath( $volume, $binDir, 'setlib.cfg' );
@INC = ( '.', grep { $_ ne '.' } @INC ) unless $binDir;
require $setlib;
$action =~ s/\..*$//; # Remove eventual file extension
$ENV{FOSWIKI_ACTION} = $action;
}
View
@@ -6,20 +6,22 @@ use warnings;
use File::Spec;
BEGIN {
my ( $volume, $binDir, $action ) = File::Spec->splitpath(__FILE__);
my $setlib = File::Spec->catpath( $volume, $binDir, 'setlib.cfg' );
@INC = ( '.', grep { $_ ne '.' } @INC ) unless $binDir;
require $setlib;
if ( defined $ENV{GATEWAY_INTERFACE} || defined $ENV{MOD_PERL} ) {
$Foswiki::cfg{Engine} = 'Foswiki::Engine::CGI';
use CGI::Carp qw(fatalsToBrowser);
require CGI::Carp;
CGI::Carp->import(qw(fatalsToBrowser));
$SIG{__DIE__} = \&CGI::Carp::confess;
}
else {
$Foswiki::cfg{Engine} = 'Foswiki::Engine::CLI';
require Carp;
$SIG{__DIE__} = \&Carp::confess;
}
my ( $volume, $binDir, $action ) = File::Spec->splitpath(__FILE__);
my $setlib = File::Spec->catpath( $volume, $binDir, 'setlib.cfg' );
@INC = ( '.', grep { $_ ne '.' } @INC ) unless $binDir;
require $setlib;
$action =~ s/\..*$//; # Remove eventual file extension
$ENV{FOSWIKI_ACTION} = $action;
}
View
@@ -6,20 +6,22 @@ use warnings;
use File::Spec;
BEGIN {
my ( $volume, $binDir, $action ) = File::Spec->splitpath(__FILE__);
my $setlib = File::Spec->catpath( $volume, $binDir, 'setlib.cfg' );
@INC = ( '.', grep { $_ ne '.' } @INC ) unless $binDir;
require $setlib;
if ( defined $ENV{GATEWAY_INTERFACE} || defined $ENV{MOD_PERL} ) {
$Foswiki::cfg{Engine} = 'Foswiki::Engine::CGI';
use CGI::Carp qw(fatalsToBrowser);
require CGI::Carp;
CGI::Carp->import(qw(fatalsToBrowser));
$SIG{__DIE__} = \&CGI::Carp::confess;
}
else {
$Foswiki::cfg{Engine} = 'Foswiki::Engine::CLI';
require Carp;
$SIG{__DIE__} = \&Carp::confess;
}
my ( $volume, $binDir, $action ) = File::Spec->splitpath(__FILE__);
my $setlib = File::Spec->catpath( $volume, $binDir, 'setlib.cfg' );
@INC = ( '.', grep { $_ ne '.' } @INC ) unless $binDir;
require $setlib;
$action =~ s/\..*$//; # Remove eventual file extension
$ENV{FOSWIKI_ACTION} = $action;
}
View
@@ -6,20 +6,22 @@ use warnings;
use File::Spec;
BEGIN {
my ( $volume, $binDir, $action ) = File::Spec->splitpath(__FILE__);
my $setlib = File::Spec->catpath( $volume, $binDir, 'setlib.cfg' );
@INC = ( '.', grep { $_ ne '.' } @INC ) unless $binDir;
require $setlib;
if ( defined $ENV{GATEWAY_INTERFACE} || defined $ENV{MOD_PERL} ) {
$Foswiki::cfg{Engine} = 'Foswiki::Engine::CGI';
use CGI::Carp qw(fatalsToBrowser);
require CGI::Carp;
CGI::Carp->import(qw(fatalsToBrowser));
$SIG{__DIE__} = \&CGI::Carp::confess;
}
else {
$Foswiki::cfg{Engine} = 'Foswiki::Engine::CLI';
require Carp;
$SIG{__DIE__} = \&Carp::confess;
}
my ( $volume, $binDir, $action ) = File::Spec->splitpath(__FILE__);
my $setlib = File::Spec->catpath( $volume, $binDir, 'setlib.cfg' );
@INC = ( '.', grep { $_ ne '.' } @INC ) unless $binDir;
require $setlib;
$action =~ s/\..*$//; # Remove eventual file extension
$ENV{FOSWIKI_ACTION} = $action;
}
Oops, something went wrong.

0 comments on commit 8a9c3c4

Please sign in to comment.