]> Dogcows Code - chaz/p5-CGI-Ex/commitdiff
CGI::Ex 2.06 v2.06
authorPaul Seamons <perl@seamons.com>
Fri, 21 Jul 2006 00:00:00 +0000 (00:00 +0000)
committerCharles McGarvey <chazmcgarvey@brokenzipper.com>
Fri, 9 May 2014 23:46:40 +0000 (17:46 -0600)
13 files changed:
Changes
META.yml
lib/CGI/Ex.pm
lib/CGI/Ex/App.pm
lib/CGI/Ex/Auth.pm
lib/CGI/Ex/Conf.pm
lib/CGI/Ex/Dump.pm
lib/CGI/Ex/Fill.pm
lib/CGI/Ex/JSONDump.pm
lib/CGI/Ex/Template.pm
lib/CGI/Ex/Template.pod
lib/CGI/Ex/Validate.pm
t/9_jsondump_00_base.t

diff --git a/Changes b/Changes
index 67f99ea866b8c27535ef22cf9c9207b0ffe4e301..de56ae76640d151adf416e8d19328d31039ea8f0 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,8 @@
+2.06   2006-07-21
+        * Allow for JSONDump to swap --> to --"+">
+        * Fix memory issue in App with closures
+        * Remove weak_copy routine from Template (memory issue)
+
 2.05   2006-07-19
         * Allow for CGI::Ex to be compatible with Mandrake and Fedora mod_perl 2, as well as debian mod_perl2
           and older mod_perl1.
index b294eaaf1bee2f03ebbfc190fe1dc1e0350a3b11..5adf0c71a7eb196e9be67ae0c7576de1791da597 100644 (file)
--- a/META.yml
+++ b/META.yml
@@ -1,7 +1,7 @@
 # http://module-build.sourceforge.net/META-spec.html
 #XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
 name:         CGI-Ex
-version:      2.05
+version:      2.06
 version_from: lib/CGI/Ex.pm
 installdirs:  site
 requires:
