From: Peter Rabbitson Date: Fri, 24 Oct 2014 21:53:52 +0000 (+0200) Subject: Fix idiocy that snuck in bdbd2ae8a - I only want fatal undefs X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9f7d5590318a7f8db25a1a3854494edee9f25a57;p=dbsrgits%2FDBIx-Class-Historic.git Fix idiocy that snuck in bdbd2ae8a - I only want fatal undefs Not sure what I was thinking. In either case - remove the unsafe code, and annotate the remaining uses of FATAL => 'all' --- diff --git a/lib/DBIx/Class/CDBICompat/Pager.pm b/lib/DBIx/Class/CDBICompat/Pager.pm index 36fbce9..203b598 100644 --- a/lib/DBIx/Class/CDBICompat/Pager.pm +++ b/lib/DBIx/Class/CDBICompat/Pager.pm @@ -2,6 +2,10 @@ package # hide from PAUSE DBIx::Class::CDBICompat::Pager; use strict; + +# even though fatalization has been proven over and over to be a universally +# bad idea, this line has been part of the code from the beginning +# leaving the compat layer as-is, something may in fact depend on that use warnings FATAL => 'all'; *pager = \&page; diff --git a/lib/DBIx/Class/CDBICompat/Retrieve.pm b/lib/DBIx/Class/CDBICompat/Retrieve.pm index 34be5f3..87f5318 100644 --- a/lib/DBIx/Class/CDBICompat/Retrieve.pm +++ b/lib/DBIx/Class/CDBICompat/Retrieve.pm @@ -2,8 +2,11 @@ package # hide from PAUSE DBIx::Class::CDBICompat::Retrieve; use strict; -use warnings FATAL => 'all'; +# even though fatalization has been proven over and over to be a universally +# bad idea, this line has been part of the code from the beginning +# leaving the compat layer as-is, something may in fact depend on that +use warnings FATAL => 'all'; sub retrieve { my $self = shift; diff --git a/lib/DBIx/Class/ResultSource/RowParser/Util.pm b/lib/DBIx/Class/ResultSource/RowParser/Util.pm index 3cf4aee..732bb50 100644 --- a/lib/DBIx/Class/ResultSource/RowParser/Util.pm +++ b/lib/DBIx/Class/ResultSource/RowParser/Util.pm @@ -18,6 +18,10 @@ our @EXPORT_OK = qw( # working title - we are hoping to extract this eventually... our $null_branch_class = 'DBIx::ResultParser::RelatedNullBranch'; +sub __wrap_in_strictured_scope { + " { use strict; use warnings; use warnings FATAL => 'uninitialized';\n$_[0]\n }" +} + sub assemble_simple_parser { #my ($args) = @_; @@ -35,7 +39,7 @@ sub assemble_simple_parser { # change the quoted placeholders to unquoted alias-references $parser_src =~ s/ \' \xFF__VALPOS__(\d+)__\xFF \' /"\$_->[$1]"/gex; - $parser_src = " { use strict; use warnings FATAL => 'all';\n$parser_src\n }"; + __wrap_in_strictured_scope($parser_src); } # the simple non-collapsing nested structure recursor @@ -218,7 +222,7 @@ EOS $no_rowid_container ? "\$cur_row_data->[$1]" : "\$cur_row_ids{$1}" /gex; - $parser_src = " { use strict; use warnings FATAL => 'all';\n$parser_src\n }"; + __wrap_in_strictured_scope($parser_src); } diff --git a/t/resultset/rowparser_internals.t b/t/resultset/rowparser_internals.t index 2377185..d1b4f07 100644 --- a/t/resultset/rowparser_internals.t +++ b/t/resultset/rowparser_internals.t @@ -765,7 +765,7 @@ sub is_same_src { SKIP: { $expect =~ s/__NBC__/perlstring($DBIx::Class::ResultSource::RowParser::Util::null_branch_class)/ge; - $expect = " { use strict; use warnings FATAL => 'all';\n$expect\n }"; + $expect = " { use strict; use warnings FATAL => 'uninitialized';\n$expect\n }"; my @normalized = map { my $cref = eval "sub { $_ }" or do {