[Rt-commit] rt branch, 3.8/perlcritic, updated. rt-3.8.10-29-gd1535d1

Alex Vandiver alexmv at bestpractical.com
Thu Jun 30 14:00:26 EDT 2011


The branch, 3.8/perlcritic has been updated
       via  d1535d179a7f9eaa56dc142ed6a5e08a31b21135 (commit)
       via  0cb79f92ed9f141e0b4d4a5c8b8e54e0fec378a0 (commit)
      from  78d74e4e75a09dced2f0e86a7c17cb9d886b34ed (commit)

Summary of changes:
 lib/RT/Graph/Tickets.pm  |    4 ++--
 lib/RT/Handle.pm         |    4 ++--
 lib/RT/Test.pm           |    2 +-
 lib/RT/Ticket_Overlay.pm |   15 +++++++++++++++
 sbin/rt-validator.in     |    2 +-
 5 files changed, 21 insertions(+), 6 deletions(-)

- Log -----------------------------------------------------------------
commit 0cb79f92ed9f141e0b4d4a5c8b8e54e0fec378a0
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Jun 30 13:00:56 2011 -0400

    Backport 65c3691 and d885f6b, but make Devel::GlobalDestruction optional
    
    This eliminates a great deal of the spurious backtraces when running tests.

diff --git a/lib/RT/Ticket_Overlay.pm b/lib/RT/Ticket_Overlay.pm
index d1a3df0..2104f86 100755
--- a/lib/RT/Ticket_Overlay.pm
+++ b/lib/RT/Ticket_Overlay.pm
@@ -3246,6 +3246,9 @@ sub _ApplyTransactionBatch {
     RT::Ruleset->CommitRules($rules);
 }
 
+my $have_global_destruction;
+$have_global_destruction = 1 if eval "require Devel::GlobalDestruction";
+
 sub DESTROY {
     my $self = shift;
 
@@ -3259,6 +3262,18 @@ sub DESTROY {
     # when an object's refcount is changed in its destructor.
     return if $self->{_Destroyed}++;
 
+    if ($have_global_destruction
+            and Devel::GlobalDestruction::in_global_destruction()) {
+        unless ($ENV{'HARNESS_ACTIVE'}) {
+            warn "Too late to safely run transaction-batch scrips!"
+                ." This is typically caused by using ticket objects"
+                ." at the top-level of a script which uses the RT API."
+                ." Be sure to explicitly undef such ticket objects,"
+                ." or put them inside of a lexical scope.";
+        }
+        return;
+    }
+
     my $batch = $self->TransactionBatch;
     return unless $batch && @$batch;
 

commit d1535d179a7f9eaa56dc142ed6a5e08a31b21135
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Jun 30 14:00:11 2011 -0400

    Remove some unnecessary subroutine prototypes

diff --git a/lib/RT/Graph/Tickets.pm b/lib/RT/Graph/Tickets.pm
index 2c4e5c2..bacb758 100644
--- a/lib/RT/Graph/Tickets.pm
+++ b/lib/RT/Graph/Tickets.pm
@@ -102,7 +102,7 @@ our @fill_colors = split ' ',<<EOT;
     #008080 #D8BFD8 #FF6347 #40E0D0 #EE82EE #F5DEB3 #FFFF00 #9ACD32
 EOT
 
-sub gv_escape($) {
+sub gv_escape {
     my $value = shift;
     $value =~ s{(?=")}{\\}g;
     return $value;
@@ -337,7 +337,7 @@ sub TicketLinks {
                     ? ($target->id => $base->id, dir => 'back')
                     : ($base->id => $target->id),
                 %{ $link_style{ $link->Type } || {} },
-                $desc? (label => gv_escape $desc): (),
+                $desc? (label => gv_escape($desc)): (),
             );
         }
     }
diff --git a/lib/RT/Handle.pm b/lib/RT/Handle.pm
index 38905de..cb8094d 100755
--- a/lib/RT/Handle.pm
+++ b/lib/RT/Handle.pm
@@ -547,7 +547,7 @@ sub GetVersionFile {
 
     my %version = map { $_ =~ /\.\w+-([-\w\.]+)$/; ($1||0) => $_ } @files;
     my $version;
-    foreach ( reverse sort cmp_version keys %version ) {
+    foreach ( reverse sort {cmp_version($a,$b)} keys %version ) {
         if ( cmp_version( $db_version, $_ ) >= 0 ) {
             $version = $_;
             last;
@@ -557,7 +557,7 @@ sub GetVersionFile {
     return defined $version? $version{ $version } : undef;
 }
 
-sub cmp_version($$) {
+sub cmp_version {
     my ($a, $b) = (@_);
     $b =~ s/HEAD$/9999/;
     my @a = split /[^0-9]+/, $a;
diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index 47e4e28..29c1fb4 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -181,7 +181,7 @@ sub import {
     __PACKAGE__->export_to_level($level);
 }
 
-sub is_empty($;$) {
+sub is_empty {
     my ($v, $d) = shift;
     local $Test::Builder::Level = $Test::Builder::Level + 1;
     return Test::More::ok(1, $d) unless defined $v;
diff --git a/sbin/rt-validator.in b/sbin/rt-validator.in
index 9f8ff29..08b4d07 100644
--- a/sbin/rt-validator.in
+++ b/sbin/rt-validator.in
@@ -214,7 +214,7 @@ my %describe_cb;
 );
 
 { my %cache = ();
-sub m2t($) {
+sub m2t {
     my $model = shift;
     return $cache{$model} if $cache{$model};
     my $class = "RT::$model";

-----------------------------------------------------------------------


More information about the Rt-commit mailing list