index aae9e5d91b5e7df5e03aeb3d1b38dfbfd6e5d83d..e163008cb4c3a04ccd9f15a962b85520d96a84b2 100644 (file)
@@ -24,7 +24,7 @@ use vars qw($VERSION
 use base qw(Exporter);
 
 BEGIN {
-    $VERSION               = '2.05';
+    $VERSION               = '2.06';
     $PREFERRED_CGI_MODULE  ||= 'CGI';
     @EXPORT = ();
     @EXPORT_OK = qw(get_form
index 4a62f920b390b9228abc345090b23c1429e0415b..34fdf11c9222cb40a27a8ed1666bf0b0a6944c5c 100644 (file)
@@ -10,9 +10,10 @@ use strict;
 use vars qw($VERSION);
 
 BEGIN {
-    $VERSION = '2.05';
+    $VERSION = '2.06';
 
     Time::HiRes->import('time') if eval {require Time::HiRes};
+    eval {require Scalar::Util};
 }
 
 sub croak {
@@ -767,7 +768,9 @@ sub swap_template {
     my ($self, $step, $file, $swap) = @_;
 
     my $args = $self->run_hook('template_args', $step);
-    $args->{'INCLUDE_PATH'} ||= sub { $self->base_dir_abs || die "Could not find base_dir_abs while looking for template INCLUDE_PATH on step \"$step\"" };
+    my $copy = $self;
+    eval {require Scalar::Util; Scalar::Util::weaken($copy)};
+    $args->{'INCLUDE_PATH'} ||= sub { $copy->base_dir_abs || die "Could not find base_dir_abs while looking for template INCLUDE_PATH on step \"$step\"" };
 
     require CGI::Ex::Template;
     my $t = CGI::Ex::Template->new($args);
@@ -951,14 +954,8 @@ sub hash_base {
 
     return $self->{'hash_base'} ||= do {
         ### create a weak copy of self to use in closures
-        my $copy;
-        if (eval {require Scalar::Util} && defined &Scalar::Util::weaken) {
-            $copy = $self;
-            Scalar::Util::weaken($copy);
-        } else {
-            $copy = bless {%$self}, ref($self); # hackish way to avoid circular refs on older perls (pre 5.8)
-        }
-
+        my $copy = $self;
+        eval {require Scalar::Util; Scalar::Util::weaken($copy)};
         my $hash = {
             script_name     => $ENV{'SCRIPT_NAME'} || $0,
             path_info       => $ENV{'PATH_INFO'}   || '',
index b8be4861bceb85d15c0a6a8298f96709d4cb7251..33bdffea2a413d5ae81341b6fe5ee5368256433a 100644 (file)
@@ -18,7 +18,7 @@ use MIME::Base64 qw(encode_base64 decode_base64);
 use Digest::MD5 qw(md5_hex);
 use CGI::Ex;
 
-$VERSION = '2.05';
+$VERSION = '2.06';
 
 ###----------------------------------------------------------------###
 
index 60b2d99fed9c488823608b790ee3783932867bd5..489c6b1fe7ed67b9931a8b2fc3bd34343beeab7b 100644 (file)
@@ -28,7 +28,7 @@ use vars qw($VERSION
             );
 @EXPORT_OK = qw(conf_read conf_write in_cache);
 
-$VERSION = '2.05';
+$VERSION = '2.06';
 
 $DEFAULT_EXT = 'conf';
 
index af5a00b771076ff78c5bd9af0e70ba70cf54f0c9..0331603e1c032080abde03c97080bad5b0446204 100644 (file)
@@ -17,7 +17,7 @@ use vars qw(@ISA @EXPORT @EXPORT_OK $VERSION
 use strict;
 use Exporter;
 
-$VERSION   = '2.05';
+$VERSION   = '2.06';
 @ISA       = qw(Exporter);
 @EXPORT    = qw(dex dex_warn dex_text dex_html ctrace dex_trace);
 @EXPORT_OK = qw(dex dex_warn dex_text dex_html ctrace dex_trace debug);
index 65cfa2975d003e1c85d253ae9a6dc509b5061048..2ae971ffc73a17b26a76fb28385aeed638687d93 100644 (file)
@@ -24,7 +24,7 @@ use vars qw($VERSION
 use base qw(Exporter);
 
 BEGIN {
-    $VERSION   = '2.05';
+    $VERSION   = '2.06';
     @EXPORT    = qw(form_fill);
     @EXPORT_OK = qw(fill form_fill html_escape get_tagval_by_key swap_tagval_by_key);
 };
index 69222bf85bdeb46ab150908394c75e65093d277e..92d08379e9537d7c4b83c78528c7391a19b8b87d 100644 (file)
@@ -17,7 +17,7 @@ use strict;
 use base qw(Exporter);
 
 BEGIN {
-    $VERSION  = '2.05';
+    $VERSION  = '2.06';
 
     @EXPORT = qw(JSONDump);
     @EXPORT_OK = @EXPORT;
@@ -117,7 +117,7 @@ sub js_escape {
     utf8::decode($str) if $self->{'utf8'} && &utf8::decode;
 
     ### escape <html> and </html> tags in the text
-    $str =~ s{(</? (?: htm | scrip | !-))}{$1$quote+$quote}gx;
+    $str =~ s{(</? (?: htm | scrip | !-) | --(?=>) )}{$1$quote+$quote}gx;
 
     ### add nice newlines (unless pretty is off)
     if ($self->{'str_nl'} && length($str) > 80) {
index 52d92a07054174edc0763cd70ce2c0ab247df88b..773000cb1a8cf7442d276d2f383bf6fd9a907245 100644 (file)
@@ -39,7 +39,7 @@ use vars qw($VERSION
             );
 
 BEGIN {
-    $VERSION = '2.05';
+    $VERSION = '2.06';
 
     $PACKAGE_EXCEPTION   = 'CGI::Ex::Template::Exception';
     $PACKAGE_ITERATOR    = 'CGI::Ex::Template::Iterator';
@@ -280,6 +280,8 @@ BEGIN {
 
     $WHILE_MAX    = 1000;
     $EXTRA_COMPILE_EXT = '.sto';
+
+    eval {require Scalar::Util};
 };
 
 ###----------------------------------------------------------------###
@@ -1936,7 +1938,8 @@ sub play_MACRO {
         $sub_tree = $sub_tree->[0]->[4];
     }
 
-    my $self_copy = $self->weak_copy;
+    my $self_copy = $self;
+    eval {require Scalar::Util; Scalar::Util::weaken($self_copy)};
 
     ### install a closure in the stash that will handle the macro
     $self->set_variable($name, sub {
@@ -2778,20 +2781,6 @@ sub list_plugins {
     };
 }
 
-### get a copy of self without circular refs for use in closures
-sub weak_copy {
-    my $self = shift;
-    my $self_copy;
-    if (eval { require Scalar::Util }
-        && defined &Scalar::Util::weaken) {
-        $self_copy = $self;
-        Scalar::Util::weaken($self_copy);
-    } else {
-        $self_copy = bless {%$self}, ref($self); # hackish way to avoid circular refs on old perls (pre 5.8)
-    }
-    return $self_copy;
-}
-
 sub debug_node {
     my ($self, $node) = @_;
     my $info = $self->node_info($node);
index 9d2c3c673b93b633b0553eccfeaac294ac80ba76..cbfde4bf42631b29f076f77dae9b55cd6d0ccc13 100644 (file)
@@ -2851,11 +2851,6 @@ by the pseudo context object and may disappear at some point.
 
 Methods by these names implement virtual methods that are more than one line.
 
-=item C<weak_copy>
-
-Used to create a weak reference to self to avoid circular references. (this
-is needed by macros)
-
 =back
 
 
index 77ebd2a4ea7c7f00160d0d3bde73fb84ab1cb6f3..55709d528f896c67100b18dd3513ee92e37a8ed6 100644 (file)
@@ -22,7 +22,7 @@ use vars qw($VERSION
             @UNSUPPORTED_BROWSERS
             );
 
-$VERSION = '2.05';
+$VERSION = '2.06';
 
 $DEFAULT_EXT   = 'val';
 $QR_EXTRA      = qr/^(\w+_error|as_(array|string|hash)_\w+|no_\w+)/;
index a124a4f60d1e3d5ec0a3a14f56f9cf037e7f52ca..29f6482f6ce98864f937aaf30e6ed33c38a06964 100644 (file)
@@ -7,7 +7,7 @@
 =cut
 
 use strict;
-use Test::More tests => 49;
+use Test::More tests => 52;
 
 use_ok('CGI::Ex::JSONDump');
 
@@ -89,6 +89,9 @@ test_dump('<script>', '"<scrip"+"t>"');
 test_dump('<script>', "'<scrip'+'t>'", {single_quote => 1});
 test_dump('<html>', '"<htm"+"l>"');
 test_dump('<!--', '"<!-"+"-"');
+test_dump('-->', '"--"+">"');
+test_dump('---', '"---"');
+test_dump('--', '"--"');
 test_dump('"', '"\\""');
 test_dump('a', "'a'", {single_quote => 1});
 test_dump('"', "'\"'", {single_quote => 1});
This page took 0.03234 seconds and 4 git commands to generate.