From d0287461de3f9b5c49ce02b22957022bdc5e87d8 Mon Sep 17 00:00:00 2001 From: Paul Seamons Date: Tue, 30 Jan 2007 00:00:00 +0000 Subject: [PATCH] CGI::Ex 2.07 --- Changes | 11 +++++ META.yml | 4 +- lib/CGI/Ex.pm | 6 +-- lib/CGI/Ex/App.pm | 27 ++++++++++- lib/CGI/Ex/Auth.pm | 4 +- lib/CGI/Ex/Conf.pm | 9 ++-- lib/CGI/Ex/Die.pm | 6 ++- lib/CGI/Ex/Dump.pm | 4 +- lib/CGI/Ex/Fill.pm | 10 ++-- lib/CGI/Ex/JSONDump.pm | 26 +++++++---- lib/CGI/Ex/Template.pm | 71 +++++++++++++++++------------ lib/CGI/Ex/Template.pod | 21 +++++---- lib/CGI/Ex/Validate.pm | 16 ++++++- lib/CGI/Ex/validate.js | 6 ++- lib/CGI/Ex/yaml_load.js | 4 +- samples/benchmark/bench_template.pl | 5 +- t/7_template_00_base.t | 7 ++- 17 files changed, 157 insertions(+), 80 deletions(-) diff --git a/Changes b/Changes index de56ae7..194f114 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,14 @@ +2.07 2007-01-30 + * Add clear_app method which flushes items pertaining to navigation. + * Allow for CGI::Ex::Template PLUGIN_BASE to be a scalar OR an arrayref. + * Add sort keys to DUMP directive + * Add trim_control_chars as a validate directive + * Allow for . in the QR_PRIVATE of Template + * Add dump_parse_expr to CGI::Ex::Template + * Fix JSONDump to handle more number cases + * Fix JSONDump to output more IE friendly JS + * Allow fill to work only with form elements with attributes + 2.06 2006-07-21 * Allow for JSONDump to swap --> to --"+"> * Fix memory issue in App with closures diff --git a/META.yml b/META.yml index 5adf0c7..05522c4 100644 --- a/META.yml +++ b/META.yml @@ -1,10 +1,10 @@ # 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.06 +version: 2.07 version_from: lib/CGI/Ex.pm installdirs: site requires: distribution_type: module -generated_by: ExtUtils::MakeMaker version 6.17 +generated_by: ExtUtils::MakeMaker version 6.30_01 diff --git a/lib/CGI/Ex.pm b/lib/CGI/Ex.pm index e163008..db9cda6 100644 --- a/lib/CGI/Ex.pm +++ b/lib/CGI/Ex.pm @@ -7,7 +7,7 @@ CGI::Ex - CGI utility suite - makes powerful application writing fun and easy =cut ###----------------------------------------------------------------### -# Copyright 2006 - Paul Seamons # +# Copyright 2007 - Paul Seamons # # Distributed under the Perl Artistic License without warranty # ###----------------------------------------------------------------### @@ -24,7 +24,7 @@ use vars qw($VERSION use base qw(Exporter); BEGIN { - $VERSION = '2.06'; + $VERSION = '2.07'; $PREFERRED_CGI_MODULE ||= 'CGI'; @EXPORT = (); @EXPORT_OK = qw(get_form @@ -1045,5 +1045,3 @@ Paul Seamons This module may be distributed under the same terms as Perl itself. =cut - -1; diff --git a/lib/CGI/Ex/App.pm b/lib/CGI/Ex/App.pm index 34fdf11..739c82f 100644 --- a/lib/CGI/Ex/App.pm +++ b/lib/CGI/Ex/App.pm @@ -2,7 +2,7 @@ package CGI::Ex::App; ###----------------------------------------------------------------### # See the perldoc in CGI/Ex/App.pod -# Copyright 2006 - Paul Seamons # +# Copyright 2007 - Paul Seamons # # Distributed under the Perl Artistic License without warranty # ###----------------------------------------------------------------### @@ -10,7 +10,7 @@ use strict; use vars qw($VERSION); BEGIN { - $VERSION = '2.06'; + $VERSION = '2.07'; Time::HiRes->import('time') if eval {require Time::HiRes}; eval {require Scalar::Util}; @@ -674,6 +674,29 @@ sub stash { return $self->{'stash'} ||= {}; } +sub clear_app { + my $self = shift; + + delete @{ $self }{qw( + cgix + vob + form + cookies + stash + path + path_i + history + __morph_lineage_start_index + __morph_lineage + hash_errors + hash_fill + hash_swap + hash_common + )}; + + return $self; +} + ###----------------------------------------------------------------### ### default hook implementations diff --git a/lib/CGI/Ex/Auth.pm b/lib/CGI/Ex/Auth.pm index 33bdffe..82c3964 100644 --- a/lib/CGI/Ex/Auth.pm +++ b/lib/CGI/Ex/Auth.pm @@ -7,7 +7,7 @@ CGI::Ex::Auth - Handle logins nicely. =cut ###----------------------------------------------------------------### -# Copyright 2006 - Paul Seamons # +# Copyright 2007 - Paul Seamons # # Distributed under the Perl Artistic License without warranty # ###----------------------------------------------------------------### @@ -18,7 +18,7 @@ use MIME::Base64 qw(encode_base64 decode_base64); use Digest::MD5 qw(md5_hex); use CGI::Ex; -$VERSION = '2.06'; +$VERSION = '2.07'; ###----------------------------------------------------------------### diff --git a/lib/CGI/Ex/Conf.pm b/lib/CGI/Ex/Conf.pm index 489c6b1..8b65606 100644 --- a/lib/CGI/Ex/Conf.pm +++ b/lib/CGI/Ex/Conf.pm @@ -7,7 +7,7 @@ CGI::Ex::Conf - Conf Reader/Writer for many different data format types =cut ###----------------------------------------------------------------### -# Copyright 2006 - Paul Seamons # +# Copyright 2007 - Paul Seamons # # Distributed under the Perl Artistic License without warranty # ###----------------------------------------------------------------### @@ -25,10 +25,11 @@ use vars qw($VERSION %CACHE $HTML_KEY @EXPORT_OK + $NO_WARN_ON_FAIL ); @EXPORT_OK = qw(conf_read conf_write in_cache); -$VERSION = '2.06'; +$VERSION = '2.07'; $DEFAULT_EXT = 'conf'; @@ -134,7 +135,7 @@ sub conf_read { ### don't die if the file is not found - do die otherwise if (! -e $file) { eval { die "Conf file $file not found" }; - warn "Conf file $file not found" if ! $args->{'no_warn_on_fail'}; + warn "Conf file $file not found" if ! $args->{'no_warn_on_fail'} && ! $NO_WARN_ON_FAIL; return; } @@ -803,7 +804,7 @@ conf_read and conf_write method calls. =head1 FUNCTIONS -=over4 +=over 4 =item conf_read diff --git a/lib/CGI/Ex/Die.pm b/lib/CGI/Ex/Die.pm index d9cfdb1..14e2271 100644 --- a/lib/CGI/Ex/Die.pm +++ b/lib/CGI/Ex/Die.pm @@ -7,12 +7,13 @@ CGI::Ex::Die - A CGI::Carp::FatalsToBrowser type utility. =cut ###----------------------------------------------------------------### -# Copyright 2006 - Paul Seamons # +# Copyright 2007 - Paul Seamons # # Distributed under the Perl Artistic License without warranty # ###----------------------------------------------------------------### use strict; -use vars qw($no_recurse +use vars qw($VERSION + $no_recurse $EXTENDED_ERRORS $SHOW_TRACE $IGNORE_EVAL $ERROR_TEMPLATE $LOG_HANDLER $FINAL_HANDLER @@ -22,6 +23,7 @@ use CGI::Ex; use CGI::Ex::Dump qw(debug ctrace dex_html); BEGIN { + $VERSION = '2.07'; $SHOW_TRACE = 0 if ! defined $SHOW_TRACE; $IGNORE_EVAL = 0 if ! defined $IGNORE_EVAL; $EXTENDED_ERRORS = 1 if ! defined $EXTENDED_ERRORS; diff --git a/lib/CGI/Ex/Dump.pm b/lib/CGI/Ex/Dump.pm index 0331603..06b8063 100644 --- a/lib/CGI/Ex/Dump.pm +++ b/lib/CGI/Ex/Dump.pm @@ -7,7 +7,7 @@ CGI::Ex::Dump - A debug utility =cut ###----------------------------------------------------------------### -# Copyright 2006 - Paul Seamons # +# Copyright 2007 - Paul Seamons # # Distributed under the Perl Artistic License without warranty # ###----------------------------------------------------------------### @@ -17,7 +17,7 @@ use vars qw(@ISA @EXPORT @EXPORT_OK $VERSION use strict; use Exporter; -$VERSION = '2.06'; +$VERSION = '2.07'; @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); diff --git a/lib/CGI/Ex/Fill.pm b/lib/CGI/Ex/Fill.pm index 2ae971f..25e13be 100644 --- a/lib/CGI/Ex/Fill.pm +++ b/lib/CGI/Ex/Fill.pm @@ -7,7 +7,7 @@ CGI::Ex::Fill - Fast but compliant regex based form filler =cut ###----------------------------------------------------------------### -# Copyright 2006 - Paul Seamons # +# Copyright 2007 - Paul Seamons # # Distributed under the Perl Artistic License without warranty # ###----------------------------------------------------------------### @@ -24,7 +24,7 @@ use vars qw($VERSION use base qw(Exporter); BEGIN { - $VERSION = '2.06'; + $VERSION = '2.07'; @EXPORT = qw(form_fill); @EXPORT_OK = qw(fill form_fill html_escape get_tagval_by_key swap_tagval_by_key); }; @@ -185,7 +185,7 @@ sub fill { ### First pass ### swap form elements if they have a name $$ref =~ s{ - (] )* >) # nested html ok + (] )+ >) # nested html ok }{ ### get the type and name - intentionally exlude names with nested "' my $tag = $1; @@ -249,7 +249,7 @@ sub fill { my $opts = substr($$ref, $start[$i], $close[$i] - $start[$i]); $opts =~ s{ (