[Rt-commit] rtir branch, 2.6/perlcritic, updated. 2.6.0-35-ge74660a

Alex Vandiver alexmv at bestpractical.com
Thu Jul 21 17:32:55 EDT 2011


The branch, 2.6/perlcritic has been updated
       via  e74660acdabceccda72f0d962218781233d33a6a (commit)
      from  9e1d6680be562e7b2f7d288b1ef030b7022b1738 (commit)

Summary of changes:
 lib/RT/IR/Test/Web.pm |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

- Log -----------------------------------------------------------------
commit e74660acdabceccda72f0d962218781233d33a6a
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Jul 21 17:32:48 2011 -0400

    Avoid using $1 after a regex which may fail to match

diff --git a/lib/RT/IR/Test/Web.pm b/lib/RT/IR/Test/Web.pm
index 1dd8780..d59066e 100644
--- a/lib/RT/IR/Test/Web.pm
+++ b/lib/RT/IR/Test/Web.pm
@@ -131,8 +131,8 @@ sub create_incident_for_ir {
     
     Test::More::is ($self->status, 200, "Attempting to create new incident linked to child $ir_id");
 
-    Test::More::ok ($self->content =~ /.*Ticket (\d+) created in queue.*/g, "Incident created from child $ir_id.");
-    my $incident_id = $1;
+    my ($incident_id) = $self->content =~ /.*Ticket (\d+) created in queue.*/;
+    Test::More::ok ($incident_id, "Incident created from child $ir_id.");
 
 #    diag("incident ID is $incident_id");
     return $incident_id;
@@ -287,8 +287,8 @@ sub merge_ticket {
     
     $self->follow_link_ok({text => 'Merge', n => '1'}, "Followed 'Merge' link");
     
-    $self->content() =~ /Merge ([\w ]+) #$id:/i;
-    my $type = $1 || 'Ticket';
+    my ($type) = $self->content() =~ /Merge ([\w ]+) #$id:/i;
+    $type ||= 'Ticket';
     
 
     # Check that the desired incident occurs in the list of available incidents; if not, keep

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


More information about the Rt-commit mailing list