Skip to content

Commit

Permalink
resolve leejo/cgi-fast#11 - restore CGI::Fast imports
Browse files Browse the repository at this point in the history
CGI::Fast used to be a drop in replacement for CGI up until i broke
this behaviour by adding an explicit import sub in CGI::Fast which
means the caller stack needs to be shifted down by one to make sure
the functions are imported into the correct namespace[1]

[1] i'm not so sure this is the "right thing" to do, but from a
back compat point of view it needs to remain
  • Loading branch information
leejo committed Mar 8, 2015
1 parent 8043bb1 commit 5f47d57
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 9 deletions.
6 changes: 5 additions & 1 deletion Changes
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
4.13_03 2015-03-01
4.13_04 2015-03-08

[ RELEASE NOTES ]
- This release removes the AUTOLOAD and compile optimisations from CGI.pm
Expand Down Expand Up @@ -47,6 +47,10 @@

- Fix warning for lack of HTTP_USER_AGENT in CGI::Carp (GH #168)

- Fix imports when called from CGI::Fast, restores the import of CGI functions
into the callers namespace for users of CGI::Fast (GH leejo/cgi-fast#11 and
GH leejo/cgi-fast#12)

[ INTERNALS ]
- Remove dependency on constant - internal DEBUG, XHTML_DTD and EBCDIC
constants changes to $_DEBUG, $_XHTML_DTD, and $_EBCDIC
Expand Down
11 changes: 10 additions & 1 deletion lib/CGI.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ require 5.008001;
use if $] >= 5.019, 'deprecate';
use Carp 'croak';

$CGI::VERSION='4.13_03';
$CGI::VERSION='4.13_04';

use CGI::Util qw(rearrange rearrange_header make_attributes unescape escape expires ebcdic2ascii ascii2ebcdic);

Expand Down Expand Up @@ -264,6 +264,15 @@ sub import {
$self->_setup_symbols(@_);
my ($callpack, $callfile, $callline) = caller;

if ( $callpack eq 'CGI::Fast' ) {
# fixes GH #11 (and GH #12 in CGI::Fast since
# sub import was added to CGI::Fast in 9537f90
# so we need to move up a level to export the
# routines to the namespace of whatever is using
# CGI::Fast
($callpack, $callfile, $callline) = caller(1);
}

# To allow overriding, search through the packages
# Till we find one in which the correct subroutine is defined.
my @packages = ($self,@{"$self\:\:ISA"});
Expand Down
2 changes: 1 addition & 1 deletion lib/CGI/Carp.pm
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ use File::Spec;

$main::SIG{__WARN__}=\&CGI::Carp::warn;

$CGI::Carp::VERSION = '4.13_03';
$CGI::Carp::VERSION = '4.13_04';
$CGI::Carp::CUSTOM_MSG = undef;
$CGI::Carp::DIE_HANDLER = undef;
$CGI::Carp::TO_BROWSER = 1;
Expand Down
2 changes: 1 addition & 1 deletion lib/CGI/Cookie.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use warnings;

use if $] >= 5.019, 'deprecate';

our $VERSION='4.13_03';
our $VERSION='4.13_04';

use CGI::Util qw(rearrange unescape escape);
use overload '""' => \&as_string, 'cmp' => \&compare, 'fallback' => 1;
Expand Down
2 changes: 1 addition & 1 deletion lib/CGI/File/Temp.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# you use it directly and your code breaks horribly.
package CGI::File::Temp;

$CGI::File::Temp::VERSION = '4.13_03';
$CGI::File::Temp::VERSION = '4.13_04';

use parent File::Temp;
use parent Fh;
Expand Down
2 changes: 1 addition & 1 deletion lib/CGI/Pretty.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use strict;
use if $] >= 5.019, 'deprecate';
use CGI ();

$CGI::Pretty::VERSION = '4.13_03';
$CGI::Pretty::VERSION = '4.13_04';
$CGI::DefaultClass = __PACKAGE__;
$CGI::Pretty::AutoloadClass = 'CGI';
@CGI::Pretty::ISA = qw( CGI );
Expand Down
2 changes: 1 addition & 1 deletion lib/CGI/Push.pm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package CGI::Push;
use if $] >= 5.019, 'deprecate';

$CGI::Push::VERSION='4.13_03';
$CGI::Push::VERSION='4.13_04';
use CGI;
use CGI::Util 'rearrange';
@ISA = ('CGI');
Expand Down
2 changes: 1 addition & 1 deletion lib/CGI/Util.pm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use if $] >= 5.019, 'deprecate';
our @EXPORT_OK = qw(rearrange rearrange_header make_attributes unescape escape
expires ebcdic2ascii ascii2ebcdic);

our $VERSION = '4.13_03';
our $VERSION = '4.13_04';

our $_EBCDIC = "\t" ne "\011";

Expand Down
2 changes: 1 addition & 1 deletion lib/Fh.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
# that the filehandle object is a Fh
package Fh;

$Fh::VERSION = '4.13_03';
$Fh::VERSION = '4.13_04';

1;

0 comments on commit 5f47d57

Please sign in to comment.