[Rt-commit] rt branch, 4.2/perlcritic, created. rt-4.2.10-284-gb631084

Alex Vandiver alexmv at bestpractical.com
Sat Apr 11 22:05:03 EDT 2015


The branch, 4.2/perlcritic has been created
        at  b6310843f68af632eaef3f0c29c5134acabd938b (commit)

- Log -----------------------------------------------------------------
commit ea77270730946c2c99c3c5c721c0355ffb4ec5df
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jun 28 15:43:38 2011 -0400

    Replace the deprecated UNIVERSAL::can with $obj->can in various forms

diff --git a/lib/RT/Attribute.pm b/lib/RT/Attribute.pm
index 8ee95d2..a5acbd7 100644
--- a/lib/RT/Attribute.pm
+++ b/lib/RT/Attribute.pm
@@ -147,7 +147,7 @@ sub Create {
                 Object => undef,
                 @_);
 
-    if ($args{Object} and UNIVERSAL::can($args{Object}, 'Id')) {
+    if (Scalar::Util::blessed($args{Object}) and $args{Object}->can('Id')) {
         $args{ObjectType} = $args{Object}->isa("RT::CurrentUser") ? "RT::User" : ref($args{Object});
         $args{ObjectId} = $args{Object}->Id;
     } else {
diff --git a/lib/RT/CurrentUser.pm b/lib/RT/CurrentUser.pm
index a4b5dc0..b8079b8 100644
--- a/lib/RT/CurrentUser.pm
+++ b/lib/RT/CurrentUser.pm
@@ -211,7 +211,7 @@ specification. but currently doesn't
 sub LanguageHandle {
     my $self = shift;
     if (   !defined $self->{'LangHandle'}
-        || !UNIVERSAL::can( $self->{'LangHandle'}, 'maketext' )
+        || !$self->{'LangHandle'}->can( 'maketext' )
         || @_ )
     {
         if ( my $lang = $self->Lang ) {
diff --git a/lib/RT/CustomField.pm b/lib/RT/CustomField.pm
index 0603927..d84ba01 100644
--- a/lib/RT/CustomField.pm
+++ b/lib/RT/CustomField.pm
@@ -1334,11 +1334,11 @@ sub CollectionClassFromLookupType {
     return undef unless $record_class;
 
     my $collection_class;
-    if ( UNIVERSAL::can($record_class.'Collection', 'new') ) {
+    if ( ($record_class.'Collection')->can('new') ) {
         $collection_class = $record_class.'Collection';
-    } elsif ( UNIVERSAL::can($record_class.'es', 'new') ) {
+    } elsif ( ($record_class.'es')->can('new') ) {
         $collection_class = $record_class.'es';
-    } elsif ( UNIVERSAL::can($record_class.'s', 'new') ) {
+    } elsif ( ($record_class.'s')->can('new') ) {
         $collection_class = $record_class.'s';
     } else {
         $RT::Logger->error("Can not find a collection class for record class '$record_class'");
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 126709f..1a76a3e 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -1921,7 +1921,7 @@ through
 sub loc {
 
     if ( $session{'CurrentUser'}
-        && UNIVERSAL::can( $session{'CurrentUser'}, 'loc' ) )
+        && $session{'CurrentUser'}->can( 'loc' ) )
     {
         return ( $session{'CurrentUser'}->loc(@_) );
     } elsif (
@@ -1954,7 +1954,7 @@ sub loc_fuzzy {
     my $msg = shift;
 
     if ( $session{'CurrentUser'}
-        && UNIVERSAL::can( $session{'CurrentUser'}, 'loc' ) )
+        && $session{'CurrentUser'}->can( 'loc' ) )
     {
         return ( $session{'CurrentUser'}->loc_fuzzy($msg) );
     } else {
diff --git a/lib/RT/Interface/Web/Handler.pm b/lib/RT/Interface/Web/Handler.pm
index 8667f01..0618bad 100644
--- a/lib/RT/Interface/Web/Handler.pm
+++ b/lib/RT/Interface/Web/Handler.pm
@@ -175,8 +175,7 @@ sub CleanupRequest {
     RT::Principal->InvalidateACLCache();
     DBIx::SearchBuilder::Record::Cachable->FlushCache
       if ( RT->Config->Get('WebFlushDbCacheEveryRequest')
-        and UNIVERSAL::can(
-            'DBIx::SearchBuilder::Record::Cachable' => 'FlushCache' ) );
+        and DBIx::SearchBuilder::Record::Cachable->can( 'FlushCache' ) );
 
     # cleanup global squelching of the mails
     require RT::Action::SendEmail;
diff --git a/lib/RT/Link.pm b/lib/RT/Link.pm
index f82cf51..fc8a033 100644
--- a/lib/RT/Link.pm
+++ b/lib/RT/Link.pm
@@ -172,7 +172,7 @@ sub Create {
 
     if ( $base->IsLocal ) {
         my $object = $base->Object;
-        unless (UNIVERSAL::can($object, 'Id')) {
+        unless (Scalar::Util::blessed($object) and $object->can('Id')) {
             return (undef, $self->loc("[_1] appears to be a local object, but can't be found in the database", $args{'Base'}));
         
         }
@@ -180,7 +180,7 @@ sub Create {
     }
     if ( $target->IsLocal ) {
         my $object = $target->Object;
-        unless (UNIVERSAL::can($object, 'Id')) {
+        unless (Scalar::Util::blessed($object) and $object->can('Id')) {
             return (undef, $self->loc("[_1] appears to be a local object, but can't be found in the database", $args{'Target'}));
         
         }
diff --git a/lib/RT/Record.pm b/lib/RT/Record.pm
index 7cf116a..5abe0bc 100644
--- a/lib/RT/Record.pm
+++ b/lib/RT/Record.pm
@@ -693,9 +693,9 @@ sub _BuildTableAttributes {
     my $class = ref($self) || $self;
 
     my $attributes;
-    if ( UNIVERSAL::can( $self, '_CoreAccessible' ) ) {
+    if ( $self->can( '_CoreAccessible' ) ) {
        $attributes = $self->_CoreAccessible();
-    } elsif ( UNIVERSAL::can( $self, '_ClassAccessible' ) ) {
+    } elsif ( $self->can( '_ClassAccessible' ) ) {
        $attributes = $self->_ClassAccessible();
 
     }
@@ -706,7 +706,7 @@ sub _BuildTableAttributes {
         }
     }
     foreach my $method ( qw(_OverlayAccessible _VendorAccessible _LocalAccessible) ) {
-        next unless UNIVERSAL::can( $self, $method );
+        next unless $self->can( $method );
         $attributes = $self->$method();
 
         foreach my $column ( keys %$attributes ) {
@@ -1013,7 +1013,7 @@ sub _UpdateAttributes {
 
         # Default to $id, but use name if we can get it.
         my $label = $self->id;
-        $label = $self->Name if (UNIVERSAL::can($self,'Name'));
+        $label = $self->Name if $self->can('Name');
         # this requires model names to be loc'ed.
 
 =for loc
diff --git a/lib/RT/Shredder.pm b/lib/RT/Shredder.pm
index af675bd..9614f0b 100644
--- a/lib/RT/Shredder.pm
+++ b/lib/RT/Shredder.pm
@@ -449,7 +449,7 @@ sub _ParseRefStrArgs
         Carp::croak( "both String and Object args passed" );
     }
     return $args{'String'} if $args{'String'};
-    return $args{'Object'}->UID if UNIVERSAL::can($args{'Object'}, 'UID' );
+    return $args{'Object'}->UID if Scalar::Util::blessed($args{'Object'}) and $args{'Object'}->can('UID');
     return '';
 }
 
diff --git a/lib/RT/Transaction.pm b/lib/RT/Transaction.pm
index d909171..cb51b34 100644
--- a/lib/RT/Transaction.pm
+++ b/lib/RT/Transaction.pm
@@ -1525,7 +1525,7 @@ sub LoadCustomFieldByIdentifier {
         if ref $field or $field =~ /^\d+$/;
 
     return $self->SUPER::LoadCustomFieldByIdentifier($field)
-        unless UNIVERSAL::can( $self->Object, 'QueueObj' );
+        unless Scalar::Util::blessed($self->Object) and $self->Object->can('QueueObj');
 
     my $CFs = RT::CustomFields->new( $self->CurrentUser );
     $CFs->SetContextObject( $self->Object );
diff --git a/lib/RT/Users.pm b/lib/RT/Users.pm
index a8e81eb..39cebf4 100644
--- a/lib/RT/Users.pm
+++ b/lib/RT/Users.pm
@@ -458,7 +458,6 @@ sub _RoleClauses {
     my @groups_clauses;
     foreach my $obj ( @objects ) {
         my $type = ref($obj)? ref($obj): $obj;
-
         my $role_clause = $RT::Handle->__MakeClauseCaseInsensitive("$groups.Domain", '=', "'$type-Role'");
 
         if ( my $id = eval { $obj->id } ) {
@@ -510,7 +509,7 @@ sub WhoHaveGroupRight
         foreach my $obj ( @objects ) {
             my $type = ref($obj)? ref($obj): $obj;
             my $id = 0;
-            $id = $obj->id if ref($obj) && UNIVERSAL::can($obj, 'id') && $obj->id;
+            $id = $obj->id if Scalar::Util::blessed($obj) && $obj->can('id') && $obj->id;
             next if $seen{"$type-$id"}++;
 
             my $object_clause = "$acl.ObjectType = '$type'";
diff --git a/share/html/Articles/Article/Elements/EditLinks b/share/html/Articles/Article/Elements/EditLinks
index 325e580..7616c70 100644
--- a/share/html/Articles/Article/Elements/EditLinks
+++ b/share/html/Articles/Article/Elements/EditLinks
@@ -66,9 +66,9 @@
 <input type="checkbox" name="DeleteLink--<%$link->Type%>-<%$link->Target%>" />
 %     if ($link->TargetURI->IsLocal) {
 <a href="<%$member->AsHREF%>"><% loc($member->Object->RecordType) %> <%$member->Object->Id%></a>: 
-%       if (UNIVERSAL::isa($member->Object, "RT::Article") or UNIVERSAL::can($member->Object, 'Name')) {
+%       if ( eval { $member->Object->Name; 1 } ) {
 <%$member->Object->Name%>
-%       } elsif (UNIVERSAL::isa($member->Object, "RT::Ticket") or UNIVERSAL::can($member->Object, 'Subject')) {
+%       } elsif ( eval { $member->Object->Subject; 1 } ) {
 <%$member->Object->Subject%>
 %       }
 </a>
@@ -93,9 +93,9 @@
 <input type="checkbox" name="DeleteLink-<%$link->Base%>-<%$link->Type%>-" />
 %     if ($link->BaseURI->IsLocal) {
 <a href="<%$member->AsHREF%>"><% loc($member->Object->RecordType) %> <%$member->Object->Id%>: 
-%       if (UNIVERSAL::isa($member->Object, "RT::Article") or UNIVERSAL::can($member->Object, 'Name')) {
+%       if ( eval { $member->Object->Name; 1 } ) {
 <%$member->Object->Name%>
-%       } elsif (UNIVERSAL::isa($member->Object, "RT::Ticket") or UNIVERSAL::can($member->Object, 'Subject')) {
+%       } elsif ( eval { $member->Object->Subject; 1 } ) {
 <%$member->Object->Subject%>
 %       }
 </a>
diff --git a/share/html/Articles/Article/Elements/ShowLinks b/share/html/Articles/Article/Elements/ShowLinks
index 80b00e3..4304c82 100644
--- a/share/html/Articles/Article/Elements/ShowLinks
+++ b/share/html/Articles/Article/Elements/ShowLinks
@@ -54,9 +54,9 @@
 <li>
 % if ($link->TargetURI->IsLocal) {
 <a href="<%$member->AsHREF%>"><% loc($member->Object->RecordType) %> <%$member->Object->Id%>: 
-% if (UNIVERSAL::isa($member->Object, "RT::Article") or UNIVERSAL::can($member->Object, 'Name')) {
+% if ( eval { $member->Object->Name; 1 } ) {
 <%$member->Object->Name%>
-% } elsif (UNIVERSAL::isa($member->Object, "RT::Ticket") or UNIVERSAL::can($member->Object, 'Subject')) {
+% } elsif ( eval { $member->Object->Subject; 1 } ) {
 <%$member->Object->Subject%>
 % }
 </a>
@@ -75,9 +75,9 @@
 <li>
 % if ($member->IsLocal) {
 <a href="<%$member->AsHREF%>"><% loc($member->Object->RecordType) %> <%$member->Object->Id%>: 
-% if (UNIVERSAL::isa($member->Object, "RT::Article") or UNIVERSAL::can($member->Object, 'Name')) {
+% if ( eval { $member->Object->Name; 1 } ) {
 <%$member->Object->Name%>
-% } elsif (UNIVERSAL::isa($member->Object, "RT::Ticket") or UNIVERSAL::can($member->Object, 'Subject')) {
+% } elsif ( eval { $member->Object->Subject; 1 } ) {
 <%$member->Object->Subject%>
 % }
 </a>
diff --git a/t/api/i18n.t b/t/api/i18n.t
index 831532b..e95a217 100644
--- a/t/api/i18n.t
+++ b/t/api/i18n.t
@@ -16,12 +16,12 @@ ok(RT::I18N->Init);
 {
 
 ok(my $chinese = RT::I18N->get_handle('zh_tw'));
-ok(UNIVERSAL::can($chinese, 'maketext'));
+can_ok($chinese, 'maketext');
 like($chinese->maketext('__Content-Type') , qr/utf-8/i, "Found the utf-8 charset for traditional chinese in the string ".$chinese->maketext('__Content-Type'));
 is($chinese->encoding , 'utf-8', "The encoding is 'utf-8' -".$chinese->encoding);
 
 ok(my $en = RT::I18N->get_handle('en'));
-ok(UNIVERSAL::can($en, 'maketext'));
+can_ok($en, 'maketext');
 is($en->encoding , 'utf-8', "The encoding ".$en->encoding." is 'utf-8'");
 
 

commit 9df264fde9e72fe9e06516a5e8ff763600bc1ae5
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jun 28 15:52:31 2011 -0400

    Replace the UNIVERSAL::isa calls which degenerate to ref() with just that

diff --git a/lib/RT/Article.pm b/lib/RT/Article.pm
index b53c3cc..b357a3b 100644
--- a/lib/RT/Article.pm
+++ b/lib/RT/Article.pm
@@ -136,7 +136,7 @@ sub Create {
         foreach my $value (@vals) {
 
             my ( $cfid, $cfmsg ) = $self->_AddCustomFieldValue(
-                (UNIVERSAL::isa( $value => 'HASH' )
+                (ref( $value ) eq 'HASH'
                     ? %$value
                     : (Value => $value)
                 ),
diff --git a/lib/RT/Interface/Email.pm b/lib/RT/Interface/Email.pm
index ef618e6..426bd69 100644
--- a/lib/RT/Interface/Email.pm
+++ b/lib/RT/Interface/Email.pm
@@ -427,7 +427,7 @@ sub SendEmail {
     my $mail_command = RT->Config->Get('MailCommand');
 
     # if it is a sub routine, we just return it;
-    return $mail_command->($args{'Entity'}) if UNIVERSAL::isa( $mail_command, 'CODE' );
+    return $mail_command->($args{'Entity'}) if ref( $mail_command ) eq 'CODE';
 
     if ( $mail_command eq 'sendmailpipe' ) {
         my $path = RT->Config->Get('SendmailPath');
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 1a76a3e..49fb1c9 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -2561,7 +2561,7 @@ sub ProcessACLChanges {
         my ( $method, $principal_id, $object_type, $object_id ) = ( $1, $2, $3, $4 );
 
         my @rights;
-        if ( UNIVERSAL::isa( $ARGSref->{$arg}, 'ARRAY' ) ) {
+        if ( ref($ARGSref->{$arg}) eq 'ARRAY' ) {
             @rights = @{ $ARGSref->{$arg} };
         } else {
             @rights = $ARGSref->{$arg};
@@ -3740,12 +3740,12 @@ sub ProcessColumnMapValue {
     my %args = ( Arguments => [], Escape => 1, @_ );
 
     if ( ref $value ) {
-        if ( UNIVERSAL::isa( $value, 'CODE' ) ) {
+        if ( ref($value) eq 'CODE' ) {
             my @tmp = $value->( @{ $args{'Arguments'} } );
             return ProcessColumnMapValue( ( @tmp > 1 ? \@tmp : $tmp[0] ), %args );
-        } elsif ( UNIVERSAL::isa( $value, 'ARRAY' ) ) {
+        } elsif ( ref($value) eq 'ARRAY' ) {
             return join '', map ProcessColumnMapValue( $_, %args ), @$value;
-        } elsif ( UNIVERSAL::isa( $value, 'SCALAR' ) ) {
+        } elsif ( ref($value) eq 'SCALAR' ) {
             return $$value;
         }
     } else {
diff --git a/lib/RT/Shredder.pm b/lib/RT/Shredder.pm
index 9614f0b..203fdc9 100644
--- a/lib/RT/Shredder.pm
+++ b/lib/RT/Shredder.pm
@@ -338,11 +338,11 @@ sub CastObjectsToRecords
         while( my $tmp = $targets->Next ) { push @res, $tmp };
     } elsif ( UNIVERSAL::isa( $targets, 'RT::Record' ) ) {
         push @res, $targets;
-    } elsif ( UNIVERSAL::isa( $targets, 'ARRAY' ) ) {
+    } elsif ( ref($targets) eq 'ARRAY' ) {
         foreach( @$targets ) {
             push @res, $self->CastObjectsToRecords( Objects => $_ );
         }
-    } elsif ( UNIVERSAL::isa( $targets, 'SCALAR' ) || !ref $targets ) {
+    } elsif ( ref($targets) eq 'SCALAR' or not ref($targets) ) {
         $targets = $$targets if ref $targets;
         my ($class, $org, $id);
         if ($targets =~ /-.*-/) {
@@ -479,7 +479,7 @@ sub PutResolver
         Code => undef,
         @_,
     );
-    unless( UNIVERSAL::isa( $args{'Code'} => 'CODE' ) ) {
+    unless( ref($args{'Code'}) eq 'CODE' ) {
         die "Resolver '$args{Code}' is not code reference";
     }
 
diff --git a/lib/RT/Shredder/Plugin.pm b/lib/RT/Shredder/Plugin.pm
index 2c7a790..87da2f3 100644
--- a/lib/RT/Shredder/Plugin.pm
+++ b/lib/RT/Shredder/Plugin.pm
@@ -219,7 +219,7 @@ sub LoadByString
             next;
         }
 
-        $args{$k} = [ $args{$k} ] unless UNIVERSAL::isa( $args{ $k }, 'ARRAY');
+        $args{$k} = [ $args{$k} ] unless ref( $args{ $k } ) eq 'ARRAY';
         push @{ $args{$k} }, $v;
     }
 
diff --git a/lib/RT/Shredder/Plugin/Objects.pm b/lib/RT/Shredder/Plugin/Objects.pm
index 4da9f8f..6a95879 100644
--- a/lib/RT/Shredder/Plugin/Objects.pm
+++ b/lib/RT/Shredder/Plugin/Objects.pm
@@ -84,7 +84,7 @@ sub TestArgs
         next unless $args{$name};
 
         my $list = $args{$name};
-        $list = [$list] unless UNIVERSAL::isa( $list, 'ARRAY' );
+        $list = [$list] unless ref($list) eq 'ARRAY';
         push @strings, map "RT::$name\-$_", @$list;
     }
 
diff --git a/lib/RT/Ticket.pm b/lib/RT/Ticket.pm
index 6f8d2b4..d43faf9 100644
--- a/lib/RT/Ticket.pm
+++ b/lib/RT/Ticket.pm
@@ -475,13 +475,13 @@ sub Create {
         next unless $cf->ObjectTypeFromLookupType($cf->__Value('LookupType'))->isa(ref $self);
 
         foreach my $value (
-            UNIVERSAL::isa( $args{$arg} => 'ARRAY' ) ? @{ $args{$arg} } : ( $args{$arg} ) )
+            ( ref($args{$arg}) eq 'ARRAY' ) ? @{ $args{$arg} } : ( $args{$arg} ) )
         {
             next unless defined $value && length $value;
 
             # Allow passing in uploaded LargeContent etc by hash reference
             my ($status, $msg) = $self->_AddCustomFieldValue(
-                (UNIVERSAL::isa( $value => 'HASH' )
+                ((ref($value) eq 'HASH')
                     ? %$value
                     : (Value => $value)
                 ),
diff --git a/lib/RT/Transaction.pm b/lib/RT/Transaction.pm
index cb51b34..d3a55ed 100644
--- a/lib/RT/Transaction.pm
+++ b/lib/RT/Transaction.pm
@@ -1497,7 +1497,7 @@ sub UpdateCustomFields {
         my $cf = $self->LoadCustomFieldByIdentifier($cfid);
         next unless $cf->ObjectTypeFromLookupType($cf->__Value('LookupType'))->isa(ref $self);
         foreach
-          my $value ( UNIVERSAL::isa( $values, 'ARRAY' ) ? @$values : $values )
+          my $value ( (ref($values) eq 'ARRAY' ) ? @$values : $values )
         {
             next unless (defined($value) && length($value));
             $self->_AddCustomFieldValue(
diff --git a/share/html/Elements/QueryString b/share/html/Elements/QueryString
index 447cc5d..11165f9 100644
--- a/share/html/Elements/QueryString
+++ b/share/html/Elements/QueryString
@@ -51,7 +51,7 @@ for my $key (sort keys %ARGS) {
     my $value = $ARGS{$key};
     next unless defined $value;
     $key = $m->interp->apply_escapes( $key, 'u' );
-    if( UNIVERSAL::isa( $value, 'ARRAY' ) ) {
+    if( ref($value) eq 'ARRAY' ) {
         push @params,
             map $key ."=". $m->interp->apply_escapes( $_, 'u' ),
             map defined $_? $_ : '',
diff --git a/share/html/Search/Elements/ConditionRow b/share/html/Search/Elements/ConditionRow
index 0ff3be0..4991c5e 100644
--- a/share/html/Search/Elements/ConditionRow
+++ b/share/html/Search/Elements/ConditionRow
@@ -62,13 +62,13 @@ $handle_block = sub {
     return $box unless ref $box;
 
     my $name = shift;
-    if ( UNIVERSAL::isa($box, 'ARRAY') ) {
+    if ( ref($box) eq 'ARRAY' ) {
         my $res = '';
         $res .= $handle_block->( $_, $name ) foreach @$box;
         return $res;
     }
 
-    return undef unless UNIVERSAL::isa($box, 'HASH');
+    return undef unless ref($box) eq 'HASH';
     if ( $box->{'Type'} eq 'component' ) {
         $box->{'Arguments'} ||= {},
         return $m->scomp( $box->{'Path'}, %{ $box->{'Arguments'} }, Name => $name );

commit 512d1c1f93e40f5520d433afb5495cc4284c660e
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jun 28 15:52:51 2011 -0400

    Replace UNIVERSAL::isa checks in tests with the more correct isa_ok

diff --git a/t/api/attribute-tests.t b/t/api/attribute-tests.t
index 8489f1a..da23de4 100644
--- a/t/api/attribute-tests.t
+++ b/t/api/attribute-tests.t
@@ -12,7 +12,7 @@ my $attribute = "squelch-$runid";
 ok(require RT::Attributes);
 
 my $user = RT::User->new(RT->SystemUser);
-ok (UNIVERSAL::isa($user, 'RT::User'));
+isa_ok ($user, 'RT::User');
 my ($id,$msg)  = $user->Create(Name => 'attrtest-'.$runid);
 ok ($id, $msg);
 ok($user->id, "Created a test user");
@@ -25,7 +25,7 @@ $attr->OrderByCols({ FIELD => 'id' });
 ok(1, $attr->BuildSelectQuery);
 
 
-ok (UNIVERSAL::isa($attr,'RT::Attributes'), 'got the attributes object');
+isa_ok ($attr,'RT::Attributes');
 
 ($id, $msg) =  $user->AddAttribute(Name => 'TestAttr', Content => 'The attribute has content'); 
 ok ($id, $msg);
diff --git a/t/api/uri-fsck_com_rt.t b/t/api/uri-fsck_com_rt.t
index 18bee7d..3e70de2 100644
--- a/t/api/uri-fsck_com_rt.t
+++ b/t/api/uri-fsck_com_rt.t
@@ -12,7 +12,7 @@ ok ($id, $msg);
 
 ok(ref($uri));
 
-ok (UNIVERSAL::isa($uri,"RT::URI::fsck_com_rt"), "It's an RT::URI::fsck_com_rt");
+isa_ok($uri,"RT::URI::fsck_com_rt");
 
 ok ($uri->isa('RT::URI::base'), "It's an RT::URI::base");
 ok ($uri->isa('RT::Base'), "It's an RT::Base");
diff --git a/t/articles/article.t b/t/articles/article.t
index 7a3474f..64c12e8 100644
--- a/t/articles/article.t
+++ b/t/articles/article.t
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 
-use RT::Test tests => 67;
+use RT::Test tests => 66;
 
 use_ok 'RT::Articles';
 use_ok 'RT::Classes';
@@ -21,10 +21,9 @@ ok ($id, $msg);
 
 
 my $article = RT::Article->new($user);
-ok (UNIVERSAL::isa($article, 'RT::Article'));
-ok (UNIVERSAL::isa($article, 'RT::Record'));
-ok (UNIVERSAL::isa($article, 'RT::Record'));
-ok (UNIVERSAL::isa($article, 'DBIx::SearchBuilder::Record') , "It's a searchbuilder record!");
+isa_ok($article, 'RT::Article');
+isa_ok($article, 'RT::Record');
+isa_ok($article, 'DBIx::SearchBuilder::Record' , "It's a searchbuilder record!");
 
 
 ($id, $msg) = $article->Create( Class => $CLASS, Summary => $CLASS);
diff --git a/t/articles/class.t b/t/articles/class.t
index 7a7c015..74ab7c1 100644
--- a/t/articles/class.t
+++ b/t/articles/class.t
@@ -11,7 +11,7 @@ use_ok 'RT::Class';
 my $root = RT::CurrentUser->new('root');
 ok ($root->Id, "Loaded root");
 my $cl = RT::Class->new($root);
-ok (UNIVERSAL::isa($cl, 'RT::Class'), "the new class is a class");
+isa_ok($cl, 'RT::Class', "the new class is a class");
 
 my ($id, $msg) = $cl->Create(Name => 'Test-'.$$, Description => 'A test class');
 
@@ -50,7 +50,7 @@ ok ($u->Id, "Created a new user");
 
 # Make sure you can't create a group with no acls
 $cl = RT::Class->new($u);
-ok (UNIVERSAL::isa($cl, 'RT::Class'), "the new class is a class");
+isa_ok($cl, 'RT::Class', "the new class is a class");
 
 ($id, $msg) = $cl->Create(Name => 'Test-nobody'.$$, Description => 'A test class');
 

commit 9b2a8348b59661f682f35700c6c61483b9e94609
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jun 28 15:53:41 2011 -0400

    Replace UNIVERSAL::isa(errno,$id) with the certainly-intended reverse

diff --git a/lib/RT/Record.pm b/lib/RT/Record.pm
index 5abe0bc..def622d 100644
--- a/lib/RT/Record.pm
+++ b/lib/RT/Record.pm
@@ -363,7 +363,7 @@ sub Create {
 
    }
 
-    if  (UNIVERSAL::isa('errno',$id)) {
+    if (Scalar::Util::blessed($id) and $id->isa('errno')) {
         return(undef);
     }
 

commit 1320d5ff30750d737530a42f79d07f06a314216d
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jun 28 15:55:05 2011 -0400

    Store $@ as soon as possible in error handler

diff --git a/share/html/Admin/Tools/Shredder/index.html b/share/html/Admin/Tools/Shredder/index.html
index 9e6eee7..90601b2 100644
--- a/share/html/Admin/Tools/Shredder/index.html
+++ b/share/html/Admin/Tools/Shredder/index.html
@@ -76,16 +76,17 @@ my %messages = ( Errors => [], Success => [] );
 my ($plugin_obj, @objs);
 
 my $catch_non_fatals = sub {
+    my $error = $@;
     require RT::Shredder::Exceptions;
     if ( my $e = RT::Shredder::Exception::Info->caught ) {
         push @{ $messages{Errors} }, "$e";
         $Search = ''; @objs = ();
         return 1;
     }
-    if ( UNIVERSAL::isa( $@, 'Class::Exception' ) ) {
-        $@->rethrow;
+    if ( Scalar::Util::blessed($error) and $error->isa( 'Class::Exception' ) ) {
+        $error->rethrow;
     } else {
-        die $@;
+        die $error;
     }
 };
 

commit 96b7a64517856263d73514c6b64523d6fc14fa73
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jun 28 15:56:24 2011 -0400

    Replace UNIVERSAL::isa(...)'s usage to mean "instanceof" with blessed && ->isa()

diff --git a/lib/RT/Articles.pm b/lib/RT/Articles.pm
index 4b85eba..6a6a4c2 100644
--- a/lib/RT/Articles.pm
+++ b/lib/RT/Articles.pm
@@ -274,7 +274,7 @@ sub LimitCustomField {
     if ( $args{'FIELD'} ) {
 
         my $field_id;
-        if (UNIVERSAL::isa($args{'FIELD'} ,'RT::CustomField')) {
+        if (Scalar::Util::blessed($args{'FIELD'}) and $args{'FIELD'}->isa('RT::CustomField')) {
             $field_id = $args{'FIELD'}->id;
         } elsif($args{'FIELD'} =~ /^\d+$/) {
             $field_id = $args{'FIELD'};
diff --git a/lib/RT/Attribute.pm b/lib/RT/Attribute.pm
index a5acbd7..f6a4da3 100644
--- a/lib/RT/Attribute.pm
+++ b/lib/RT/Attribute.pm
@@ -360,7 +360,7 @@ sub Object {
     my $object_type = $self->__Value('ObjectType');
     my $object;
     eval { $object = $object_type->new($self->CurrentUser) };
-    unless(UNIVERSAL::isa($object, $object_type)) {
+    unless( Scalar::Util::blessed($object) and $object->isa($object_type) ) {
         $RT::Logger->error("Attribute ".$self->Id." has a bogus object type - $object_type (".$@.")");
         return(undef);
      }
diff --git a/lib/RT/CachedGroupMember.pm b/lib/RT/CachedGroupMember.pm
index f5d62c2..7323d84 100644
--- a/lib/RT/CachedGroupMember.pm
+++ b/lib/RT/CachedGroupMember.pm
@@ -104,19 +104,22 @@ sub Create {
                  @_ );
 
     unless (    $args{'Member'}
-             && UNIVERSAL::isa( $args{'Member'}, 'RT::Principal' )
+             && Scalar::Util::blessed( $args{'Member'} )
+             && $args{'Member'}->isa( 'RT::Principal' )
              && $args{'Member'}->Id ) {
         $RT::Logger->debug("$self->Create: bogus Member argument");
     }
 
     unless (    $args{'Group'}
-             && UNIVERSAL::isa( $args{'Group'}, 'RT::Principal' )
+             && Scalar::Util::blessed( $args{'Group'} )
+             && $args{'Group'}->isa( 'RT::Principal' )
              && $args{'Group'}->Id ) {
         $RT::Logger->debug("$self->Create: bogus Group argument");
     }
 
     unless (    $args{'ImmediateParent'}
-             && UNIVERSAL::isa( $args{'ImmediateParent'}, 'RT::Principal' )
+             && Scalar::Util::blessed( $args{'ImmediateParent'} )
+             && $args{'ImmediateParent'}->isa( 'RT::Principal' )
              && $args{'ImmediateParent'}->Id ) {
         $RT::Logger->debug("$self->Create: bogus ImmediateParent argument");
     }
diff --git a/lib/RT/CurrentUser.pm b/lib/RT/CurrentUser.pm
index b8079b8..da69805 100644
--- a/lib/RT/CurrentUser.pm
+++ b/lib/RT/CurrentUser.pm
@@ -107,7 +107,7 @@ sub _Init {
 
     if ( defined $User ) {
 
-        if ( UNIVERSAL::isa( $User, 'RT::User' ) ) {
+        if ( Scalar::Util::blessed($User) and $User->isa( 'RT::User' ) ) {
             $self->LoadById( $User->id );
         }
         elsif ( ref $User ) {
diff --git a/lib/RT/Date.pm b/lib/RT/Date.pm
index 4344865..72b0edb 100644
--- a/lib/RT/Date.pm
+++ b/lib/RT/Date.pm
@@ -306,7 +306,7 @@ sub Diff {
     my $self = shift;
     my $other = shift;
     $other = time unless defined $other;
-    if ( UNIVERSAL::isa( $other, 'RT::Date' ) ) {
+    if ( Scalar::Util::blessed( $other ) and $other->isa( 'RT::Date' ) ) {
         $other = $other->Unix;
     }
     return undef unless $other=~ /^\d+$/ && $other > 0;
diff --git a/lib/RT/Group.pm b/lib/RT/Group.pm
index b79f474..8f73ddc 100644
--- a/lib/RT/Group.pm
+++ b/lib/RT/Group.pm
@@ -1150,7 +1150,7 @@ sub HasMember {
     my $principal = shift;
 
     my $id;
-    if ( UNIVERSAL::isa($principal,'RT::Principal') ) {
+    if ( Scalar::Util::blessed( $principal ) and $principal->isa('RT::Principal') ) {
         $id = $principal->id;
     } elsif ( $principal =~ /^\d+$/ ) {
         $id = $principal;
@@ -1192,7 +1192,7 @@ sub HasMemberRecursively {
     my $principal = shift;
 
     my $id;
-    if ( UNIVERSAL::isa($principal,'RT::Principal') ) {
+    if ( Scalar::Util::blessed( $principal ) and $principal->isa('RT::Principal') ) {
         $id = $principal->id;
     } elsif ( $principal =~ /^\d+$/ ) {
         $id = $principal;
diff --git a/lib/RT/GroupMember.pm b/lib/RT/GroupMember.pm
index 6fc6002..186e3d3 100644
--- a/lib/RT/GroupMember.pm
+++ b/lib/RT/GroupMember.pm
@@ -156,8 +156,9 @@ sub Create {
         @_
     );
 
-    unless ($args{'Group'} &&
-            UNIVERSAL::isa($args{'Group'}, 'RT::Principal') &&
+    unless ($args{'Group'} and
+            Scalar::Util::blessed( $args{'Group'} ) and
+            $args{'Group'}->isa( 'RT::Principal' ) and
             $args{'Group'}->Id ) {
 
         $RT::Logger->warning("GroupMember::Create called with a bogus Group arg");
@@ -169,8 +170,9 @@ sub Create {
         return (undef);
     }
 
-    unless ($args{'Member'} && 
-            UNIVERSAL::isa($args{'Member'}, 'RT::Principal') &&
+    unless ($args{'Member'} and
+            Scalar::Util::blessed( $args{'Member'} ) and
+            $args{'Member'}->isa( 'RT::Principal' ) and
             $args{'Member'}->Id) {
         $RT::Logger->warning("GroupMember::Create called with a bogus Principal arg");
         return (undef);
diff --git a/lib/RT/Link.pm b/lib/RT/Link.pm
index fc8a033..e03450f 100644
--- a/lib/RT/Link.pm
+++ b/lib/RT/Link.pm
@@ -176,7 +176,7 @@ sub Create {
             return (undef, $self->loc("[_1] appears to be a local object, but can't be found in the database", $args{'Base'}));
         
         }
-        $base_id = $object->Id if UNIVERSAL::isa($object, 'RT::Ticket');
+        $base_id = $object->Id if Scalar::Util::blessed($object) and $object->isa('RT::Ticket');
     }
     if ( $target->IsLocal ) {
         my $object = $target->Object;
@@ -184,7 +184,7 @@ sub Create {
             return (undef, $self->loc("[_1] appears to be a local object, but can't be found in the database", $args{'Target'}));
         
         }
-        $target_id = $object->Id if UNIVERSAL::isa($object, 'RT::Ticket');
+        $target_id = $object->Id if Scalar::Util::blessed($object) and $object->isa('RT::Ticket');
     }
 
     # We don't want references to ourself
diff --git a/lib/RT/Links.pm b/lib/RT/Links.pm
index 89e261b..eb5be8b 100644
--- a/lib/RT/Links.pm
+++ b/lib/RT/Links.pm
@@ -160,14 +160,15 @@ sub IsValidLink {
     return unless $link && ref $link && $link->Target && $link->Base;
 
     # Skip links to local objects thast are deleted
-    return
-      if $link->TargetURI->IsLocal
-          && ( UNIVERSAL::isa( $link->TargetObj, "RT::Ticket" )
-              && $link->TargetObj->__Value('status') eq "deleted"
-              || UNIVERSAL::isa( $link->BaseObj, "RT::Ticket" )
-              && $link->BaseObj->__Value('status') eq "deleted" );
-
-    return 1;
+    if ( $link->TargetURI->IsLocal and $link->TargetObj->isa("RT::Ticket")
+             and $link->TargetObj->__Value('status') eq "deleted") {
+        return 0;
+    } elsif ($link->BaseURI->IsLocal   and $link->BaseObj->isa("RT::Ticket")
+             and $link->BaseObj->__Value('status') eq "deleted") {
+        return 0;
+    } else {
+        return 1;
+    }
 }
 
 RT::Base->_ImportOverlays();
diff --git a/lib/RT/Record.pm b/lib/RT/Record.pm
index def622d..3a32320 100644
--- a/lib/RT/Record.pm
+++ b/lib/RT/Record.pm
@@ -337,7 +337,7 @@ sub Create {
       if ( $self->_Accessible( 'LastUpdatedBy', 'auto' ) && !$attribs{'LastUpdatedBy'});
 
     my $id = $self->SUPER::Create(%attribs);
-    if ( UNIVERSAL::isa( $id, 'Class::ReturnValue' ) ) {
+    if ( Scalar::Util::blessed($id) and $id->isa( 'Class::ReturnValue' ) ) {
         if ( $id->errno ) {
             if (wantarray) {
                 return ( 0,
@@ -2283,7 +2283,7 @@ sub LoadCustomFieldByIdentifier {
     my $field = shift;
     
     my $cf;
-    if ( UNIVERSAL::isa( $field, "RT::CustomField" ) ) {
+    if ( Scalar::Util::blessed($field) and $field->isa( "RT::CustomField" ) ) {
         $cf = RT::CustomField->new($self->CurrentUser);
         $cf->SetContextObject( $self );
         $cf->LoadById( $field->id );
diff --git a/lib/RT/Shredder.pm b/lib/RT/Shredder.pm
index 203fdc9..183050a 100644
--- a/lib/RT/Shredder.pm
+++ b/lib/RT/Shredder.pm
@@ -331,12 +331,12 @@ sub CastObjectsToRecords
         RT::Shredder::Exception->throw( "Undefined Objects argument" );
     }
 
-    if( UNIVERSAL::isa( $targets, 'RT::SearchBuilder' ) ) {
+    if( Scalar::Util::blessed($targets) and $targets->isa( 'RT::SearchBuilder' ) ) {
         #XXX: try to use ->_DoSearch + ->ItemsArrayRef in feature
         #     like we do in Record with links, but change only when
         #     more tests would be available
         while( my $tmp = $targets->Next ) { push @res, $tmp };
-    } elsif ( UNIVERSAL::isa( $targets, 'RT::Record' ) ) {
+    } elsif ( Scalar::Util::blessed($targets) and $targets->isa( 'RT::Record' ) ) {
         push @res, $targets;
     } elsif ( ref($targets) eq 'ARRAY' ) {
         foreach( @$targets ) {
@@ -413,7 +413,7 @@ sub PutObject
     my %args = ( Object => undef, @_ );
 
     my $obj = $args{'Object'};
-    unless( UNIVERSAL::isa( $obj, 'RT::Record' ) ) {
+    unless( Scalar::Util::blessed($obj) and $obj->isa( 'RT::Record' ) ) {
         RT::Shredder::Exception->throw( "Unsupported type '". (ref $obj || $obj || '(undef)')."'" );
     }
 
diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index 6afb311..7392222 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -1140,7 +1140,7 @@ sub run_mailgate {
 
     $args{after_open} = sub {
         my $child_in = shift;
-        if ( UNIVERSAL::isa($message, 'MIME::Entity') ) {
+        if ( Scalar::Util::blessed( $message ) and $message->isa('MIME::Entity') ) {
             $message->print( $child_in );
         } else {
             print $child_in $message;
@@ -1218,7 +1218,7 @@ sub send_via_mailgate {
                  @_
                );
 
-    if ( UNIVERSAL::isa( $message, 'MIME::Entity' ) ) {
+    if ( Scalar::Util::blessed($message) and $message->isa( 'MIME::Entity' ) ) {
         $message = $message->as_string;
     }
 
diff --git a/lib/RT/User.pm b/lib/RT/User.pm
index e65478d..632c662 100644
--- a/lib/RT/User.pm
+++ b/lib/RT/User.pm
@@ -476,7 +476,7 @@ sub Load {
 
     if ( $identifier !~ /\D/ ) {
         return $self->SUPER::LoadById( $identifier );
-    } elsif ( UNIVERSAL::isa( $identifier, 'RT::User' ) ) {
+    } elsif ( Scalar::Util::blessed( $identifier ) and $identifier->isa( 'RT::User' ) ) {
         return $self->SUPER::LoadById( $identifier->Id );
     } else {
         return $self->LoadByCol( "Name", $identifier );
@@ -520,7 +520,7 @@ sub LoadOrCreateByEmail {
     my $email = shift;
 
     my ($message, $name);
-    if ( UNIVERSAL::isa( $email => 'Email::Address' ) ) {
+    if ( Scalar::Util::blessed( $email ) and $email->isa( 'Email::Address' ) ) {
         ($email, $name) = ($email->address, $email->phrase);
     } else {
         ($email, $name) = RT::Interface::Email::ParseAddressFromHeader( $email );
diff --git a/lib/RT/Users.pm b/lib/RT/Users.pm
index 39cebf4..7b08a74 100644
--- a/lib/RT/Users.pm
+++ b/lib/RT/Users.pm
@@ -348,7 +348,7 @@ sub _GetEquivObjects
     return () unless $args{'Object'};
 
     my @objects = ($args{'Object'});
-    if ( UNIVERSAL::isa( $args{'Object'}, 'RT::Ticket' ) ) {
+    if ( Scalar::Util::blessed( $args{'Object'} ) and $args{'Object'}->isa( 'RT::Ticket' ) ) {
         # If we're looking at ticket rights, we also want to look at the associated queue rights.
         # this is a little bit hacky, but basically, now that we've done the ticket roles magic,
         # we load the queue object and ask all the rest of our questions about the queue.
diff --git a/share/html/Elements/BulkLinks b/share/html/Elements/BulkLinks
index 473e843..0fce2bc 100644
--- a/share/html/Elements/BulkLinks
+++ b/share/html/Elements/BulkLinks
@@ -106,7 +106,7 @@
 % if ( $hash{ReferredToBy} ) {
 % for my $link ( values %{$hash{ReferredToBy}} ) {
 % # Skip reminders
-% next if (UNIVERSAL::isa($link->BaseObj, 'RT::Ticket')  && $link->BaseObj->Type eq 'reminder');
+% next if (Scalar::Util::blessed($link->BaseObj) && $link->BaseObj->isa('RT::Ticket')  && $link->BaseObj->Type eq 'reminder');
       <input type="checkbox" class="checkbox" id="DeleteLink-<%$link->Base%>-<%$link->Type%>-" name="DeleteLink-<%$link->Base%>-<%$link->Type%>-" value="1" />
       <label for="DeleteLink-<%$link->Base%>-<%$link->Type%>-"><& /Elements/ShowLink, URI => $link->BaseURI &></label><br />
 % } }
diff --git a/share/html/Elements/EditLinks b/share/html/Elements/EditLinks
index 39f8bfe..9c78a60 100644
--- a/share/html/Elements/EditLinks
+++ b/share/html/Elements/EditLinks
@@ -101,7 +101,7 @@
     <td class="value">
 % while (my $link = $Object->ReferredToBy->Next) {
 % # Skip reminders
-% next if (UNIVERSAL::isa($link->BaseObj, 'RT::Ticket')  && $link->BaseObj->Type eq 'reminder');
+% next if (Scalar::Util::blessed($link->BaseObj) and $link->BaseObj->isa('RT::Ticket')  and $link->BaseObj->Type eq 'reminder');
       <input type="checkbox" class="checkbox" id="DeleteLink-<%$link->Base%>-<%$link->Type%>-" name="DeleteLink-<%$link->Base%>-<%$link->Type%>-" value="1" />
       <label for="DeleteLink-<%$link->Base%>-<%$link->Type%>-"><& ShowLink, URI => $link->BaseURI &></label><br />
 % }
diff --git a/share/html/m/ticket/show b/share/html/m/ticket/show
index ebf39ac..c1080a5 100644
--- a/share/html/m/ticket/show
+++ b/share/html/m/ticket/show
@@ -448,7 +448,7 @@ for my $link ( @{ $Ticket->DependsOn->ItemsArrayRef } ) {
     <div class="value">
     <ul>
 % while (my $Link = $Ticket->ReferredToBy->Next) {
-% next if (UNIVERSAL::isa($Link->BaseObj, 'RT::Ticket')  && $Link->BaseObj->Type eq 'reminder');
+% next if (Scalar::Util::blessed($Link->BaseObj) and $Link->BaseObj->isa('RT::Ticket')  && $Link->BaseObj->Type eq 'reminder');
 <li><& /Elements/ShowLink, URI => $Link->BaseURI &></li>
 % }
 </ul>

commit 71c909dc13e0fee685906dc20a88e1f2ab5f8c9a
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jun 28 15:56:55 2011 -0400

    Replace UNIVERSAL::isa(...)'s usage to mean "class is a subclass of" with just ->isa()

diff --git a/lib/RT/URI/fsck_com_rt.pm b/lib/RT/URI/fsck_com_rt.pm
index 053268f..82846cd 100644
--- a/lib/RT/URI/fsck_com_rt.pm
+++ b/lib/RT/URI/fsck_com_rt.pm
@@ -130,7 +130,7 @@ sub ParseURI {
 
             # We can instantiate any RT::Record subtype. but not anything else
 
-            if ( UNIVERSAL::isa( $type, 'RT::Record' ) ) {
+            if ( $type->isa( 'RT::Record' ) ) {
                 my $record = $type->new( $self->CurrentUser );
                 $record->Load($id);
 

commit c8e1d5c857d417daf2aa65c3869f169b720da817
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Jun 29 16:54:01 2011 -0400

    Use ->can() to dispatch, rather than a string eval

diff --git a/sbin/rt-email-group-admin.in b/sbin/rt-email-group-admin.in
index 17a0850..b7951f4 100644
--- a/sbin/rt-email-group-admin.in
+++ b/sbin/rt-email-group-admin.in
@@ -187,7 +187,7 @@ require RT::ScripActions;
 
 
 {
-    eval "main::$cmd()";
+    main->can($cmd)->();
     if ( $@ ) {
         print STDERR $@ ."\n";
     }

commit 0d36584defdea229b3298e5bc3104f527c5e5b24
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Jun 29 15:43:53 2011 -0400

    Don't use bareword filehandles

diff --git a/devel/tools/cmd-boilerplate b/devel/tools/cmd-boilerplate
index 3e8c1bf..291a402 100755
--- a/devel/tools/cmd-boilerplate
+++ b/devel/tools/cmd-boilerplate
@@ -58,9 +58,9 @@ sub tag_it {
         my $file = $_;
         return unless (-f $file);
         return if $file !~ /.in$/;
-        open( FILE, '<', $file ) or die "Failed to open $file";
-        my $content = (join "", <FILE>);
-        close (FILE);
+        open( my $fh, '<', $file ) or die "Failed to open $file";
+        my $content = (join "", <fh>);
+        close ($fh);
         my $new = q'BEGIN { # BEGIN RT CMD BOILERPLATE
     require File::Spec;
     require Cwd;
@@ -82,8 +82,8 @@ sub tag_it {
 
         warn $file;
  
-        open( FILE, '>', $file ) or die "couldn't write new file";
-        print FILE $content;
-        close FILE;
+        open( $fh, '>', $file ) or die "couldn't write new file";
+        print $fh $content;
+        close $fh;
 
 }
diff --git a/devel/tools/extract-message-catalog b/devel/tools/extract-message-catalog
index 5dd89b8..2f4b178 100755
--- a/devel/tools/extract-message-catalog
+++ b/devel/tools/extract-message-catalog
@@ -120,7 +120,6 @@ foreach my $dict (@ARGV) {
 sub extract_strings_from_code {
     my $file = $_;
 
-    local $/;
     return if ( -d $_ || !-e _ );
     return
       if ( $File::Find::dir =~
@@ -136,10 +135,14 @@ sub extract_strings_from_code {
     $filename =~ s'^\./'';
     $filename =~ s'\.in$'';
 
-    unless (open _, '<', $file) {
+    my $fh;
+    unless (open $fh, '<', $file) {
         print "\n  Cannot open $file for reading ($!), skipping.\n\n";
         return;
     }
+    local $/;
+    $_ = <$fh>;
+    close $fh;
 
     my $errors = 0;
 
@@ -151,7 +154,6 @@ sub extract_strings_from_code {
     my $re_loc_left_pair_suffix = qr{$re_space_wo_nl* \# $re_space_wo_nl* loc_left_pair $re_space_wo_nl* $}mx;
     my $re_delim = $RE{delimited}{-delim=>q{'"}}{-keep};
 
-    $_ = <_>;
 
     # Mason filter: <&|/l>...</&> and <&|/l_unsafe>...</&>
     my $line = 1;
@@ -317,7 +319,6 @@ sub extract_strings_from_code {
         print "\r", " " x 100, "\r";
     }
 
-    close (_);
 }
 
 sub uniq {
diff --git a/devel/tools/license_tag b/devel/tools/license_tag
index b9d7192..43350ca 100755
--- a/devel/tools/license_tag
+++ b/devel/tools/license_tag
@@ -119,9 +119,9 @@ sub tag_mason {
         my $pm = $_;
         return unless (-f $pm);
         return if $pm =~ /\.(?:png|jpe?g|gif)$/;
-        open( FILE, '<', $pm ) or die "Failed to open $pm";
-        my $file = (join "", <FILE>);
-        close (FILE);
+        open( my $fh, '<', $pm ) or die "Failed to open $pm";
+        my $file = (join "", <$fh>);
+        close ($fh);
         print "$pm - ";
         return if another_license($pm => $file) && print "has different license\n";
 
@@ -143,18 +143,18 @@ sub tag_mason {
 
 
 
-        open( FILE, '>', $pm ) or die "couldn't write new file";
-        print FILE $file;
-        close FILE;
+        open( $fh, '>', $pm ) or die "couldn't write new file";
+        print $fh $file;
+        close $fh;
 
 }
 
 
 sub tag_makefile {
         my $pm = shift;
-        open( FILE, '<', $pm ) or die "Failed to open $pm";
-        my $file = (join "", <FILE>);
-        close (FILE);
+        open( my $fh, '<', $pm ) or die "Failed to open $pm";
+        my $file = (join "", <$fh>);
+        close ($fh);
         print "$pm - ";
         return if another_license($pm => $file) && print "has different license\n";
 
@@ -176,9 +176,9 @@ sub tag_makefile {
 
 
 
-        open( FILE, '>', $pm ) or die "couldn't write new file";
-        print FILE $file;
-        close FILE;
+        open( $fh, '>', $pm ) or die "couldn't write new file";
+        print $fh $file;
+        close $fh;
 
 }
 
@@ -186,9 +186,9 @@ sub tag_makefile {
 sub tag_pm {
         my $pm = $_;
         return unless $pm =~ /\.pm/s;
-        open( FILE, '<', $pm ) or die "Failed to open $pm";
-        my $file = (join "", <FILE>);
-        close (FILE);
+        open( my $fh, '<', $pm ) or die "Failed to open $pm";
+        my $file = (join "", <$fh>);
+        close ($fh);
         print "$pm - ";
         return if another_license($pm => $file) && print "has different license\n";
 
@@ -210,9 +210,9 @@ sub tag_pm {
 
 
 
-        open( FILE, '>', $pm ) or die "couldn't write new file $pm";
-        print FILE $file;
-        close FILE;
+        open( $fh, '>', $pm ) or die "couldn't write new file $pm";
+        print $fh $file;
+        close $fh;
 
 }
 
@@ -220,9 +220,9 @@ sub tag_pm {
 sub tag_script {
         my $pm = $_;
         return unless (-f $pm);
-        open( FILE, '<', $pm ) or die "Failed to open $pm";
-        my $file = (join "", <FILE>);
-        close (FILE);
+        open( my $fh, '<', $pm ) or die "Failed to open $pm";
+        my $file = (join "", <$fh>);
+        close ($fh);
         print "$pm - ";
         return if another_license($pm => $file) && print "has different license\n";
 
@@ -247,9 +247,9 @@ sub tag_script {
         print "\n";
 
 
-        open( FILE, '>', $pm ) or die "couldn't write new file";
-        print FILE $file;
-        close FILE;
+        open( $fh, '>', $pm ) or die "couldn't write new file";
+        print $fh $file;
+        close $fh;
 
 }
 
diff --git a/devel/tools/rt-apache b/devel/tools/rt-apache
index 40aec13..7f8e510 100755
--- a/devel/tools/rt-apache
+++ b/devel/tools/rt-apache
@@ -156,10 +156,10 @@ $template =~ s/\$TOOLS/$FindBin::Bin/g;
 $template =~ s/\$PROCESSES/$opt{single} ? 1 : 3/ge;
 
 my $conf = "$opt{root}/var/apache.conf";
-open(CONF, ">", $conf)
+open( my $apache_conf_fh, ">", $conf)
     or die "Can't write $conf: $!";
-print CONF $template;
-close CONF;
+print $apache_conf_fh $template;
+close $apache_conf_fh;
 
 my @opts = ("-f", $conf, "-D" . uc($mod) );
 push @opts, "-DSSL" if $opt{ssl};
@@ -169,10 +169,10 @@ push @opts, "-DREDIRECT" if $path;
 push @opts, "-DAUTH" if $opt{auth};
 
 # Wait for a previous run to terminate
-if ( open( PIDFILE, "<", "$opt{root}/var/apache2.pid") ) {
-    my $pid = <PIDFILE>;
+if ( open( $pidfh, "<", "$opt{root}/var/apache2.pid") ) {
+    my $pid = <$pidfh>;
     chomp $pid;
-    close PIDFILE;
+    close $pidfh;
     if ($pid and kill 0, $pid) {
         warn "Waiting for previous run (pid $pid) to finish...\n";
         sleep 1 while kill 0, $pid;
@@ -199,13 +199,13 @@ sub parseconf {
     my ($optname) = @_;
     # We're going to be evil, and try to parse the config
     unless (defined $RTCONF) {
-        unless ( open(CONF, "<", "$opt{root}/etc/RT_SiteConfig.pm") ) {
+        unless ( open( $conffh, "<", "$opt{root}/etc/RT_SiteConfig.pm") ) {
             warn "Can't open $opt{root}/etc/RT_SiteConfig.pm: $!\n";
             $RTCONF = "";
             return;
         }
-        $RTCONF = join("", <CONF>);
-        close CONF;
+        $RTCONF = join("", <$conffh>);
+        close $conffh;
     }
 
     return unless $RTCONF =~ /^\s*Set\(\s*\$$optname\s*(?:,|=>)\s*['"]?(.*?)['"]?\s*\)/m;
diff --git a/t/mail/bounce.t b/t/mail/bounce.t
index 703e86d..27369af 100644
--- a/t/mail/bounce.t
+++ b/t/mail/bounce.t
@@ -30,12 +30,12 @@ EOM
 }
 
 
-open(LOG, "<", $ENV{RT_MAILLOGFILE}) or die "Can't open log file: $!";
+open(my $log, "<", $ENV{RT_MAILLOGFILE}) or die "Can't open log file: $!";
 my $fcount;
-while (my $line = <LOG>) {
+while (my $line = <$log>) {
     $fcount++ if $line =~ /^-f/;
 }
-close(LOG);
+close($log) or die "Failed to read log file: $!";
 # RT_MAILLOGFILE will contain all the command line flags if you need them
 is($fcount,1,"Only one -f specified to sendmail command");
 
diff --git a/t/mail/fake-sendmail b/t/mail/fake-sendmail
index 44c2377..438d81e 100755
--- a/t/mail/fake-sendmail
+++ b/t/mail/fake-sendmail
@@ -8,19 +8,20 @@ use warnings;
 
 die "No \$RT_MAILLOGFILE set in environment"
     unless $ENV{RT_MAILLOGFILE};
-open LOG, ">", $ENV{RT_MAILLOGFILE}
+open my $log, ">", $ENV{RT_MAILLOGFILE}
     or die "Can't write to $ENV{RT_MAILLOGFILE}: $!";
 
 my $needs_newline;
 for (@ARGV) {
     if (/^-/) {
-        print LOG "\n" if $needs_newline++;
-        print LOG $_;
+        print $log "\n" if $needs_newline++;
+        print $log $_;
     } else {
-        print LOG " $_";
+        print $log " $_";
     }
 }
-print LOG "\n";
+print $log "\n";
+close $log;
 
 1 while $_ = <STDIN>;
 
diff --git a/t/mail/gateway.t b/t/mail/gateway.t
index 89b1b60..5e74936 100644
--- a/t/mail/gateway.t
+++ b/t/mail/gateway.t
@@ -627,13 +627,13 @@ ok( $id, 'new ticket created' );
 is( $tick->Owner, RT->Nobody->Id, 'owner of the new ticket is nobody' );
 
 $! = 0;
-ok(open(MAIL, '|-', "$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action take"), "Opened the mailgate - $!");
-print MAIL <<EOF;
+ok(open(my $mailgate, '|-', "$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action take"), "Opened the mailgate - $!");
+print $mailgate <<EOF;
 From: root\@localhost
 Subject: [@{[RT->Config->Get('rtname')]} \#$id] test
 
 EOF
-close (MAIL);
+close ($mailgate) or die "Failed to write to mailgate: $!";
 is ($? >> 8, 0, "The mail gateway exited normally");
 
 DBIx::SearchBuilder::Record::Cachable->FlushCache;
@@ -655,14 +655,14 @@ $m->no_warnings_ok;
 
 
 $! = 0;
-ok(open(MAIL, '|-', "$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action take-correspond"), "Opened the mailgate - $@");
-print MAIL <<EOF;
+ok(open($mailgate, '|-', "$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action take-correspond"), "Opened the mailgate - $@");
+print $mailgate <<EOF;
 From: root\@localhost
 Subject: [@{[RT->Config->Get('rtname')]} \#$id] correspondence
 
 test
 EOF
-close (MAIL);
+close ($mailgate) or die "Failed to write to mailgate: $!";
 is ($? >> 8, 0, "The mail gateway exited normally");
 
 DBIx::SearchBuilder::Record::Cachable->FlushCache;
@@ -682,13 +682,13 @@ $m->no_warnings_ok;
 
 
 $! = 0;
-ok(open(MAIL, '|-', "$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action resolve"), "Opened the mailgate - $!");
-print MAIL <<EOF;
+ok(open($mailgate, '|-', "$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action resolve"), "Opened the mailgate - $!");
+print $mailgate <<EOF;
 From: root\@localhost
 Subject: [@{[RT->Config->Get('rtname')]} \#$id] test
 
 EOF
-close (MAIL);
+close ($mailgate) or die "Failed to write to mailgate: $!";
 is ($? >> 8, 0, "The mail gateway exited normally");
 
 DBIx::SearchBuilder::Record::Cachable->FlushCache;
@@ -719,13 +719,13 @@ my $rtname = RT->Config->Get('rtname');
 $m->no_warnings_ok;
 
 $! = 0;
-ok(open(MAIL, '|-', "$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action take"), "Opened the mailgate - $!");
-print MAIL <<EOF;
+ok(open($mailgate, '|-', "$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action take"), "Opened the mailgate - $!");
+print $mailgate <<EOF;
 From: ext-mailgate\@localhost
 Subject: [$rtname \#$id] test
 
 EOF
-close (MAIL);
+close ($mailgate) or die "Failed to write to mailgate: $!";
 is ( $? >> 8, 0, "mailgate exited normally" );
 DBIx::SearchBuilder::Record::Cachable->FlushCache;
 
@@ -741,14 +741,14 @@ $m->next_warning_like(qr/Could not record email: Ticket not taken/);
 $m->no_leftover_warnings_ok;
 
 $! = 0;
-ok(open(MAIL, '|-', "$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action correspond-take"), "Opened the mailgate - $!");
-print MAIL <<EOF;
+ok(open($mailgate, '|-', "$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action correspond-take"), "Opened the mailgate - $!");
+print $mailgate <<EOF;
 From: ext-mailgate\@localhost
 Subject: [$rtname \#$id] test
 
 correspond-take
 EOF
-close (MAIL);
+close ($mailgate) or die "Failed to write to mailgate: $!";
 is ( $? >> 8, 0, "mailgate exited normally" );
 DBIx::SearchBuilder::Record::Cachable->FlushCache;
 
@@ -760,14 +760,14 @@ $m->next_warning_like(qr/Could not record email: Ticket not taken/);
 $m->no_leftover_warnings_ok;
 
 $! = 0;
-ok(open(MAIL, '|-', "$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action take-correspond"), "Opened the mailgate - $!");
-print MAIL <<EOF;
+ok(open($mailgate, '|-', "$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action take-correspond"), "Opened the mailgate - $!");
+print $mailgate <<EOF;
 From: ext-mailgate\@localhost
 Subject: [$rtname \#$id] test
 
 correspond-take
 EOF
-close (MAIL);
+close ($mailgate) or die "Failed to write to mailgate: $!";
 is ( $? >> 8, 0, "mailgate exited normally" );
 DBIx::SearchBuilder::Record::Cachable->FlushCache;
 
@@ -805,14 +805,14 @@ ok( $status, "successfuly granted right: $msg" );
 ok( $status, "successfuly granted right: $msg" );
 
 $! = 0;
-ok(open(MAIL, '|-', "$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action take-correspond"), "Opened the mailgate - $!");
-print MAIL <<EOF;
+ok(open($mailgate, '|-', "$RT::BinPath/rt-mailgate --url $url --queue ext-mailgate --action take-correspond"), "Opened the mailgate - $!");
+print $mailgate <<EOF;
 From: ext-mailgate\@localhost
 Subject: [$rtname \#$id] test
 
 take-correspond with reply right granted to owner role
 EOF
-close (MAIL);
+close ($mailgate) or die "Failed to write to mailgate: $!";
 is ( $? >> 8, 0, "mailgate exited normally" );
 DBIx::SearchBuilder::Record::Cachable->FlushCache;
 
diff --git a/t/security/CVE-2011-4458-verp.t b/t/security/CVE-2011-4458-verp.t
index f84b794..4ab21e7 100644
--- a/t/security/CVE-2011-4458-verp.t
+++ b/t/security/CVE-2011-4458-verp.t
@@ -38,11 +38,11 @@ my $ticket = RT::Ticket->new( $current_user );
 );
 ok( $id, "Created a ticket: $msg" );
 
-open(LOG, "<", $ENV{RT_MAILLOGFILE}) or die "Can't open log file: $!";
-while (my $line = <LOG>) {
+open(my $log, "<", $ENV{RT_MAILLOGFILE}) or die "Can't open log file: $!";
+while (my $line = <$log>) {
     next unless $line =~ /^-f/;
     like($line, qr/\$USER/, "Contains uninterpolated \$USER");
 }
-close(LOG);
+close($log) or die "Failed to read log: $!";
 
 done_testing;
diff --git a/t/security/fake-sendmail b/t/security/fake-sendmail
index 43259b6..380f6be 100755
--- a/t/security/fake-sendmail
+++ b/t/security/fake-sendmail
@@ -5,19 +5,19 @@ use warnings;
 
 die "No \$RT_MAILLOGFILE set in environment"
     unless $ENV{RT_MAILLOGFILE};
-open LOG, ">", $ENV{RT_MAILLOGFILE}
+open my $log, ">", $ENV{RT_MAILLOGFILE}
     or die "Can't write to $ENV{RT_MAILLOGFILE}: $!";
 
 my $needs_newline;
 for (@ARGV) {
     if (/^-/) {
-        print LOG "\n" if $needs_newline++;
-        print LOG $_;
+        print $log "\n" if $needs_newline++;
+        print $log $_;
     } else {
-        print LOG " $_";
+        print $log " $_";
     }
 }
-print LOG "\n";
+print $log "\n";
 
 1 while $_ = <STDIN>;
 
diff --git a/t/web/csrf.t b/t/web/csrf.t
index 9d95d06..60653b5 100644
--- a/t/web/csrf.t
+++ b/t/web/csrf.t
@@ -135,10 +135,10 @@ $m->form_name('TicketCreate');
 $m->field('Subject', 'Attachments test');
 
 my $logofile = "$RT::StaticPath/images/bpslogo.png";
-open LOGO, "<", $logofile or die "Can't open logo file: $!";
-binmode LOGO;
-my $logo_contents = do {local $/; <LOGO>};
-close LOGO;
+open my $fh, "<", $logofile or die "Can't open logo file: $!";
+binmode $fh;
+my $logo_contents = do {local $/; <$fh>};
+close $fh or die "Failed to read logo: $!";
 $m->field('Attach',  $logofile);
 
 # Lose the referer before the POST

commit 4f81ef645c35c63387fdeb0963a1ab7190ca22a3
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Jun 29 16:01:56 2011 -0400

    Use explicit glob() function, instead of <*>

diff --git a/devel/tools/change-loc-msgstr b/devel/tools/change-loc-msgstr
index 85780de..8fdad38 100755
--- a/devel/tools/change-loc-msgstr
+++ b/devel/tools/change-loc-msgstr
@@ -59,10 +59,10 @@ my $msgid_regex   = qr#$msgid_pattern#o;
 my $code_str  = shift;
 
 @ARGV = (
-    <share/po/*.po>,
-    <share/po/*.pot>,
-    <po/*.po>,
-    <po/*.pot>
+    glob("share/po/*.po"),
+    glob("share/po/*.pot"),
+    glob("po/*.po"),
+    glob("po/*.pot"),
 ) unless @ARGV;
 
 my @files = @ARGV;
diff --git a/devel/tools/extract-message-catalog b/devel/tools/extract-message-catalog
index 2f4b178..f61008a 100755
--- a/devel/tools/extract-message-catalog
+++ b/devel/tools/extract-message-catalog
@@ -61,7 +61,11 @@ use Locale::PO;
 $| = 1;
 
 # po dir is for extensions
- at ARGV = (<share/po/*.po>, <share/po/*.pot>, <po/*.po>, <po/*.pot>) unless @ARGV;
+ at ARGV = (glob("share/po/*.po"),
+         glob("share/po/*.pot"),
+         glob("po/*.po"),
+         glob("po/*.pot"),
+     ) unless @ARGV;
 
 our %FILECAT;
 
diff --git a/devel/tools/rt-message-catalog b/devel/tools/rt-message-catalog
index f1a3158..917c7d3 100755
--- a/devel/tools/rt-message-catalog
+++ b/devel/tools/rt-message-catalog
@@ -98,7 +98,7 @@ sub stats {
     my $max = 0;
     my %res = ();
 
-    foreach my $po_file (<$dir/*.po>) {
+    foreach my $po_file (glob("$dir/*.po")) {
         my $array = Locale::PO->load_file_asarray( $po_file, "utf-8" );
 
         $res{$po_file} = 0;
@@ -125,7 +125,7 @@ sub stats {
 sub clean {
     my $dir = shift || PO_DIR;
 
-    foreach my $po_file (<$dir/*.po>) {
+    foreach my $po_file (glob("$dir/*.po")) {
         my $array = Locale::PO->load_file_asarray( $po_file, "utf-8" );
         foreach my $entry ( splice @$array, 1 ) {
             # Replace identical translations with the empty string
@@ -165,7 +165,7 @@ sub rosetta {
         die "Is not URL or directory: '$url'";
     }
 
-    my @files = ( <$dir/*/*/*.po>, <$dir/*/*.po>, <$dir/*.po> );
+    my @files = ( glob("$dir/*/*/*.po"), glob("$dir/*/*.po"), glob("$dir/*.po") );
     unless ( @files ) {
         print STDERR "No files in $dir/rt/*.po and $dir/*.po\n";
         exit;
diff --git a/devel/tools/rt-static-docs b/devel/tools/rt-static-docs
index 93362e4..c77e375 100755
--- a/devel/tools/rt-static-docs
+++ b/devel/tools/rt-static-docs
@@ -87,7 +87,7 @@ if (($opts{source} || '') =~ /\.tar\.gz$/ and -f $opts{source}) {
     $tmpdir = File::Temp->newdir();
 
     system("tar", "xzpf", $opts{source}, "-C", $tmpdir);
-    $opts{source} = first { -d $_ } <$tmpdir/*>;
+    $opts{source} = first { -d $_ } glob("$tmpdir/*");
 
     die "Can't find directory to chdir into after unpacking tarball"
         unless $opts{source};
@@ -142,7 +142,7 @@ else {
 
 # Manually "convert" README* and 3.8-era UPGRADING* to HTML and push them into
 # the known contents.
-for my $file (<README* UPGRADING*>) {
+for my $file (glob("README*"), glob("UPGRADING*")) {
     (my $name = $file) =~ s{^.+/}{};
     my $dest = "$opts{to}/$name.html";
 
diff --git a/t/pod.t b/t/pod.t
index 1283cfe..ad69e47 100644
--- a/t/pod.t
+++ b/t/pod.t
@@ -5,6 +5,6 @@ use Test::More;
 use Test::Pod;
 all_pod_files_ok(
     all_pod_files("lib","devel","docs","etc","bin","sbin"),
-    <docs/UPGRADING*>,
-    <devel/docs/UPGRADING*>,
+    glob("docs/UPGRADING*"),
+    glob("devel/docs/UPGRADING*"),
 );

commit 704acd026ae6f563f952810b6c651767170b8b1f
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Jun 29 16:26:28 2011 -0400

    Don't modify $_ in map and grep

diff --git a/lib/RT/Action/NotifyGroup.pm b/lib/RT/Action/NotifyGroup.pm
index 5646d7e..4178f9a 100644
--- a/lib/RT/Action/NotifyGroup.pm
+++ b/lib/RT/Action/NotifyGroup.pm
@@ -178,7 +178,12 @@ sub __HandleGroupArgument {
 }
 
 sub __SplitArg {
-    return grep length, map {s/^\s+//; s/\s+$//; $_} split /,/, $_[1];
+    return grep length, map {
+        my $arg = $_;
+        $arg =~ s/^\s+//;
+        $arg =~ s/\s+$//;
+        $arg;
+    } split /,/, $_[1];
 }
 
 sub __PushUserAddress {
diff --git a/lib/RT/Condition/StatusChange.pm b/lib/RT/Condition/StatusChange.pm
index f665e45..4849ba4 100644
--- a/lib/RT/Condition/StatusChange.pm
+++ b/lib/RT/Condition/StatusChange.pm
@@ -123,7 +123,7 @@ sub IsApplicable {
         return 0 unless grep lc($new) eq lc($_),
             map {m/^(initial|active|inactive)$/i? $lifecycle->Valid(lc $_): $_ }
             grep defined && length,
-            map { s/^\s+//; s/\s+$//; $_ }
+            map { my $v = $_; $v =~ s/^\s+//; $v =~ s/\s+$//; $v }
             split /,/, $new_must_be;
     }
     if ( $old_must_be ) {
@@ -131,7 +131,7 @@ sub IsApplicable {
         return 0 unless grep $old eq lc($_),
             map {m/^(initial|active|inactive)$/i? $lifecycle->Valid(lc $_): $_ }
             grep defined && length,
-            map { s/^\s+//; s/\s+$//; $_ }
+            map { my $v = $_; $v =~ s/^\s+//; $v =~ s/\s+$//; $v }
             split /,/, $old_must_be;
     }
     return 1;
diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index 3a0c16b..7a411c0 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -1119,7 +1119,7 @@ sub _LoadConfig {
         };
         local *Plugin = sub {
             my (@new_plugins) = @_;
-            @new_plugins = map {s/-/::/g if not /:/; $_} @new_plugins;
+            s/-/::/g for grep {not /:/} @new_plugins;
             my ( $pack, $file, $line ) = caller;
             return $self->SetFromConfig(
                 Option     => \@RT::Plugins,
@@ -1216,7 +1216,7 @@ sub Configs {
         my @files = glob $mask;
         @files = grep !/^RT_Config\.pm$/,
             grep $_ && /^\w+_Config\.pm$/,
-            map { s/^.*[\\\/]//; $_ } @files;
+            map { m/^.*[\\\/](.*)/ ? $1 : $_ } @files;
         push @configs, sort @files;
     }
 
diff --git a/lib/RT/Crypt/SMIME.pm b/lib/RT/Crypt/SMIME.pm
index a676d8b..f108b24 100644
--- a/lib/RT/Crypt/SMIME.pm
+++ b/lib/RT/Crypt/SMIME.pm
@@ -653,7 +653,9 @@ sub ParseStatus {
     my @status = split /\s*(?:\[SMIME:\]\s*){2}/, $status;
     foreach my $block ( grep length, @status ) {
         chomp $block;
-        $block = { map { s/^\s+//; s/\s+$//; $_ } map split(/:/, $_, 2), split /\s*\[SMIME:\]/, $block };
+        $block = { map { my $v = $_; $v =~ s/^\s+//; $v =~ s/\s+$//; $v }
+                   map split(/:/, $_, 2),
+                   split /\s*\[SMIME:\]/, $block };
     }
     foreach my $block ( grep $_->{'EncryptedTo'}, @status ) {
         $block->{'EncryptedTo'} = [{
diff --git a/lib/RT/CustomField.pm b/lib/RT/CustomField.pm
index d84ba01..777d1a9 100644
--- a/lib/RT/CustomField.pm
+++ b/lib/RT/CustomField.pm
@@ -1258,7 +1258,7 @@ sub FriendlyLookupType {
     return ($self->loc( $FRIENDLY_LOOKUP_TYPES{$lookup} ))
         if defined $FRIENDLY_LOOKUP_TYPES{$lookup};
 
-    my @types = map { s/^RT::// ? $self->loc($_) : $_ }
+    my @types = map { m/^RT::(.*)/ ? $self->loc($1) : $_ }
       grep { defined and length }
       split( /-/, $lookup )
       or return;
diff --git a/lib/RT/Graph/Tickets.pm b/lib/RT/Graph/Tickets.pm
index 6fc5310..4a58a03 100644
--- a/lib/RT/Graph/Tickets.pm
+++ b/lib/RT/Graph/Tickets.pm
@@ -229,7 +229,7 @@ sub AddTicket {
     my @fields = $self->_PropertiesToFields( %args );
     if ( @fields ) {
         unshift @fields, $args{'Ticket'}->id;
-        my $label = join ' | ', map { s/(?=[{}|><])/\\/g; $_ } @fields;
+        my $label = join ' | ', map { my $f = $_; $f =~ s/(?=[{}|><])/\\/g; $f } @fields;
         $label = "{ $label }" if ($args{'Direction'} || 'TB') =~ /^(?:TB|BT)$/;
         $node_style{'label'} = gv_escape( $label );
         $node_style{'shape'} = 'record';
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 49fb1c9..9dbf1e7 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -3298,10 +3298,11 @@ sub _NormalizeObjectCustomFieldValue {
             if defined $args{'Value'};
     }
     @values = grep length, map {
-        s/\r+\n/\n/g;
-        s/^\s+//;
-        s/\s+$//;
-        $_;
+        my $value = $_;
+        $value =~ s/\r+\n/\n/g;
+        $value =~ s/^\s+//;
+        $value =~ s/\s+$//;
+        $value;
         }
         grep defined, @values;
 
diff --git a/lib/RT/Migrate/Importer/File.pm b/lib/RT/Migrate/Importer/File.pm
index 176bc26..1f5f36c 100644
--- a/lib/RT/Migrate/Importer/File.pm
+++ b/lib/RT/Migrate/Importer/File.pm
@@ -85,7 +85,7 @@ sub Import {
     my $dir = $self->{Directory};
 
     if ($self->{Metadata} and $self->{Metadata}{Files}) {
-        $self->{Files} = [ map {s|^.*/|$dir/|;$_} @{$self->{Metadata}{Files}} ];
+        $self->{Files} = [ map {my $v = $_; $v =~ s|^.*/|$dir/|;$v} @{$self->{Metadata}{Files}} ];
     } else {
         $self->{Files} = [ <$dir/*.dat> ];
     }
diff --git a/lib/RT/Search/Simple.pm b/lib/RT/Search/Simple.pm
index 4cb2482..93219fa 100644
--- a/lib/RT/Search/Simple.pm
+++ b/lib/RT/Search/Simple.pm
@@ -188,7 +188,7 @@ sub Finalize {
     # limits ourselves, and we're not limited by id
     if (not $limits->{status} and not $limits->{id}
         and RT::Config->Get('OnlySearchActiveTicketsInSimpleSearch', $self->TicketsObj->CurrentUser)) {
-        $limits->{status} = [map {s/(['\\])/\\$1/g; "Status = '$_'"} RT::Queue->ActiveStatusArray()];
+        $limits->{status} = [map {my $v = $_; $v =~ s/(['\\])/\\$1/g; "Status = '$v'"} RT::Queue->ActiveStatusArray()];
     }
 
     # Respect the "only search these queues" limit if we didn't
@@ -256,9 +256,9 @@ sub HandleContent   { return content   => "Content LIKE '$_[1]'"; }
 sub HandleId        { $_[1] =~ s/^#//; return id => "Id = $_[1]"; }
 sub HandleStatus    {
     if ($_[1] =~ /^active$/i and !$_[2]) {
-        return status => map {s/(['\\])/\\$1/g; "Status = '$_'"} RT::Queue->ActiveStatusArray();
+        return status => map {my $v = $_; $v =~ s/(['\\])/\\$1/g; "Status = '$v'"} RT::Queue->ActiveStatusArray();
     } elsif ($_[1] =~ /^inactive$/i and !$_[2]) {
-        return status => map {s/(['\\])/\\$1/g; "Status = '$_'"} RT::Queue->InactiveStatusArray();
+        return status => map {my $v = $_; $v =~ s/(['\\])/\\$1/g; "Status = '$v'"} RT::Queue->InactiveStatusArray();
     } elsif ($_[1] =~ /^any$/i and !$_[2]) {
         return 'status';
     } else {
diff --git a/lib/RT/Test/Apache.pm b/lib/RT/Test/Apache.pm
index 29f5ed1..c944260 100644
--- a/lib/RT/Test/Apache.pm
+++ b/lib/RT/Test/Apache.pm
@@ -202,7 +202,7 @@ sub apache_server_info {
     %res = (%res, %opts);
 
     $res{'modules'} = [
-        map {s/^\s+//; s/\s+$//; $_}
+        map {my $mod = $_; $mod =~ s/^\s+//; $mod =~ s/\s+$//; $mod}
         grep $_ !~ /Compiled in modules/i,
         split /\r*\n/, `$bin -l`
     ];
diff --git a/lib/RT/Transaction.pm b/lib/RT/Transaction.pm
index d3a55ed..a75ff97 100644
--- a/lib/RT/Transaction.pm
+++ b/lib/RT/Transaction.pm
@@ -822,13 +822,18 @@ sub BriefDescriptionAsHTML {
 
 sub _ProcessReturnValues {
     my $self   = shift;
-    my @values = @_;
-    return map {
-        if    (ref eq 'ARRAY')  { $_ = join "", $self->_ProcessReturnValues(@$_) }
-        elsif (ref eq 'SCALAR') { $_ = $$_ }
-        else                    { RT::Interface::Web::EscapeHTML(\$_) }
-        $_
-    } @values;
+    my @values;
+    for my $v (@_) {
+        if      (ref($v) eq 'ARRAY')  {
+            push @values, join("", $self->_ProcessReturnValues(@$v));
+        } elsif (ref($v) eq 'SCALAR') {
+            push @values, $$v;
+        } else {
+            RT::Interface::Web::EscapeHTML(\$v);
+            push @values, $v;
+        }
+    }
+    return @values;
 }
 
 sub _FormatPrincipal {
diff --git a/t/99-policy.t b/t/99-policy.t
index 6bfff32..f7f800f 100644
--- a/t/99-policy.t
+++ b/t/99-policy.t
@@ -117,7 +117,7 @@ check( $_, shebang => 1, exec => 1, warnings => 1, strict => 1, bps_tag => 1, no
     for grep {m{^s?bin/}} @files;
 
 check( $_, compile_perl => 1, exec => 1 )
-    for grep { -f $_ } map { s/\.in$//; $_ } grep {m{^s?bin/}} @files;
+    for grep { -f $_ } map { my $v = $_; $v =~ s/\.in$//; $v } grep {m{^s?bin/}} @files;
 
 check( $_, shebang => 1, exec => 1, warnings => 1, strict => 1, bps_tag => 1, no_tabs => 1 )
     for grep {m{^devel/tools/} and not m{/(localhost\.(crt|key)|mime\.types)$}} @files;
@@ -147,7 +147,7 @@ check( $_, shebang => 1, exec => 1, warnings => 1, strict => 1, bps_tag => 1, no
     for grep {m{^etc/upgrade/[^/]+$}} @files;
 
 check( $_, compile_perl => 1, exec => 1 )
-    for grep{ -f $_} map {s/\.in$//; $_} grep {m{^etc/upgrade/[^/]+$}} @files;
+    for grep{ -f $_} map {my $v = $_; $v =~ s/\.in$//; $v} grep {m{^etc/upgrade/[^/]+$}} @files;
 
 check( $_, exec => -1 )
     for grep {m{^(devel/)?docs/}} @files;

commit 0f6c52a68f948a2778b95e98775216440bafc666
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Jun 29 16:53:43 2011 -0400

    Switch from a string eval to using UNIVERSAL::require

diff --git a/lib/RT/URI.pm b/lib/RT/URI.pm
index 30a096d..8b3a1ba 100644
--- a/lib/RT/URI.pm
+++ b/lib/RT/URI.pm
@@ -188,22 +188,10 @@ sub _GetResolver {
     my $scheme = shift;
 
     $scheme =~ s/(\.|-)/_/g;
-    my $resolver;
-
-    
-    eval " 
-        require RT::URI::$scheme;
-        \$resolver = RT::URI::$scheme->new(\$self->CurrentUser);
-    ";
-     
-    if ($resolver) {
-        $self->{'resolver'} = $resolver;
-    } else {
-        RT->Logger->warning("Failed to create new resolver object for scheme '$scheme': $@")
-            if $@ !~ m{Can't locate RT/URI/\Q$scheme\E};
-        $self->{'resolver'} = RT::URI::base->new($self->CurrentUser); 
-    }
+    my $class = "RT::URI::$scheme";
 
+    $class = "RT::URI::base" unless $class->require;
+    $self->{'resolver'} = $class->new($self->CurrentUser);
 }
 
 

commit 5d632a8a697db218897bca4c7ba3cbea74deffe6
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Apr 9 16:58:41 2015 -0700

    Remove an unnecessary use of string eval

diff --git a/bin/rt.in b/bin/rt.in
index ee60033..44b9980 100644
--- a/bin/rt.in
+++ b/bin/rt.in
@@ -1493,7 +1493,7 @@ sub whine {
 }
 
 sub read_passwd {
-    eval 'require Term::ReadKey';
+    eval { require Term::ReadKey };
     if ($@) {
         die "No password specified (and Term::ReadKey not installed).\n";
     }

commit b5c263eba7dfababbb38eb10845ac78996af98d4
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Apr 9 17:02:04 2015 -0700

    Mark all of the explicitly-allowed string evals

diff --git a/devel/tools/change-loc-msgstr b/devel/tools/change-loc-msgstr
index 8fdad38..6df0792 100755
--- a/devel/tools/change-loc-msgstr
+++ b/devel/tools/change-loc-msgstr
@@ -79,7 +79,7 @@ for my $file (@files) {
         }
         elsif ($mark_to_change) {
             # we're at the line after the msgid in question
-            eval $code_str;
+            eval $code_str;  ## no critic
             $mark_to_change = 0;
         }
         print $fh_out $_;
diff --git a/devel/tools/rt-attributes-editor b/devel/tools/rt-attributes-editor
index cc69a02..75513b6 100755
--- a/devel/tools/rt-attributes-editor
+++ b/devel/tools/rt-attributes-editor
@@ -87,7 +87,7 @@ if ($edit ne $orig) {
         print "Attribute key saved.\n";
     }
     else {
-        my $VAR1; eval $edit;
+        my $VAR1; eval $edit; ## no critic
         if ($@) {
             print STDERR "Your change had an error: $@";
             exit 1;
diff --git a/lib/RT/Action/UserDefined.pm b/lib/RT/Action/UserDefined.pm
index 2b8d9b7..52b619a 100644
--- a/lib/RT/Action/UserDefined.pm
+++ b/lib/RT/Action/UserDefined.pm
@@ -60,7 +60,7 @@ This happens on every transaction. it's always applicable
 
 sub Prepare {
     my $self = shift;
-    my $retval = eval $self->ScripObj->CustomPrepareCode;
+    my $retval = eval $self->ScripObj->CustomPrepareCode; ## no critic
     if ($@) {
         $RT::Logger->error("Scrip ".$self->ScripObj->Id. " Prepare failed: ".$@);
         return (undef);
@@ -76,7 +76,7 @@ This happens on every transaction. it's always applicable
 
 sub Commit {
     my $self = shift;
-    my $retval = eval $self->ScripObj->CustomCommitCode;
+    my $retval = eval $self->ScripObj->CustomCommitCode; ## no critic
     if ($@) {
         $RT::Logger->error("Scrip ".$self->ScripObj->Id. " Commit failed: ".$@);
         return (undef);
diff --git a/lib/RT/Condition/UserDefined.pm b/lib/RT/Condition/UserDefined.pm
index 7d58eb0..54a543a 100644
--- a/lib/RT/Condition/UserDefined.pm
+++ b/lib/RT/Condition/UserDefined.pm
@@ -61,7 +61,7 @@ This happens on every transaction. it's always applicable
 sub IsApplicable {
     my $self = shift;
     local $@;
-    my $retval = eval $self->ScripObj->CustomIsApplicableCode;
+    my $retval = eval $self->ScripObj->CustomIsApplicableCode; ## no critic
     if ($@) {
         $RT::Logger->error("Scrip ".$self->ScripObj->Id. " IsApplicable failed: ".$@);
         return (undef);
diff --git a/lib/RT/Scrip.pm b/lib/RT/Scrip.pm
index 5bd86e0..47a563c 100644
--- a/lib/RT/Scrip.pm
+++ b/lib/RT/Scrip.pm
@@ -778,7 +778,7 @@ sub CompileCheck {
 
         do {
             no strict 'vars';
-            eval "sub { $code \n }";
+            eval "sub { $code \n }";  ## no critic
         };
         next if !$@;
 
diff --git a/lib/RT/Template.pm b/lib/RT/Template.pm
index 4b55443..1c59a40 100644
--- a/lib/RT/Template.pm
+++ b/lib/RT/Template.pm
@@ -816,7 +816,7 @@ sub CompileCheck {
 
         do {
             no strict 'vars';
-            eval "sub { $fi_text }";
+            eval "sub { $fi_text }"; ## no critic
         };
         next if !$@;
 
diff --git a/sbin/rt-setup-database.in b/sbin/rt-setup-database.in
index 339912f..bf99946 100644
--- a/sbin/rt-setup-database.in
+++ b/sbin/rt-setup-database.in
@@ -387,7 +387,7 @@ sub action_insert {
 
     for my $file (@{$args{backcompat} || []}) {
         my $lines = do {local $/; local @ARGV = ($file); <>};
-        my $sub = eval "sub {\n# line 1 $file\n$lines\n}";
+        my $sub = eval "sub {\n# line 1 $file\n$lines\n}"; ## no critic
         unless ($sub) {
             warn "Failed to load backcompat $file: $@";
             next;
diff --git a/sbin/rt-test-dependencies.in b/sbin/rt-test-dependencies.in
index 363177b..31bdf69 100644
--- a/sbin/rt-test-dependencies.in
+++ b/sbin/rt-test-dependencies.in
@@ -459,7 +459,7 @@ sub test_dep {
     }
     else {
         no warnings 'deprecated';
-        eval "{ local \$ENV{__WARN__}; use $module $version () }";
+        eval "{ local \$ENV{__WARN__}; use $module $version () }"; ## no critic
         if ( my $error = $@ ) {
             return 0 unless wantarray;
 

commit 3184ae8759c0a913b19b2d2cd90d213ca32a9b1b
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Jun 29 17:32:59 2011 -0400

    Ensure that all loop variables are properly localized

diff --git a/bin/rt.in b/bin/rt.in
index 44b9980..1f3d017 100644
--- a/bin/rt.in
+++ b/bin/rt.in
@@ -209,10 +209,10 @@ sub help {
     if (!%help) {
         local $/ = undef;
         foreach my $item (@{ Form::parse(<DATA>) }) {
-            my $title = $item->[2]{Title};
-            my @titles = ref $title eq 'ARRAY' ? @$title : $title;
+            my $titleref = $item->[2]{Title};
+            my @titles = ref $titleref eq 'ARRAY' ? @$titleref : $titleref;
 
-            foreach $title (grep $_, @titles) {
+            foreach my $title (grep $_, @titles) {
                 $help{$title} = $item->[2]{Text};
             }
         }
@@ -607,7 +607,6 @@ sub edit {
 
             foreach my $form (@$forms) {
                 my ($c, $o, $k, $e) = @$form;
-                my ($key, $val);
 
                 next if ($e || !@$o);
 
@@ -616,14 +615,14 @@ sub edit {
                 local %set = %set;
 
                 # Make changes to existing fields.
-                foreach $key (@$o) {
+                foreach my $key (@$o) {
                     if (exists $add{lc $key}) {
-                        $val = delete $add{lc $key};
+                        my $val = delete $add{lc $key};
                         vpush($k, $key, $val);
                         $k->{$key} = vsplit($k->{$key}) if $val =~ /[,\n]/;
                     }
                     if (exists $del{lc $key}) {
-                        $val = delete $del{lc $key};
+                        my $val = delete $del{lc $key};
                         my %val = map {$_=>1} @{ vsplit($val) };
                         $k->{$key} = vsplit($k->{$key});
                         @{$k->{$key}} = grep {!exists $val{$_}} @{$k->{$key}};
@@ -634,8 +633,8 @@ sub edit {
                 }
                 
                 # Then update the others.
-                foreach $key (keys %set) { vpush($k, $key, $set{$key}) }
-                foreach $key (keys %add) {
+                foreach my $key (keys %set) { vpush($k, $key, $set{$key}) }
+                foreach my $key (keys %add) {
                     vpush($k, $key, $add{$key});
                     $k->{$key} = vsplit($k->{$key});
                 }
@@ -1357,13 +1356,13 @@ sub Form::compose {
 
             foreach my $key (@$o) {
                 my ($line, $sp);
-                my $v = $k->{$key};
-                my @values = ref $v eq 'ARRAY' ? @$v : $v;
+                my $vref = $k->{$key};
+                my @values = ref $vref eq 'ARRAY' ? @$vref : $vref;
 
                 $sp = " "x(length("$key: "));
                 $sp = " "x4 if length($sp) > 16;
 
-                foreach $v (@values) {
+                foreach my $v (@values) {
                     if ($v =~ /\n/) {
                         $v =~ s/^/$sp/gm;
                         $v =~ s/^$sp//;

commit f823433f19412d518f021dbebfb1727ec0098af2
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 4a58a03..fc92510 100644
--- a/lib/RT/Graph/Tickets.pm
+++ b/lib/RT/Graph/Tickets.pm
@@ -98,7 +98,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;
@@ -344,7 +344,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/Test.pm b/lib/RT/Test.pm
index 7392222..b23513d 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -213,7 +213,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 16432a3..ea3ca7e 100644
--- a/sbin/rt-validator.in
+++ b/sbin/rt-validator.in
@@ -185,7 +185,7 @@ my %describe_cb;
 );
 
 { my %cache = ();
-sub m2t($) {
+sub m2t {
     my $model = shift;
     return $cache{$model} if $cache{$model};
     my $class = "RT::$model";
diff --git a/t/api/menu.t b/t/api/menu.t
index a9cda69..af1ab99 100644
--- a/t/api/menu.t
+++ b/t/api/menu.t
@@ -4,7 +4,7 @@ use warnings;
 use RT::Test tests => undef;
 use RT::Interface::Web::Menu;
 
-sub child_path_is($$$) {
+sub child_path_is {
     my ($menu, $child, $expected) = @_;
     my $c = $menu->child($child->[0], path => $child->[1]);
     is $c->path, $expected, "'$child->[1]' normalizes to '$expected'";
@@ -48,7 +48,7 @@ my $home =
 
 
 
-sub order_ok($$;$) {
+sub order_ok {
     my ($menu, $expected, $name) = @_;
     my @children = $menu->children;
 

commit c38b5b3a81da66ea7deee64ce355a782be381326
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Apr 9 17:09:16 2015 -0700

    Subroutine prototypes that start with & are of use; allow them

diff --git a/lib/RT/Test/Email.pm b/lib/RT/Test/Email.pm
index 77431fd..f8455aa 100644
--- a/lib/RT/Test/Email.pm
+++ b/lib/RT/Test/Email.pm
@@ -85,7 +85,7 @@ notification generated during the block or the test.
 
 =cut
 
-sub mail_ok (&@) {
+sub mail_ok (&@) { ## no critic
     my $code = shift;
 
     $code->();
diff --git a/lib/RT/Util.pm b/lib/RT/Util.pm
index aa02b04..524df92 100644
--- a/lib/RT/Util.pm
+++ b/lib/RT/Util.pm
@@ -54,7 +54,7 @@ use warnings;
 use base 'Exporter';
 our @EXPORT = qw/safe_run_child mime_recommended_filename/;
 
-sub safe_run_child (&) {
+sub safe_run_child (&) { ## no critic
     my $our_pid = $$;
 
     # situation here is wierd, running external app

commit 84247aa5f4aab5cf718fbbd1e076b1fcc0871d32
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Apr 9 17:10:01 2015 -0700

    cmp_version is ($$) so it can be used directly by sort()

diff --git a/lib/RT/Handle.pm b/lib/RT/Handle.pm
index e11a2a0..29a65df 100644
--- a/lib/RT/Handle.pm
+++ b/lib/RT/Handle.pm
@@ -638,7 +638,7 @@ sub GetVersionFile {
     rc    => -1,
     head  => 9999,
 );
-sub cmp_version($$) {
+sub cmp_version($$) {  ## no critic
     my ($a, $b) = (@_);
     my @a = grep defined, map { /^[0-9]+$/? $_ : /^[a-zA-Z]+$/? $word{$_}|| -10 : undef }
         split /([^0-9]+)/, $a;
diff --git a/lib/RT/Migrate/Serializer.pm b/lib/RT/Migrate/Serializer.pm
index 92be629..a2e55f8 100644
--- a/lib/RT/Migrate/Serializer.pm
+++ b/lib/RT/Migrate/Serializer.pm
@@ -54,7 +54,6 @@ use warnings;
 use base 'RT::DependencyWalker';
 
 use Storable qw//;
-sub cmp_version($$) { RT::Handle::cmp_version($_[0],$_[1]) };
 use RT::Migrate::Incremental;
 use RT::Migrate::Serializer::IncrementalRecord;
 use RT::Migrate::Serializer::IncrementalRecords;
@@ -111,7 +110,7 @@ sub Metadata {
 
     # Determine the highest upgrade step that we run
     my @versions = ($RT::VERSION, keys %RT::Migrate::Incremental::UPGRADES);
-    my ($max) = reverse sort cmp_version @versions;
+    my ($max) = reverse sort RT::Handle::cmp_version @versions;
     # we don't want to run upgrades to 4.2.x if we're running
     # the serializier on an 4.0 instance.
     $max = $RT::VERSION unless $self->{Incremental};
@@ -305,10 +304,10 @@ sub InitStream {
     Storable::nstore_fd( $meta, $self->{Filehandle} );
     die "Failed to write metadata: $!" if $!;
 
-    return unless cmp_version($meta->{VersionFrom}, $meta->{Version}) < 0;
+    return unless RT::Handle::cmp_version($meta->{VersionFrom}, $meta->{Version}) < 0;
 
     my %transforms;
-    for my $v (sort cmp_version keys %RT::Migrate::Incremental::UPGRADES) {
+    for my $v (sort RT::Handle::cmp_version keys %RT::Migrate::Incremental::UPGRADES) {
         for my $ref (keys %{$RT::Migrate::Incremental::UPGRADES{$v}}) {
             push @{$transforms{$ref}}, $RT::Migrate::Incremental::UPGRADES{$v}{$ref};
         }

commit 0c54b977702698b3dda02dd7283fa1bd1c055699
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Jun 30 14:23:15 2011 -0400

    Replace several uses of stash plundering with $package->can($method)

diff --git a/lib/RT/Interface/Email.pm b/lib/RT/Interface/Email.pm
index 426bd69..6864d40 100644
--- a/lib/RT/Interface/Email.pm
+++ b/lib/RT/Interface/Email.pm
@@ -1230,8 +1230,7 @@ sub _LoadPlugins {
             $Class->require or
                 do { $RT::Logger->error("Couldn't load $Class: $@"); next };
 
-            no strict 'refs';
-            unless ( defined *{ $Class . "::GetCurrentUser" }{CODE} ) {
+            unless ( $Class->can("GetCurrentUser") ) {
                 $RT::Logger->crit( "No GetCurrentUser code found in $Class module");
                 next;
             }
@@ -1300,10 +1299,7 @@ sub Gateway {
     my %skip_plugin;
     foreach my $class( grep !ref, @mail_plugins ) {
         # check if we should apply filter before decoding
-        my $check_cb = do {
-            no strict 'refs';
-            *{ $class . "::ApplyBeforeDecode" }{CODE};
-        };
+        my $check_cb = $class->can("ApplyBeforeDecode");
         next unless defined $check_cb;
         next unless $check_cb->(
             Message       => $Message,
@@ -1314,10 +1310,7 @@ sub Gateway {
 
         $skip_plugin{ $class }++;
 
-        my $Code = do {
-            no strict 'refs';
-            *{ $class . "::GetCurrentUser" }{CODE};
-        };
+        my $Code = $class->can("GetCurrentUser");
         my ($status, $msg) = $Code->(
             Message       => $Message,
             RawMessageRef => \$args{'message'},
@@ -1567,8 +1560,7 @@ sub GetAuthenticationLevel {
         if ( ref($_) eq "CODE" ) {
             $Code = $_;
         } else {
-            no strict 'refs';
-            $Code = *{ $_ . "::GetCurrentUser" }{CODE};
+            $Code = $_->can("GetCurrentUser");
         }
 
         foreach my $action (@{ $args{Actions} }) {
diff --git a/sbin/rt-setup-database.in b/sbin/rt-setup-database.in
index bf99946..cd01ae3 100644
--- a/sbin/rt-setup-database.in
+++ b/sbin/rt-setup-database.in
@@ -206,8 +206,7 @@ if ($args{'package'} ne 'RT') {
 }
 
 foreach my $action ( @actions ) {
-    no strict 'refs';
-    my ($status, $msg) = *{ 'action_'. $action }{'CODE'}->( %args );
+    my ($status, $msg) = main->can( 'action_' . $action )->( %args );
     error($action, $msg) unless $status;
     print $msg .".\n" if $msg;
     print "Done.\n";

commit 4e1225e1d02b61a6b2aa593142ccd0a90f0e258e
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Jun 30 16:26:49 2011 -0400

    We are unable to add "use strict" because of the package vars, but we can at least enable warnings

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 7ece63f..89571fa 100644
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -5,6 +5,7 @@
 #
 
 package RT;
+use warnings;
 
 #############################  WARNING  #############################
 #                                                                   #

commit 7c0dd20120b750eb2e881352a6a658d12e6309eb
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu Jun 30 18:04:58 2011 -0400

    Remove unreachable code after unconditional return statements

diff --git a/lib/RT.pm b/lib/RT.pm
index 4147992..7b2a178 100644
--- a/lib/RT.pm
+++ b/lib/RT.pm
@@ -302,17 +302,6 @@ sub InitLogging {
             require Devel::StackTrace;
             my $trace = Devel::StackTrace->new( ignore_class => [ 'Log::Dispatch', 'Log::Dispatch::Base' ] );
             return $p{'message'} . $trace->as_string;
-
-            # skip calling of the Log::* subroutins
-            my $frame = 0;
-            $frame++ while caller($frame) && caller($frame) =~ /^Log::/;
-            $frame++ while caller($frame) && (caller($frame))[3] =~ /^Log::/;
-
-            $p{'message'} .= "\nStack trace:\n";
-            while( my ($package, $filename, $line, $sub) = caller($frame++) ) {
-                $p{'message'} .= "\t$sub(...) called at $filename:$line\n";
-            }
-            return $p{'message'};
         };
 
         if ( $Config->Get('LogToFile') ) {
diff --git a/lib/RT/Approval/Rule/NewPending.pm b/lib/RT/Approval/Rule/NewPending.pm
index 4195565..cb67f73 100644
--- a/lib/RT/Approval/Rule/NewPending.pm
+++ b/lib/RT/Approval/Rule/NewPending.pm
@@ -78,20 +78,6 @@ sub Commit {
     $self->RunScripAction('Notify Owner and AdminCcs', 'New Pending Approval', @_);
 
     return;
-
-    # this generates more correct content of the message, but not sure
-    # if ccmessageto is the right way to do this.
-    my $template = $self->GetTemplate('New Pending Approval',
-                                      TicketObj => $top,
-                                      TransactionObj => $to)
-        or return;
-
-    my ( $result, $msg ) = $template->Parse(
-        TicketObj => $top,
-    );
-    $self->TicketObj->Comment( CcMessageTo => $self->TicketObj->OwnerObj->EmailAddress,
-                               MIMEObj => $template->MIMEObj );
-
 }
 
 RT::Base->_ImportOverlays();

commit 004cc7aa9f26a9c44f9e77dcac1f1a1a296de518
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Jun 30 17:02:59 2011 -0400

    Fix "my $x = ... if ..." traps

diff --git a/bin/rt.in b/bin/rt.in
index 1f3d017..1fa01c1 100644
--- a/bin/rt.in
+++ b/bin/rt.in
@@ -1260,7 +1260,7 @@ sub submit {
 sub Form::parse {
     my $state = 0;
     my @forms = ();
-    my @lines = split /\n/, $_[0] if $_[0];
+    my @lines = $_[0] ? (split /\n/, $_[0]) : ();
     my ($c, $o, $k, $e) = ("", [], {}, "");
 
     LINE:
diff --git a/t/articles/upload-customfields.t b/t/articles/upload-customfields.t
index 29bd677..80cc36e 100644
--- a/t/articles/upload-customfields.t
+++ b/t/articles/upload-customfields.t
@@ -81,7 +81,7 @@ $m->submit_form(
 
 $m->content_like(qr/Article \d+ created/, "an article was created succesfully");
 
-my $id = $1 if $m->content =~ /Article (\d+) created/;
+my ($id) = $m->content =~ /Article (\d+) created/;
 
 $m->title_like(qr/Modify article #$id/, "Editing article $id");
 

commit 642740faaa45af0af383491ca383928a05340e06
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Aug 31 13:18:59 2012 -0400

    Remove a bit more indirect object notation

diff --git a/lib/RT/StyleGuide.pod b/lib/RT/StyleGuide.pod
index 3a75562..b10b970 100644
--- a/lib/RT/StyleGuide.pod
+++ b/lib/RT/StyleGuide.pod
@@ -426,7 +426,7 @@ An example:
         # this is my function!
         sub foo {
             my $val = shift;
-            my $obj = new Constructor;
+            my $obj = Constructor->new;
             my($var1, $var2);
 
             $obj->SetFoo($val);
diff --git a/t/00-mason-syntax.t b/t/00-mason-syntax.t
index e87840a..eb61f9c 100644
--- a/t/00-mason-syntax.t
+++ b/t/00-mason-syntax.t
@@ -26,7 +26,7 @@ sub compile_file {
 
     my $text = Encode::decode( "UTF-8", RT::Test->file_content($file));
 
-    my $compiler = new HTML::Mason::Compiler::ToObject;
+    my $compiler = HTML::Mason::Compiler::ToObject->new;
     $compiler->compile(
         comp_source => $text,
         name => 'my',
diff --git a/t/customfields/external.t b/t/customfields/external.t
index 4b84144..2348009 100644
--- a/t/customfields/external.t
+++ b/t/customfields/external.t
@@ -5,15 +5,10 @@ use strict;
 use RT;
 use RT::Test nodata => 1, tests => undef;
 
-sub new (*) {
-    my $class = shift;
-    return $class->new(RT->SystemUser);
-}
-
 use constant VALUES_CLASS => 'RT::CustomFieldValues::Groups';
 RT->Config->Set(CustomFieldValuesSources => VALUES_CLASS);
 
-my $q = new( RT::Queue );
+my $q = RT::Queue->new( RT->SystemUser );
 isa_ok( $q, 'RT::Queue' );
 my ($qid) = $q->Create( Name => "CF-External-". $$ );
 ok( $qid, "created queue" );
@@ -23,7 +18,7 @@ my %arg = ( Name        => $q->Name,
             MaxValues   => 1,
             ValuesClass => VALUES_CLASS );
 
-my $cf = new( RT::CustomField );
+my $cf = RT::CustomField->new( RT->SystemUser );
 isa_ok( $cf, 'RT::CustomField' );
 
 {
diff --git a/t/mail/crypt-gnupg.t b/t/mail/crypt-gnupg.t
index 567573e..a71f200 100644
--- a/t/mail/crypt-gnupg.t
+++ b/t/mail/crypt-gnupg.t
@@ -327,7 +327,7 @@ diag 'wrong signed/encrypted parts: wrong proto';
 diag 'verify inline and in attachment signatures';
 {
     open( my $fh, '<', "$homedir/signed_old_style_with_attachment.eml" ) or die $!;
-    my $parser = new MIME::Parser;
+    my $parser = MIME::Parser->new;
     my $entity = $parser->parse( $fh );
 
     my @parts = RT::Crypt->FindProtectedParts( Entity => $entity );
diff --git a/t/mail/gateway.t b/t/mail/gateway.t
index 5e74936..55a87ad 100644
--- a/t/mail/gateway.t
+++ b/t/mail/gateway.t
@@ -470,7 +470,7 @@ diag "Testing preservation of binary attachments";
     is ($acontent, $file, 'The attachment isn\'t screwed up in the database.');
 
     # Grab the binary attachment via the web ui
-    my $ua = new LWP::UserAgent;
+    my $ua = LWP::UserAgent->new;
     my $full_url = "$url/Ticket/Attachment/". $attachment->TransactionId
         ."/". $attachment->id. "/bpslogo.png?&user=root&pass=password";
     my $r = $ua->get( $full_url );

commit 0b4def19e425d1606773c2d5af6c07bb265f8d0c
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Fri Jul 1 11:32:49 2011 -0400

    Rename functions so they don't conflict with built-ins

diff --git a/bin/rt.in b/bin/rt.in
index 1fa01c1..584d3a6 100644
--- a/bin/rt.in
+++ b/bin/rt.in
@@ -132,7 +132,7 @@ my %handlers = (
     edit        => ["create", "edit", "new", "ed"],
     list        => ["search", "list", "ls"],
     comment     => ["comment", "correspond"],
-    link        => ["link", "ln"],
+    link_ticket => ["link", "ln"],
     merge       => ["merge"],
     grant       => ["grant", "revoke"],
     take        => ["take", "steal", "untake"],
@@ -920,7 +920,7 @@ sub merge {
 
 # Link one ticket to another.
 
-sub link {
+sub link_ticket {
     my ($bad, $del, %data) = (0, 0, ());
     my $type;
 
@@ -1487,6 +1487,7 @@ sub parse_config_file {
 sub whine {
     my $sub = (caller(1))[3];
     $sub =~ s/^main:://;
+    $sub =~ s/link_ticket/link/;
     warn "rt: $sub: @_\n";
     return 0;
 }
diff --git a/sbin/rt-email-group-admin.in b/sbin/rt-email-group-admin.in
index b7951f4..7d1ecb2 100644
--- a/sbin/rt-email-group-admin.in
+++ b/sbin/rt-email-group-admin.in
@@ -145,7 +145,7 @@ sub parse_args {
         $opts->{'name'} = $tmp;
     }
     elsif ( GetOptions( 'rename=s' => \$tmp ) && $tmp ) {
-        $cmd = 'rename';
+        $cmd = 'rename_action';
         $opts->{'name'} = $tmp;
         GetOptions( 'newname=s' => \$opts->{'newname'} );
         unless ( $opts->{'newname'} ) {
@@ -154,7 +154,7 @@ sub parse_args {
         }
     }
     elsif ( GetOptions( 'delete=s' => \$tmp ) && $tmp) {
-        $cmd = 'delete';
+        $cmd = 'delete_action';
         $opts->{'name'} = $tmp;
     } else {
         $cmd = 'usage';
@@ -382,7 +382,7 @@ Deletes action NAME if scrips doesn't use it.
 
 =cut
 
-sub delete {
+sub delete_action {
     my $action = _get_action_by_name( $opts->{'name'} );
     unless ( $action ) {
         print STDERR "ScripAction '". $opts->{'name'} ."' doesn't exist\n";
@@ -457,7 +457,7 @@ Renames action NAME to NEWNAME.
 
 =cut
 
-sub rename {
+sub rename_action {
     my $action = _get_action_by_name( $opts->{'name'} );
     unless ( $action ) {
         print STDERR "ScripAction '". $opts->{'name'} ."' doesn't exist\n";

commit f1f9efd957069903b4bf5b745a2bf73a04537572
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jul 5 16:11:36 2011 -0400

    Make all "no strict" usages be scoped to a single line

diff --git a/lib/RT/I18N.pm b/lib/RT/I18N.pm
index bad4eb4..c074c3f 100644
--- a/lib/RT/I18N.pm
+++ b/lib/RT/I18N.pm
@@ -124,13 +124,14 @@ sub Init {
 
 sub LoadLexicons {
 
-    no strict 'refs';
-    foreach my $k (keys %{RT::I18N::} ) {
+    my %package = do {no strict 'refs'; %{RT::I18N::} };
+    foreach my $k (keys %package) {
         next if $k eq 'main::';
         next unless index($k, '::', -2) >= 0;
-        next unless exists ${ 'RT::I18N::'. $k }{'Lexicon'};
+        my %lang_package = do {no strict 'refs'; %{'RT::I18N::'. $k} };
+        next unless exists $lang_package{'Lexicon'};
 
-        my $lex = *{ ${'RT::I18N::'. $k }{'Lexicon'} }{HASH};
+        my $lex = *{ $lang_package{'Lexicon'} }{HASH};
         # run fetch to force load
         my $tmp = $lex->{'foo'};
         # XXX: untie may fail with "untie attempted
diff --git a/share/html/Admin/Tools/Configuration.html b/share/html/Admin/Tools/Configuration.html
index fea3a5f..7d31ed2 100644
--- a/share/html/Admin/Tools/Configuration.html
+++ b/share/html/Admin/Tools/Configuration.html
@@ -114,11 +114,12 @@ foreach my $key ( RT->Config->Options( Overridable => undef, Sorted => 0 ) ) {
 <th class="collection-as-table"><&|/l&>Value</&></th>
 </tr>
 <%PERL>
-{ no strict qw/refs/;
 my %config_opt = map { $_ => 1 } RT->Config->Options( Overridable => undef );
 my $index_var;
-foreach my $key ( sort keys %{*RT::} ) {
-    next if !${'RT::'.$key} || ref ${'RT::'.$key} || $config_opt{ $key };
+my %package = do {no strict 'refs'; %{*RT::} };
+foreach my $key ( sort keys %package ) {
+    my $val = do {no strict 'refs'; ${'RT::'.$key} };
+    next if !$val || ref $val || $config_opt{ $key };
     $index_var++;
 </%PERL>
 <tr class="collection-as-table <% $index_var%2 ? 'oddline' : 'evenline'%>">
@@ -127,12 +128,11 @@ foreach my $key ( sort keys %{*RT::} ) {
 % if ( $key =~ /Password(?!Length)/i ) { 
 <em><% loc('Password not printed' ) %></em>\
 % } else {
-<% ${'RT::'.$key} %>
+<% $val %>
 % }
 </td>
 </tr>
 % }
-% }
 </table>
 </&>
 

commit 5bb73aebd3f45a2553731d4c06c6731b81496443
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Jul 6 16:16:20 2011 -0400

    Remove "no warnings" lines where possible

diff --git a/lib/RT/Attachment.pm b/lib/RT/Attachment.pm
index 154d161..49c448e 100644
--- a/lib/RT/Attachment.pm
+++ b/lib/RT/Attachment.pm
@@ -431,8 +431,8 @@ sub ContentLength {
     my $len = $self->GetHeader('Content-Length');
     unless ( defined $len ) {
         use bytes;
-        no warnings 'uninitialized';
-        $len = length($self->Content) || 0;
+        my $content = $self->Content;
+        $len = defined $content ? length($content) : 0;
         $self->SetHeader('Content-Length' => $len);
     }
     return $len;
diff --git a/lib/RT/Record.pm b/lib/RT/Record.pm
index 3a32320..1013341 100644
--- a/lib/RT/Record.pm
+++ b/lib/RT/Record.pm
@@ -970,18 +970,20 @@ sub Update {
         # and might not have a Name method. But "can" won't find autoloaded
         # items. If it fails, we don't care
         do {
-            no warnings "uninitialized";
             local $@;
             my $name = eval {
                 my $object = $attribute . "Obj";
-                $self->$object->Name;
+                $self->$object->Name // "";
             };
             unless ($@) {
-                next if $name eq $value || $name eq ($value || 0);
+                next if $value eq $name;
+                next if ($value || 0) eq $name;
             }
 
-            next if $truncated_value eq $self->$attribute();
-            next if ( $truncated_value || 0 ) eq $self->$attribute();
+            my $attr_value = $self->$attribute // "";
+
+            next if $truncated_value eq $attr_value;
+            next if ( $truncated_value || 0 ) eq $attr_value;
         };
 
         $new_values{$attribute} = $value;
diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index b23513d..f05706a 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -821,7 +821,6 @@ sub load_or_create_queue {
             next unless exists $args{ $field };
             next if $args{ $field } eq ($obj->$field || '');
             
-            no warnings 'uninitialized';
             my $method = 'Set'. $field;
             my ($val, $msg) = $obj->$method( $args{ $field } );
             die "$msg" unless $val;
diff --git a/sbin/rt-test-dependencies.in b/sbin/rt-test-dependencies.in
index 31bdf69..9c4cf75 100644
--- a/sbin/rt-test-dependencies.in
+++ b/sbin/rt-test-dependencies.in
@@ -53,7 +53,6 @@
 
 use strict;
 use warnings;
-no warnings qw(numeric redefine);
 use Getopt::Long;
 use Cwd qw(abs_path);
 my %args;

commit 81f9d093916c4687e58ca0690f8d4fd8f41b13a7
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Jul 6 19:21:59 2011 -0400

    Remove instances of comma-as-statement-separator

diff --git a/bin/rt.in b/bin/rt.in
index 584d3a6..764f7dc 100644
--- a/bin/rt.in
+++ b/bin/rt.in
@@ -272,10 +272,16 @@ sub list {
         $_ = shift @ARGV;
 
         if (/^-t$/) {
-            $bad = 1, last unless defined($type = get_type_argument());
+            unless (defined($type = get_type_argument())) {
+                $bad = 1;
+                last;
+            }
         }
         elsif (/^-S$/) {
-            $bad = 1, last unless get_var_argument(\%data);
+            unless (get_var_argument(\%data)) {
+                $bad = 1;
+                last;
+            }
         }
         elsif (/^-o$/) {
             $data{'orderby'} = shift @ARGV;
@@ -392,10 +398,16 @@ sub show {
         $_ = shift @ARGV;
         s/^#// if /^#\d+/; # get rid of leading hash
         if (/^-t$/) {
-            $bad = 1, last unless defined($type = get_type_argument());
+            unless (defined($type = get_type_argument())) {
+                $bad = 1;
+                last;
+            }
         }
         elsif (/^-S$/) {
-            $bad = 1, last unless get_var_argument(\%data);
+            unless (get_var_argument(\%data)) {
+                $bad = 1;
+                last;
+            }
         }
         elsif (/^-([isl])$/) {
             $data{format} = $1;
@@ -498,10 +510,16 @@ sub edit {
         elsif (/^-o$/) { $output = 1 }
         elsif (/^-ct$/) { $content_type = shift @ARGV }
         elsif (/^-t$/) {
-            $bad = 1, last unless defined($type = get_type_argument());
+            unless (defined($type = get_type_argument())) {
+                $bad = 1;
+                last;
+            }
         }
         elsif (/^-S$/) {
-            $bad = 1, last unless get_var_argument(\%data);
+            unless (get_var_argument(\%data)) {
+                $bad = 1;
+                last;
+            }
         }
         elsif (/^-$/ && !($slurped || $input)) {
             chomp(my @lines = <STDIN>);
@@ -934,7 +952,10 @@ sub link_ticket {
             $del = 1;
         }
         elsif (/^-t$/) {
-            $bad = 1, last unless defined($type = get_type_argument());
+            unless (defined($type = get_type_argument())) {
+                $bad = 1;
+                last;
+            }
         }
         else {
             whine "Unrecognised option: '$_'.";
diff --git a/lib/RT/Approval/Rule/NewPending.pm b/lib/RT/Approval/Rule/NewPending.pm
index cb67f73..6e353c9 100644
--- a/lib/RT/Approval/Rule/NewPending.pm
+++ b/lib/RT/Approval/Rule/NewPending.pm
@@ -67,7 +67,10 @@ sub Commit {
     my $t = $self->TicketObj->Transactions;
     my $to;
     while ( my $o = $t->Next ) {
-        $to = $o, last if $o->Type eq 'Create';
+        if ($o->Type eq 'Create') {
+            $to = $o;
+            last;
+        }
     }
 
     # XXX: this makes the owner incorrect so notify owner won't work

commit 360fa8b07875a212a3284763f90b85c04272b736
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Jul 6 19:22:41 2011 -0400

    Rejigger some commas which perlcritic mistook for statement separators

diff --git a/lib/RT/CustomFieldValues/External.pm b/lib/RT/CustomFieldValues/External.pm
index 66e798a..74a1479 100644
--- a/lib/RT/CustomFieldValues/External.pm
+++ b/lib/RT/CustomFieldValues/External.pm
@@ -193,7 +193,8 @@ sub _DoSearch {
     my $check = $self->__BuildAggregatorsCheck;
     foreach( @{ $self->ExternalValues } ) {
         my $value = $self->NewItem;
-        $value->LoadFromHash( { %defaults, %$_ } );
+        my %load = ( %defaults, %{$_} );
+        $value->LoadFromHash( \%load );
         next if $check && !$check->( $self, $value );
         $self->AddRecord( $value );
         last if $self->RowsPerPage and ++$i >= $self->RowsPerPage;

commit 4182d96e662d6c1cbb60c3a3c41d84e4a6267f75
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Jul 6 19:39:48 2011 -0400

    Resolve mixed high and low precedence boolean operators, in favor of low-precedence

diff --git a/bin/rt.in b/bin/rt.in
index 764f7dc..6e39c7c 100644
--- a/bin/rt.in
+++ b/bin/rt.in
@@ -314,7 +314,7 @@ sub list {
             $bad = 1; last;
         }
     }
-    if ( ! $rawprint and ! exists $data{format} ) {
+    unless ( $rawprint or exists $data{format} ) {
         $data{format} = 'l';
         $data{fields} = 'subject,status,queue,created,told,owner,requestors';
     }
@@ -1759,7 +1759,7 @@ sub date_diff {
     $new = time() if ! $new;
     $old = str2time($old) if $old !~ /^\d+$/;
     $new = str2time($new) if $new !~ /^\d+$/;
-    return "???" if ! $old or ! $new;
+    return "???" if not $old or not $new;
 
     my %seconds = (min => 60,
                    hr  => 60*60,
@@ -1795,7 +1795,7 @@ sub prettyshow {
     # dates in these attributes are in GMT and will be converted
     foreach my $form (@$forms) {
         my ($c, $o, $k, $e) = @$form;
-        next if ! $k->{id} or exists $k->{Queue};
+        next if not $k->{id} or exists $k->{Queue};
         if ( exists $k->{Created} ) {
             my ($y,$m,$d,$hh,$mm,$ss) = ($k->{Created} =~ /(\d\d\d\d)-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)/);
             $m--;
diff --git a/devel/tools/extract-message-catalog b/devel/tools/extract-message-catalog
index f61008a..0ba06b5 100755
--- a/devel/tools/extract-message-catalog
+++ b/devel/tools/extract-message-catalog
@@ -334,7 +334,7 @@ sub update {
     my $lang = shift;
     my $file = shift;
 
-    unless (!-e $file or -w $file) {
+    if (-e $file and not -w $file) {
         warn "Can't write to $lang, skipping...\n";
         return;
     }
diff --git a/lib/RT/Attributes.pm b/lib/RT/Attributes.pm
index f5e84a4..e48b8f0 100644
--- a/lib/RT/Attributes.pm
+++ b/lib/RT/Attributes.pm
@@ -161,7 +161,7 @@ sub DeleteEntry {
     );
     my $found = 0;
     foreach my $attr ( $self->Named( $args{'Name'} ) ) {
-        if ( ( !defined $args{'id'} and !defined $args{'Content'} )
+        if ( ( not defined $args{'id'} and not defined $args{'Content'} )
              or ( defined $args{'id'} and $attr->id eq $args{'id'} )
              or ( defined $args{'Content'} and $attr->Content eq $args{'Content'} ) )
         {
diff --git a/lib/RT/I18N.pm b/lib/RT/I18N.pm
index c074c3f..ae1e477 100644
--- a/lib/RT/I18N.pm
+++ b/lib/RT/I18N.pm
@@ -492,7 +492,7 @@ sub _FindOrGuessCharset {
         return _CanonicalizeCharset($charset);
     }
 
-    if ( !$head_only and $head->mime_type =~ m{^text/} ) {
+    if ( not $head_only and $head->mime_type =~ m{^text/} ) {
         my $body = $entity->bodyhandle or return;
         return _GuessCharset( $body->as_string );
     }
diff --git a/lib/RT/Ticket.pm b/lib/RT/Ticket.pm
index d43faf9..225fce7 100644
--- a/lib/RT/Ticket.pm
+++ b/lib/RT/Ticket.pm
@@ -1021,8 +1021,8 @@ sub TransactionAddresses {
 # Skip addresses without a phrase (things that are just raw addresses) if we have a phrase
                 next
                     if (    $addresses{ $addr->address }
-                         && $addresses{ $addr->address }->phrase
-                         && not $addr->phrase );
+                         and $addresses{ $addr->address }->phrase
+                         and not $addr->phrase );
 
                 # skips "comment-only" addresses
                 next unless ( $addr->address );

commit f19542724275e99a8d9aefa62a4ca2717b4f2e34
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Jul 6 20:47:24 2011 -0400

    $, hasn't been a problem since Log::Dispatch 1.79; we require 2.0 in rt-test-dependencies

diff --git a/lib/RT.pm b/lib/RT.pm
index 7b2a178..b5bb132 100644
--- a/lib/RT.pm
+++ b/lib/RT.pm
@@ -223,11 +223,6 @@ Create the Logger object and set up signal handlers.
 =cut
 
 sub InitLogging {
-
-    # We have to set the record separator ($, man perlvar)
-    # or Log::Dispatch starts getting
-    # really pissy, as some other module we use unsets it.
-    $, = '';
     use Log::Dispatch 1.6;
 
     my %level_to_num = (

commit e6b8ae64615fb5a0fc8f1cb94aaf064fc305292c
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Jul 6 20:48:14 2011 -0400

    Move the already-compile-time use line to the top; the version requirement is also superfluous
    
    rt-test-dependencies requires version 2.0 or higher already

diff --git a/lib/RT.pm b/lib/RT.pm
index b5bb132..4383092 100644
--- a/lib/RT.pm
+++ b/lib/RT.pm
@@ -58,6 +58,7 @@ use File::Spec ();
 use Cwd ();
 use Scalar::Util qw(blessed);
 use UNIVERSAL::require;
+use Log::Dispatch;
 
 use vars qw($Config $System $SystemUser $Nobody $Handle $Logger $_Privileged $_Unprivileged $_INSTALL_MODE);
 
@@ -223,8 +224,6 @@ Create the Logger object and set up signal handlers.
 =cut
 
 sub InitLogging {
-    use Log::Dispatch 1.6;
-
     my %level_to_num = (
         map( { $_ => } 0..7 ),
         debug     => 0,

commit 80f19766ff0640a42b5ec21fd04f52e4fbaea470
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Wed Jul 6 20:51:04 2011 -0400

    Remove uses of lexical $a variable

diff --git a/bin/rt.in b/bin/rt.in
index 6e39c7c..10e0335 100644
--- a/bin/rt.in
+++ b/bin/rt.in
@@ -826,8 +826,8 @@ sub comment {
                 $status = shift @ARGV;
             }
             elsif (/-([bc])/) {
-                my $a = $_ eq "-b" ? \@bcc : \@cc;
-                @$a = split /\s*,\s*/, shift @ARGV;
+                my $ref = $_ eq "-b" ? \@bcc : \@cc;
+                @$ref = split /\s*,\s*/, shift @ARGV;
             }
             elsif (/-m/) {
                 $msg = shift @ARGV;
diff --git a/lib/RT/Shredder/Plugin/Base.pm b/lib/RT/Shredder/Plugin/Base.pm
index 30fa3f3..60a663c 100644
--- a/lib/RT/Shredder/Plugin/Base.pm
+++ b/lib/RT/Shredder/Plugin/Base.pm
@@ -122,8 +122,8 @@ sub HasSupportForArgs
     my $self = shift;
     my @args = @_;
     my @unsupported = ();
-    foreach my $a( @args ) {
-        push @unsupported, $a unless grep $_ eq $a, $self->SupportArgs;
+    foreach my $arg ( @args ) {
+        push @unsupported, $arg unless grep $_ eq $arg, $self->SupportArgs;
     }
     return( 0, "Plugin doesn't support argument(s): @unsupported" )
         if @unsupported;
diff --git a/sbin/rt-email-group-admin.in b/sbin/rt-email-group-admin.in
index 7d1ecb2..066cf21 100644
--- a/sbin/rt-email-group-admin.in
+++ b/sbin/rt-email-group-admin.in
@@ -209,8 +209,8 @@ Lists actions and its descriptions.
 
 sub list {
     my $actions = _get_our_actions();
-    while( my $a = $actions->Next ) {
-        _list( $a );
+    while( my $action = $actions->Next ) {
+        _list( $action );
     }
     return;
 }
diff --git a/sbin/rt-validator.in b/sbin/rt-validator.in
index ea3ca7e..9e74059 100644
--- a/sbin/rt-validator.in
+++ b/sbin/rt-validator.in
@@ -208,18 +208,19 @@ foreach my $table ( qw(Users Groups) ) {
             bind_values => [ $type ],
             action => sub {
                 my $id = shift;
-                return unless my $a = prompt_action( ['Create', 'delete'], $msg );
+                my $action = prompt_action( ['Create', 'delete'], $msg );
+                return unless $action;
 
-                if ( $a eq 'd' ) {
+                if ( $action eq 'd' ) {
                     delete_record( $table, $id );
                 }
-                elsif ( $a eq 'c' ) {
+                elsif ( $action eq 'c' ) {
                     my $principal_id = create_record( 'Principals',
                         id => $id, PrincipalType => $type, ObjectId => $id, Disabled => 0
                     );
                 }
                 else {
-                    die "Unknown action '$a'";
+                    die "Unknown action '$action'";
                 }
             },
         );
@@ -1354,8 +1355,8 @@ sub prompt {
 
     print $msg, "\n";
     print "$action ALL records with the same defect? [N]: ";
-    my $a = <STDIN>;
-    return $cached_answer{ $token } = 1 if $a =~ /^(y|yes)$/i;
+    my $input = <STDIN>;
+    return $cached_answer{ $token } = 1 if $input =~ /^(y|yes)$/i;
     return $cached_answer{ $token } = 0;
 } }
 
@@ -1371,11 +1372,11 @@ sub prompt_action {
 
     print $msg, "\n";
     print join( ' or ', @$actions ) ." ALL records with the same defect? [do nothing]: ";
-    my $a = <STDIN>;
-    chomp $a;
-    return $cached_answer{ $token } = '' unless $a;
-    foreach ( grep rindex(lc $_, lc $a, 0) == 0, @$actions ) {
-        return $cached_answer{ $token } = lc substr $a, 0, 1;
+    my $input = <STDIN>;
+    chomp $input;
+    return $cached_answer{ $token } = '' unless $input;
+    foreach ( grep rindex(lc $_, lc $input, 0) == 0, @$actions ) {
+        return $cached_answer{ $token } = lc substr $input, 0, 1;
     }
     return $cached_answer{ $token } = '';
 } }
@@ -1393,8 +1394,10 @@ sub prompt_integer {
 
     print $msg, "\n";
     print "$action ALL records with the same defect? [0]: ";
-    my $a = <STDIN>; chomp $a; $a = int($a);
-    return $cached_answer{ $token } = $a;
+    my $input = <STDIN>;
+    chomp $input;
+    $input = int($input);
+    return $cached_answer{ $token } = $input;
 } }
 
 # Find all RT::URI modules RT has loaded
diff --git a/share/html/Admin/Tools/Shredder/Elements/PluginArguments b/share/html/Admin/Tools/Shredder/Elements/PluginArguments
index 02137c3..b5935b7 100644
--- a/share/html/Admin/Tools/Shredder/Elements/PluginArguments
+++ b/share/html/Admin/Tools/Shredder/Elements/PluginArguments
@@ -50,8 +50,8 @@ $Plugin => ''
 </%ARGS>
 <div id="shredder-plugin-<% $Plugin %>-arguments" class="shredder-form">
 <span><% loc('Fill arguments') %>:</span><br />
-% foreach my $a( $plugin_obj->SupportArgs ) {
-<span><% loc($a) %>:</span><input type="text" name="<% "$Plugin:$a" %>" value="<% $ARGS{ "$Plugin:$a" } || '' %>" /><br />
+% foreach my $arg ( $plugin_obj->SupportArgs ) {
+<span><% loc($arg) %>:</span><input type="text" name="<% "$Plugin:$arg" %>" value="<% $ARGS{ "$Plugin:$arg" } || '' %>" /><br />
 % }
 </div>
 <%INIT>
diff --git a/share/html/REST/1.0/Forms/ticket/attachments b/share/html/REST/1.0/Forms/ticket/attachments
index b9619ec..7c1b2b5 100644
--- a/share/html/REST/1.0/Forms/ticket/attachments
+++ b/share/html/REST/1.0/Forms/ticket/attachments
@@ -114,12 +114,12 @@ else {
     my $transactions = $ticket->Transactions;
     while (my $t = $transactions->Next) {
         my $attachments = $t->Attachments;
-        while (my $a = $attachments->Next) {
-            my $size = length($a->Content || '');
+        while (my $att = $attachments->Next) {
+            my $size = length($att->Content || '');
             if ($size > 1024) { $size  = int($size/102.4)/10 . "k" }
             else              { $size .= "b" }
-            my $name = (defined $a->Filename and length $a->Filename) ? $a->Filename : "(Unnamed)";
-            push @attachments, $a->Id.": $name (".$a->ContentType . " / $size)";
+            my $name = (defined $att->Filename and length $att->Filename) ? $att->Filename : "(Unnamed)";
+            push @attachments, $att->Id.": $name (".$att->ContentType . " / $size)";
         }
     }
 
diff --git a/share/html/REST/1.0/Forms/ticket/history b/share/html/REST/1.0/Forms/ticket/history
index f5d2d25..94c6eb8 100644
--- a/share/html/REST/1.0/Forms/ticket/history
+++ b/share/html/REST/1.0/Forms/ticket/history
@@ -147,12 +147,12 @@ if ($tid) {
     if (!%$fields || exists $fields->{lc 'Attachments'}) {
         my $attachlist;
         my $attachments = $t->Attachments;
-        while (my $a = $attachments->Next) {
-            my $size = length($a->Content||'');
+        while (my $att = $attachments->Next) {
+            my $size = length($att->Content||'');
             if ($size > 1024) { $size  = int($size/102.4)/10 . "k" }
             else              { $size .= "b" }
-            my $name = (defined $a->Filename and length $a->Filename) ? $a->Filename : "untitled";
-            $attachlist .= "\n" . $a->Id.": $name ($size)";
+            my $name = (defined $att->Filename and length $att->Filename) ? $att->Filename : "untitled";
+            $attachlist .= "\n" . $att->Id.": $name ($size)";
         }
         
         push @data, [Attachments => $attachlist];
diff --git a/share/html/REST/1.0/Forms/transaction/default b/share/html/REST/1.0/Forms/transaction/default
index 19387f3..498c21e 100644
--- a/share/html/REST/1.0/Forms/transaction/default
+++ b/share/html/REST/1.0/Forms/transaction/default
@@ -96,16 +96,16 @@ if ($tid) {
         if (!%$fields || exists $fields->{lc 'Attachments'}) {
             my $attachlist;
             my $attachments = $t->Attachments;
-            while (my $a = $attachments->Next) {
-                my $size = length($a->Content);
+            while (my $att = $attachments->Next) {
+                my $size = length($att->Content);
                 if ($size > 1024) {
                     $size  = int($size/102.4)/10 . "k";
                 }
                 else {
                     $size .= "b";
                 }
-                my $name = (defined $a->Filename and length $a->Filename) ? $a->Filename : "untitled";
-                $attachlist .= "\n" . $a->Id.": $name ($size)";
+                my $name = (defined $att->Filename and length $att->Filename) ? $att->Filename : "untitled";
+                $attachlist .= "\n" . $att->Id.": $name ($size)";
             }
             push @data, [Attachments => $attachlist];
         }

commit f9b63339b4a0cd481b81269aff176a15f76498fa
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Jul 7 18:35:06 2011 -0400

    Remove a case of map in void context

diff --git a/share/html/Search/Bulk.html b/share/html/Search/Bulk.html
index fc61905..3a334e3 100644
--- a/share/html/Search/Bulk.html
+++ b/share/html/Search/Bulk.html
@@ -198,7 +198,7 @@ unless ( defined $Rows ) {
 my $title = loc("Update multiple tickets");
 
 # Iterate through the ARGS hash and remove anything with a null value.
-map ( $ARGS{$_} =~ /^$/ && ( delete $ARGS{$_} ), keys %ARGS );
+delete $ARGS{$_} for grep { $ARGS{$_} =~ /^$/ } keys %ARGS;
 
 my (@results);
 

commit 666e0c59c7607e7b2f356552f29942b2d39ae056
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Jul 21 15:40:26 2011 -0400

    Fix cases of using $1 without checking the regex -- or perlcritic thinks we do

diff --git a/bin/rt.in b/bin/rt.in
index 10e0335..a1fdd69 100644
--- a/bin/rt.in
+++ b/bin/rt.in
@@ -1116,7 +1116,8 @@ sub submit {
         $text =~ s/\n*$/\n/ if ($text);
 
         # "RT/3.0.1 401 Credentials required"
-        if ($status !~ m#^RT/\d+(?:\S+) (\d+) ([\w\s]+)$#) {
+        my ($code, $message) = $status =~ m#^RT/\d+(?:\S+) (\d+) ([\w\s]+)$#;
+        unless (defined $code and defined $message) {
             warn "rt: Malformed RT response from $server.\n";
             warn "(Rerun with RTDEBUG=3 for details.)\n" if $config{debug} < 3;
             exit -1;
@@ -1125,8 +1126,8 @@ sub submit {
         # Our caller can pretend that the server returned a custom HTTP
         # response code and message. (Doing that directly is apparently
         # not sufficiently portable and uncomplicated.)
-        $res->code($1);
-        $res->message($2);
+        $res->code($code);
+        $res->message($message);
         $res->content($text);
         $session->update($res) if ($res->is_success || $res->code != 401);
 
@@ -1675,7 +1676,7 @@ sub expand_list {
                     # mix, number must be first
                     :defined $a->[1]? -1: 1
         }
-        map [ $_, (defined( /^(\d+)$/ )? $1: undef), lc($_) ],
+        map [ $_, ( /^(\d+)$/ ? $1 : undef), lc($_) ],
         @elts;
 }
 
diff --git a/lib/RT/Handle.pm b/lib/RT/Handle.pm
index 29a65df..49f6ab5 100644
--- a/lib/RT/Handle.pm
+++ b/lib/RT/Handle.pm
@@ -617,7 +617,7 @@ sub GetVersionFile {
     my @files = File::Glob::bsd_glob("$base_name*");
     return '' unless @files;
 
-    my %version = map { $_ =~ /\.\w+-([-\w\.]+)$/; ($1||0) => $_ } @files;
+    my %version = map { ($_ =~ /\.\w+-([-\w\.]+)$/ ? $1 : 0) => $_ } @files;
     my $version;
     foreach ( reverse sort cmp_version keys %version ) {
         if ( cmp_version( $db_version, $_ ) >= 0 ) {
diff --git a/lib/RT/Interface/REST.pm b/lib/RT/Interface/REST.pm
index b6f9fd3..10e8168 100644
--- a/lib/RT/Interface/REST.pm
+++ b/lib/RT/Interface/REST.pm
@@ -101,7 +101,7 @@ sub expand_list {
                     # mix, number must be first
                     :defined $a->[1]? -1: 1
         }
-        map [ $_, (defined( /^(\d+)$/ )? $1: undef), lc($_) ],
+        map [ $_, ( /^(\d+)$/ ? $1 : undef), lc($_) ],
         @elts;
 }
 
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 9dbf1e7..da75598 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -3879,9 +3879,8 @@ container object and the search id.
 sub _parse_saved_search {
     my $spec = shift;
     return unless $spec;
-    if ( $spec !~ /^(.*?)-(\d+)-SavedSearch-(\d+)$/ ) {
-        return;
-    }
+    return unless $spec =~ /^(.*?)-(\d+)-SavedSearch-(\d+)$/;
+
     my $obj_type  = $1;
     my $obj_id    = $2;
     my $search_id = $3;
diff --git a/lib/RT/ScripAction.pm b/lib/RT/ScripAction.pm
index 428ad5d..5a254a6 100644
--- a/lib/RT/ScripAction.pm
+++ b/lib/RT/ScripAction.pm
@@ -167,9 +167,8 @@ sub LoadAction  {
         $self->{'TemplateObj'} = $args{'TemplateObj'};
     }
 
-    $self->ExecModule =~ /^(\w+)$/;
-    my $module = $1;
-    my $type = "RT::Action::". $module;
+    $self->ExecModule =~ /^(\w+)$/ or die "Invalid scrip action: ".$self->ExecModule;
+    my $type = "RT::Action::" . $1;
 
     $type->require or die "Require of $type action module failed.\n$@\n";
 
diff --git a/lib/RT/ScripCondition.pm b/lib/RT/ScripCondition.pm
index 46110a9..13d64a9 100644
--- a/lib/RT/ScripCondition.pm
+++ b/lib/RT/ScripCondition.pm
@@ -157,10 +157,8 @@ sub LoadCondition  {
                  TicketObj => undef,
                  @_ );
 
-    #TODO: Put this in an eval
-    $self->ExecModule =~ /^(\w+)$/;
-    my $module = $1;
-    my $type = "RT::Condition::". $module;
+    $self->ExecModule =~ /^(\w+)$/ or die "Invalid scrip condition: ".$self->ExecModule;
+    my $type = "RT::Condition::" . $1;
 
     $type->require or die "Require of $type condition module failed.\n$@\n";
 
diff --git a/lib/RT/Shredder/Plugin/Attachments.pm b/lib/RT/Shredder/Plugin/Attachments.pm
index 5a573ad..58f97fa 100644
--- a/lib/RT/Shredder/Plugin/Attachments.pm
+++ b/lib/RT/Shredder/Plugin/Attachments.pm
@@ -112,9 +112,10 @@ sub Run
     }
     if( $self->{'opt'}{'longer'} ) {
         my $size = $self->{'opt'}{'longer'};
-        $size =~ s/([mk])//i;
-        $size *= 1024 if $1 && lc $1 eq 'k';
-        $size *= 1024*1024 if $1 && lc $1 eq 'm';
+        if ($size =~ s/([km])//i) {
+            $size *= 1024      if lc $1 eq 'k';
+            $size *= 1024*1024 if lc $1 eq 'm';
+        }
         push @conditions, "( LENGTH(Content) > ? )";
         push @values, $size;
     }
diff --git a/lib/RT/Transaction.pm b/lib/RT/Transaction.pm
index a75ff97..63fefbf 100644
--- a/lib/RT/Transaction.pm
+++ b/lib/RT/Transaction.pm
@@ -1493,11 +1493,9 @@ sub UpdateCustomFields {
     }
 
     foreach my $arg ( keys %$args ) {
-        next
-          unless ( $arg =~
-            /^(?:Object-RT::Transaction--)?CustomField-(\d+)/ );
         next if $arg =~ /-Magic$/;
-        my $cfid   = $1;
+        my ($cfid) = $arg =~ /^(?:Object-RT::Transaction--)?CustomField-(\d+)/;
+        next unless defined $cfid;
         my $values = $args->{$arg};
         my $cf = $self->LoadCustomFieldByIdentifier($cfid);
         next unless $cf->ObjectTypeFromLookupType($cf->__Value('LookupType'))->isa(ref $self);
diff --git a/share/html/Admin/Queues/People.html b/share/html/Admin/Queues/People.html
index 2d0bb91..5ef2ec1 100644
--- a/share/html/Admin/Queues/People.html
+++ b/share/html/Admin/Queues/People.html
@@ -137,7 +137,7 @@ unless ($OnlySearchForPeople or $OnlySearchForGroup) {
     foreach my $key (keys %ARGS) {
             my $id = $QueueObj->Id;
 
-        if (($key =~ /^Queue-$id-DeleteWatcher-Type-(.*?)-Principal-(\d*)$/)) {;
+        if ($key =~ /^Queue-$id-DeleteWatcher-Type-(.*?)-Principal-(\d*)$/) {
             my ($code, $msg) = $QueueObj->DeleteWatcher(Type => $1,
                                                         PrincipalId => $2);
             push @results, $msg;

commit 50caeb39670078cc02aa4761220113cdae88dc30
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Fri Jul 22 16:06:43 2011 -0400

    Remove variables declared but not used

diff --git a/lib/RT/Shredder/Plugin/Attachments.pm b/lib/RT/Shredder/Plugin/Attachments.pm
index 58f97fa..896cc92 100644
--- a/lib/RT/Shredder/Plugin/Attachments.pm
+++ b/lib/RT/Shredder/Plugin/Attachments.pm
@@ -82,7 +82,6 @@ sub TestArgs
 {
     my $self = shift;
     my %args = @_;
-    my $queue;
     if( $args{'file'} ) {
         unless( $args{'file'} =~ /^[\w\. *?]+$/) {
             return( 0, "Files mask '$args{file}' has invalid characters" );
diff --git a/lib/RT/Shredder/Plugin/Tickets.pm b/lib/RT/Shredder/Plugin/Tickets.pm
index c6b9b8e..a36ea9d 100644
--- a/lib/RT/Shredder/Plugin/Tickets.pm
+++ b/lib/RT/Shredder/Plugin/Tickets.pm
@@ -90,7 +90,6 @@ sub TestArgs
 {
     my $self = shift;
     my %args = @_;
-    my $queue;
     if( $args{'query'} ) {
         my $objs = RT::Tickets->new( RT->SystemUser );
         $objs->{'allow_deleted_search'} = 1;
diff --git a/lib/RT/Tickets.pm b/lib/RT/Tickets.pm
index c641cd2..4caa4b9 100644
--- a/lib/RT/Tickets.pm
+++ b/lib/RT/Tickets.pm
@@ -1273,7 +1273,6 @@ C<ALIAS> is set to the name of a watcher type.
 sub OrderByCols {
     my $self = shift;
     my @args = @_;
-    my $clause;
     my @res   = ();
     my $order = 0;
 
@@ -1904,14 +1903,7 @@ sub LimitWatcher {
         @_
     );
 
-    #build us up a description
-    my ( $watcher_type, $desc );
-    if ( $args{'TYPE'} ) {
-        $watcher_type = $args{'TYPE'};
-    }
-    else {
-        $watcher_type = "Watcher";
-    }
+    my $watcher_type = $args{'TYPE'} || "Watcher";
 
     $self->LimitField(
         FIELD       => $watcher_type,
diff --git a/sbin/rt-test-dependencies.in b/sbin/rt-test-dependencies.in
index 9c4cf75..e66aa06 100644
--- a/sbin/rt-test-dependencies.in
+++ b/sbin/rt-test-dependencies.in
@@ -398,7 +398,6 @@ foreach my $type (sort grep $args{$_}, keys %args) {
     $type = $1;
     section("$type dependencies");
 
-    my @missing;
     my @deps = @{ $deps{$type} };
 
     my %missing = test_deps(@deps);
diff --git a/share/html/Install/DatabaseDetails.html b/share/html/Install/DatabaseDetails.html
index b64cc5a..7fac81a 100644
--- a/share/html/Install/DatabaseDetails.html
+++ b/share/html/Install/DatabaseDetails.html
@@ -95,7 +95,6 @@
 
 <%init>
 my (@results, @errors);
-my $ConnectionSucceeded;
 
 my @Types = 'DatabaseName';
 

commit a2b3957e292dfc6d5821c2f8f0113d5c944f917b
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Mon Jul 25 12:28:52 2011 -0400

    Access config variables through RT->Config->Get rather than reaching into RT::

diff --git a/lib/RT.pm b/lib/RT.pm
index 4383092..b6dc493 100644
--- a/lib/RT.pm
+++ b/lib/RT.pm
@@ -164,7 +164,7 @@ sub LoadConfig {
 
     # RT::Essentials mistakenly recommends that WebPath be set to '/'.
     # If the user does that, do what they mean.
-    $RT::WebPath = '' if ($RT::WebPath eq '/');
+    $Config->Set( WebPath => '' ) if $Config->Get('WebPath') eq '/';
 
     # Fix relative LogDir; It cannot be fixed in a PostLoadCheck, as
     # they are run after logging is enabled.
diff --git a/lib/RT/Graph/Tickets.pm b/lib/RT/Graph/Tickets.pm
index fc92510..2341ec9 100644
--- a/lib/RT/Graph/Tickets.pm
+++ b/lib/RT/Graph/Tickets.pm
@@ -57,7 +57,7 @@ RT::Graph::Tickets - view relations between tickets as graphs
 
 =cut
 
-unless ($RT::DisableGraphViz) {
+unless (RT->Config->Get('DisableGraphViz')) {
     require GraphViz;
     GraphViz->import;
 }
@@ -222,7 +222,7 @@ sub AddTicket {
     my %node_style = (
         style => 'filled,rounded',
         %{ $ticket_status_style{ $args{'Ticket'}->Status } || {} },
-        URL   => $RT::WebPath .'/Ticket/Display.html?id='. $args{'Ticket'}->id,
+        URL   => RT->Config->Get('WebPath') .'/Ticket/Display.html?id='. $args{'Ticket'}->id,
         tooltip => gv_escape( $args{'Ticket'}->Subject || '#'. $args{'Ticket'}->id ),
     );
 
diff --git a/lib/RT/Interface/Email.pm b/lib/RT/Interface/Email.pm
index 6864d40..59e6949 100644
--- a/lib/RT/Interface/Email.pm
+++ b/lib/RT/Interface/Email.pm
@@ -1354,7 +1354,7 @@ sub Gateway {
     );
 
     # Do not pass loop messages to MailPlugins, to make sure the loop
-    # is broken, unless $RT::StoreLoops is set.
+    # is broken, unless $StoreLoops is set.
     if ($IsALoop && !$should_store_machine_generated_message) {
         return ( 0, $result, undef );
     }
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index da75598..565f2be 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -245,8 +245,9 @@ sub WebRemoteUserAutocreateInfo {
 
     # default to making Privileged users, even if they specify
     # some other default Attributes
-    if ( !$RT::UserAutocreateDefaultsOnLogin
-        || ( ref($RT::UserAutocreateDefaultsOnLogin) && not exists $RT::UserAutocreateDefaultsOnLogin->{Privileged} ) )
+    my $autocreate = RT->Config->Get('UserAutocreateDefaultsOnLogin');
+    if ( not $autocreate
+        or ( ref($autocreate) and not exists $autocreate->{Privileged} ) )
     {
         $user_info{'Privileged'} = 1;
     }
diff --git a/lib/RT/Shredder/Dependencies.pm b/lib/RT/Shredder/Dependencies.pm
index a78fd0c..929f28f 100644
--- a/lib/RT/Shredder/Dependencies.pm
+++ b/lib/RT/Shredder/Dependencies.pm
@@ -116,7 +116,7 @@ sub _PushDependency
             TargetObject => $rec->{'Object'},
         );
 
-    if( scalar @{ $self->{'list'} } > ( $RT::DependenciesLimit || 1000 ) ) {
+    if( scalar @{ $self->{'list'} } > ( RT->Config->Get('DependenciesLimit') || 1000 ) ) {
         RT::Shredder::Exception::Info->throw( 'DependenciesLimit' );
     }
     return;
diff --git a/share/html/Install/DatabaseDetails.html b/share/html/Install/DatabaseDetails.html
index 7fac81a..03eb22b 100644
--- a/share/html/Install/DatabaseDetails.html
+++ b/share/html/Install/DatabaseDetails.html
@@ -169,16 +169,16 @@ if ( $Run ) {
                     $sth->execute('RT_System'); 
                     if ( $sth->fetchrow_array ) {
                         $RT::Installer->{DatabaseAction} = 'none';
-                        push @results, loc("[_1] appears to be fully initialized.  We won't need to create any tables or insert metadata, but you can continue to customize RT by clicking 'Customize Basics' below", $RT::DatabaseName);
+                        push @results, loc("[_1] appears to be fully initialized.  We won't need to create any tables or insert metadata, but you can continue to customize RT by clicking 'Customize Basics' below", RT->Config->Get('DatabaseName'));
                     }
                     else {
                         $RT::Installer->{DatabaseAction} = 'acl,coredata,insert';
-                        push @results, loc("[_1] already exists and has RT's tables in place, but does not contain RT's metadata. The 'Initialize Database' step later on can insert metadata into this existing database. If this is acceptable, click 'Customize Basics' below to continue customizing RT.", $RT::DatabaseName);
+                        push @results, loc("[_1] already exists and has RT's tables in place, but does not contain RT's metadata. The 'Initialize Database' step later on can insert metadata into this existing database. If this is acceptable, click 'Customize Basics' below to continue customizing RT.", RT->Config->Get('DatabaseName'));
                     }
                 }
                 else {
                     $RT::Installer->{DatabaseAction} = 'schema,acl,coredata,insert';
-                    push @results, loc("[_1] already exists, but does not contain RT's tables or metadata. The 'Initialize Database' step later on can insert tables and metadata into this existing database. if this is acceptable, click 'Customize Basic' below to continue customizing RT.", $RT::DatabaseName );
+                    push @results, loc("[_1] already exists, but does not contain RT's tables or metadata. The 'Initialize Database' step later on can insert tables and metadata into this existing database. if this is acceptable, click 'Customize Basic' below to continue customizing RT.", RT->Config->Get('DatabaseName') );
                 }
 
             }

commit 8cd4a95035234e3591f0149fc525e5fe8c32f5ea
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Jul 21 20:42:06 2011 -0400

    _WhoHaveRoleRightSplitted should have been removed from Users in 932a5a2
    
    RT::Groups->_WhoHaveRoleRightSplitted was simply a proxy for the method
    in RT::Users, and should have been removed at the same time that the
    code was refactored and removed in Users

diff --git a/lib/RT/Groups.pm b/lib/RT/Groups.pm
index 4d06528..2c9e6a5 100644
--- a/lib/RT/Groups.pm
+++ b/lib/RT/Groups.pm
@@ -385,7 +385,6 @@ sub _JoinGroupMembersForGroupRights {
 }
 sub _JoinACL                  { return (shift)->RT::Users::_JoinACL( @_ ) }
 sub _RoleClauses              { return (shift)->RT::Users::_RoleClauses( @_ ) }
-sub _WhoHaveRoleRightSplitted { return (shift)->RT::Users::_WhoHaveRoleRightSplitted( @_ ) }
 sub _GetEquivObjects          { return (shift)->RT::Users::_GetEquivObjects( @_ ) }
 sub WithGroupRight            { return (shift)->RT::Users::WhoHaveGroupRight( @_ ) }
 sub WithRoleRight             { return (shift)->RT::Users::WhoHaveRoleRight( @_ ) }

commit 5c4e3026940b54a060c96345ba3c40151f28b8ee
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Mon Jul 25 14:28:15 2011 -0400

    Explicitly initialize local'd variables to undef or another appropriate value

diff --git a/bin/rt-mailgate.in b/bin/rt-mailgate.in
index 7856c10..8781266 100644
--- a/bin/rt-mailgate.in
+++ b/bin/rt-mailgate.in
@@ -262,7 +262,7 @@ sub check_failure {
 sub slurp_message {
     my $self = shift;
 
-    local $@;
+    local $@ = undef;
 
     my %message;
     my ( $fh, $filename )
@@ -271,7 +271,7 @@ sub slurp_message {
         print STDERR "$0: Couldn't create temp file, using memory\n";
         print STDERR "error: $@\n" if $@;
 
-        my $message = \do { local ( @ARGV, $/ ); <STDIN> };
+        my $message = \do { local ( $/, @ARGV ) = (undef); <STDIN> };
         unless ( $$message =~ /\S/ ) {
             print STDERR "$0: no message passed on STDIN\n";
             $self->exit_with_success;
diff --git a/bin/rt.in b/bin/rt.in
index a1fdd69..88d2c2a 100644
--- a/bin/rt.in
+++ b/bin/rt.in
@@ -1484,7 +1484,7 @@ sub config_from_file {
 sub parse_config_file {
     my %cfg;
     my ($file) = @_;
-    local $_; # $_ may be aliased to a constant, from line 1163
+    local $_ = undef; # $_ may be aliased to a constant, from line 1163
 
     open( my $handle, '<', $file ) or return;
 
diff --git a/devel/tools/extract-message-catalog b/devel/tools/extract-message-catalog
index 0ba06b5..ba19dca 100755
--- a/devel/tools/extract-message-catalog
+++ b/devel/tools/extract-message-catalog
@@ -144,7 +144,7 @@ sub extract_strings_from_code {
         print "\n  Cannot open $file for reading ($!), skipping.\n\n";
         return;
     }
-    local $/;
+    local $/ = undef;
     $_ = <$fh>;
     close $fh;
 
diff --git a/lib/RT.pm b/lib/RT.pm
index b6dc493..067763e 100644
--- a/lib/RT.pm
+++ b/lib/RT.pm
@@ -385,7 +385,7 @@ sub CheckPerlRequirements {
     # use $error here so the following "die" can still affect the global $@
     my $error;
     {
-        local $@;
+        local $@ = undef;
         eval {
             my $x = '';
             my $y = \$x;
@@ -467,7 +467,7 @@ sub InitClasses {
         # load scrips' modules
         my $scrips = RT::Scrips->new(RT->SystemUser);
         while ( my $scrip = $scrips->Next ) {
-            local $@;
+            local $@ = undef;
             eval { $scrip->LoadModules } or
                 $RT::Logger->error("Invalid Scrip ".$scrip->Id.".  Unable to load the Action or Condition.  ".
                                    "You should delete or repair this Scrip in the admin UI.\n$@\n");
diff --git a/lib/RT/Attachment.pm b/lib/RT/Attachment.pm
index 49c448e..81deb2e 100644
--- a/lib/RT/Attachment.pm
+++ b/lib/RT/Attachment.pm
@@ -398,7 +398,7 @@ sub OriginalContent {
         $self->OriginalEncoding || 'utf-8'
     );
 
-    local $@;
+    local $@ = undef;
     eval { Encode::from_to($content, $from => $to) };
     if ($@) {
         $RT::Logger->error("Could not convert attachment from $from to $to: ".$@);
diff --git a/lib/RT/Condition/UserDefined.pm b/lib/RT/Condition/UserDefined.pm
index 54a543a..6f1c8fe 100644
--- a/lib/RT/Condition/UserDefined.pm
+++ b/lib/RT/Condition/UserDefined.pm
@@ -60,7 +60,7 @@ This happens on every transaction. it's always applicable
 
 sub IsApplicable {
     my $self = shift;
-    local $@;
+    local $@ = undef;
     my $retval = eval $self->ScripObj->CustomIsApplicableCode; ## no critic
     if ($@) {
         $RT::Logger->error("Scrip ".$self->ScripObj->Id. " IsApplicable failed: ".$@);
diff --git a/lib/RT/CustomField.pm b/lib/RT/CustomField.pm
index 777d1a9..bbe2787 100644
--- a/lib/RT/CustomField.pm
+++ b/lib/RT/CustomField.pm
@@ -882,7 +882,7 @@ sub _IsValidRegex {
     my $self  = shift;
     my $regex = shift or return (1, 'valid');
 
-    local $^W; local $@;
+    local $^W; local $@ = undef;
     local $SIG{__DIE__} = sub { 1 };
     local $SIG{__WARN__} = sub { 1 };
 
diff --git a/lib/RT/EmailParser.pm b/lib/RT/EmailParser.pm
index cfb5b7b..edfd37f 100644
--- a/lib/RT/EmailParser.pm
+++ b/lib/RT/EmailParser.pm
@@ -248,7 +248,7 @@ sub _DecodeBody {
     my $source = $old->open('r') or die "couldn't open body: $!";
     my $destination = $new->open('w') or die "couldn't open body: $!";
     { 
-        local $@;
+        local $@ = undef;
         eval { $decoder->decode($source, $destination) };
         $RT::Logger->error($@) if $@;
     }
diff --git a/lib/RT/Handle.pm b/lib/RT/Handle.pm
index 49f6ab5..1b747dc 100644
--- a/lib/RT/Handle.pm
+++ b/lib/RT/Handle.pm
@@ -833,7 +833,7 @@ sub InsertData {
     local (@Groups, @Users, @Members, @ACL, @Queues, @ScripActions, @ScripConditions,
            @Templates, @CustomFields, @Scrips, @Attributes, @Initial, @Final);
 
-    local $@;
+    local $@ = undef;
     $RT::Logger->debug("Going to load '$datafile' data file");
     eval { require $datafile }
       or return (0, "Couldn't load data from '$datafile' for import:\n\nERROR:". $@);
@@ -841,7 +841,7 @@ sub InsertData {
     if ( @Initial ) {
         $RT::Logger->debug("Running initial actions...");
         foreach ( @Initial ) {
-            local $@;
+            local $@ = undef;
             eval { $_->(); 1 } or return (0, "One of initial functions failed: $@");
         }
         $RT::Logger->debug("Done.");
@@ -1268,7 +1268,7 @@ sub InsertData {
     if ( @Final ) {
         $RT::Logger->debug("Running final actions...");
         for ( @Final ) {
-            local $@;
+            local $@ = undef;
             eval { $_->(); };
             $RT::Logger->error( "Failed to run one of final actions: $@" )
                 if $@;
diff --git a/lib/RT/Installer.pm b/lib/RT/Installer.pm
index ccf4896..1632f6e 100644
--- a/lib/RT/Installer.pm
+++ b/lib/RT/Installer.pm
@@ -260,7 +260,7 @@ sub SaveConfig {
     my $content;
 
     {
-        local $/;
+        local $/ = undef;
         open( my $fh, '<', $file ) or die $!;
         $content = <$fh>;
         $content =~ s/^\s*1;\s*$//m;
diff --git a/lib/RT/Interface/Email.pm b/lib/RT/Interface/Email.pm
index 59e6949..9475e21 100644
--- a/lib/RT/Interface/Email.pm
+++ b/lib/RT/Interface/Email.pm
@@ -527,7 +527,7 @@ sub SendEmail {
         print $fh $content, "\n";
         close $fh;
     } else {
-        local ($ENV{'MAILADDRESS'}, $ENV{'PERL_MAILERS'});
+        local ($ENV{'MAILADDRESS'}, $ENV{'PERL_MAILERS'}) = (undef, undef);
 
         my @mailer_args = ($mail_command);
         if ( $mail_command eq 'sendmail' ) {
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 565f2be..931be86 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -280,7 +280,7 @@ sub HandleRequest {
     MaybeEnableSQLStatementLog();
 
     # avoid reentrancy, as suggested by masonbook
-    local *HTML::Mason::Commands::session unless $HTML::Mason::Commands::m->is_subrequest;
+    local *HTML::Mason::Commands::session = {} unless $HTML::Mason::Commands::m->is_subrequest;
 
     $HTML::Mason::Commands::m->autoflush( $HTML::Mason::Commands::m->request_comp->attr('AutoFlush') )
         if ( $HTML::Mason::Commands::m->request_comp->attr_exists('AutoFlush') );
@@ -3712,7 +3712,7 @@ sub _UploadedFile {
 
     return {
         Value        => $filename,
-        LargeContent => do { local $/; scalar <$fh> },
+        LargeContent => do { local $/ = undef; scalar <$fh> },
         ContentType  => $upload_info->{'Content-Type'},
     };
 }
diff --git a/lib/RT/Interface/Web/Session.pm b/lib/RT/Interface/Web/Session.pm
index c4cc930..5603f0f 100644
--- a/lib/RT/Interface/Web/Session.pm
+++ b/lib/RT/Interface/Web/Session.pm
@@ -227,7 +227,7 @@ sub _ClearOldDir {
         }
 
         my %session;
-        local $@;
+        local $@ = undef;
         eval { tie %session, $class, $id, $attrs };
         if( $@ ) {
             $RT::Logger->debug("skipped session '$id', couldn't load: $@");
@@ -297,7 +297,7 @@ sub ClearByUser {
     my %seen = ();
     foreach my $id( @{ $self->Ids } ) {
         my %session;
-        local $@;
+        local $@ = undef;
         eval { tie %session, $class, $id, $attrs };
         if( $@ ) {
             $RT::Logger->debug("skipped session '$id', couldn't load: $@");
@@ -325,7 +325,7 @@ sub TIEHASH {
 
     my %session;
 
-    local $@;
+    local $@ = undef;
     eval { tie %session, $class, $id, $attrs };
     eval { tie %session, $class, undef, $attrs } if $@;
     if ( $@ ) {
diff --git a/lib/RT/Record.pm b/lib/RT/Record.pm
index 1013341..6d2d252 100644
--- a/lib/RT/Record.pm
+++ b/lib/RT/Record.pm
@@ -970,7 +970,7 @@ sub Update {
         # and might not have a Name method. But "can" won't find autoloaded
         # items. If it fails, we don't care
         do {
-            local $@;
+            local $@ = undef;
             my $name = eval {
                 my $object = $attribute . "Obj";
                 $self->$object->Name // "";
diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index f05706a..717019b 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -1179,7 +1179,7 @@ sub run_and_capture {
 
     close $child_in;
 
-    my $result = do { local $/; <$child_out> };
+    my $result = do { local $/ = undef; <$child_out> };
     close $child_out;
     waitpid $pid, 0;
     return ($?, $result);
@@ -1708,7 +1708,7 @@ sub file_content {
             warn "couldn't open file '$path': $!" unless $args{noexist};
             return ''
         };
-    my $content = do { local $/; <$fh> };
+    my $content = do { local $/ = undef; <$fh> };
     close $fh;
 
     unlink $path if $args{'unlink'};
@@ -1771,7 +1771,7 @@ END {
 
     # we are in END block and should protect our exit code
     # so calls below may call system or kill that clobbers $?
-    local $?;
+    local $? = 0;
 
     Test::NoWarnings::had_no_warnings() if $check_warnings_in_end;
 
diff --git a/lib/RT/Test/Apache.pm b/lib/RT/Test/Apache.pm
index c944260..5e37440 100644
--- a/lib/RT/Test/Apache.pm
+++ b/lib/RT/Test/Apache.pm
@@ -107,7 +107,7 @@ sub start_server {
 
     RT::Test::diag(do {
         open( my $fh, '<', $tmp{'config'}{'RT'} ) or die $!;
-        local $/;
+        local $/ = undef;
         <$fh>
     });
 
@@ -162,7 +162,7 @@ sub start_server {
                   unless -e $opt{log_file};
 
             open my $log, "<", $opt{log_file};
-            my $error = do {local $/; <$log>};
+            my $error = do {local $/ = undef; <$log>};
             close $log;
             $RT::Logger->error($error) if $error;
             Test::More::BAIL_OUT("Couldn't start apache server!");
diff --git a/lib/RT/Ticket.pm b/lib/RT/Ticket.pm
index 225fce7..ae89384 100644
--- a/lib/RT/Ticket.pm
+++ b/lib/RT/Ticket.pm
@@ -2622,7 +2622,7 @@ sub DESTROY {
     # DESTROY methods need to localize $@, or it may unset it.  This
     # causes $m->abort to not bubble all of the way up.  See perlbug
     # http://rt.perl.org/rt3/Ticket/Display.html?id=17650
-    local $@;
+    local $@ = undef;
 
     # The following line eliminates reentrancy.
     # It protects against the fact that perl doesn't deal gracefully
diff --git a/lib/RT/Tickets.pm b/lib/RT/Tickets.pm
index 4caa4b9..f2e8b9f 100644
--- a/lib/RT/Tickets.pm
+++ b/lib/RT/Tickets.pm
@@ -2509,7 +2509,7 @@ sub CurrentUserCanSee {
             Right => 'SuperUser', Object => $RT::System
         );
 
-    local $self->{using_restrictions};
+    local $self->{using_restrictions} = undef;
 
     my $id = $self->CurrentUser->id;
 
@@ -2798,7 +2798,7 @@ sub _ProcessRestrictions {
     my $sql = $self->Query;
     if ( !$sql || $self->{'RecalcTicketLimits'} ) {
 
-        local $self->{using_restrictions};
+        local $self->{using_restrictions} = undef;
         #  "Restrictions to Clauses Branch\n";
         my $clauseRef = eval { $self->_RestrictionsToClauses; };
         if ($@) {
@@ -3034,7 +3034,7 @@ sub FromSQL {
 
     {
         # preserve first_row and show_rows across the CleanSlate
-        local ($self->{'first_row'}, $self->{'show_rows'}, $self->{_sql_looking_at});
+        local ($self->{'first_row'}, $self->{'show_rows'}, $self->{_sql_looking_at}) = (undef, undef, undef);
         $self->CleanSlate;
         $self->_InitSQL();
     }
diff --git a/share/html/Install/index.html b/share/html/Install/index.html
index f4d9518..f2b6091 100644
--- a/share/html/Install/index.html
+++ b/share/html/Install/index.html
@@ -128,7 +128,7 @@ elsif ( $Run ) {
     $session{'CurrentUser'} = RT::CurrentUser->new;
     $session{'CurrentUser'}->LanguageHandle( $Lang );
 }
-my $lang_handle = do { local $@;
+my $lang_handle = do { local $@ = undef;
     eval {
         ($session{'CurrentUser'} || RT::CurrentUser->new(RT->SystemUser->Id))
             ->LanguageHandle

commit f17bb66e82728d1c7511eebe83b14813cb63aa41
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Jul 25 18:24:59 2011 -0400

    Change occurrences of split( 'string', ... ) into split( /regex/, ... )

diff --git a/lib/RT/Action/CreateTickets.pm b/lib/RT/Action/CreateTickets.pm
index 5ec2f06..455a661 100644
--- a/lib/RT/Action/CreateTickets.pm
+++ b/lib/RT/Action/CreateTickets.pm
@@ -328,7 +328,7 @@ sub CreateByTemplate {
         my ( $id, $transid, $msg )
             = $T::Tickets{$template_id}->Create(%$ticketargs);
 
-        foreach my $res ( split( '\n', $msg ) ) {
+        foreach my $res ( split /\n/, $msg ) {
             push @results,
                 $T::Tickets{$template_id}
                 ->loc( "Ticket [_1]", $T::Tickets{$template_id}->Id ) . ': '
diff --git a/lib/RT/Graph/Tickets.pm b/lib/RT/Graph/Tickets.pm
index 2341ec9..684afc6 100644
--- a/lib/RT/Graph/Tickets.pm
+++ b/lib/RT/Graph/Tickets.pm
@@ -250,7 +250,7 @@ sub AddTicket {
             if ( $fill ) {
                 $node_style{'fillcolor'} = $fill;
                 $node_style{'style'} ||= '';
-                $node_style{'style'} = join ',', split( ',', $node_style{'style'} ), 'filled'
+                $node_style{'style'} = join ',', split( /,/, $node_style{'style'} ), 'filled'
                     unless $node_style{'style'} =~ /\bfilled\b/;
             }
         }
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 931be86..34fdfd3 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -1074,7 +1074,7 @@ sub PathIsSafe {
     # downdirs than updirs. So as soon as we get a negative score
     # (which means "breaking out" of the top level) we reject the path.
 
-    my @components = split '/', $cleaned_up;
+    my @components = split m|/|, $cleaned_up;
     my $score = 0;
     for my $component (@components) {
         if ($component eq '..') {
@@ -2194,7 +2194,7 @@ sub CreateTicket {
         Abort($ErrMsg);
     }
 
-    push( @Actions, split( "\n", $ErrMsg ) );
+    push( @Actions, split( /\n/, $ErrMsg ) );
     unless ( $Ticket->CurrentUserHasRight('ShowTicket') ) {
         Abort( "No permission to view newly created ticket #" . $Ticket->id . "." );
     }

commit f8b241181ba457f8b59ea3608a4ffc66cc9aa611
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Jul 25 21:14:45 2011 -0400

    Check the return value of close()

diff --git a/bin/rt-mailgate.in b/bin/rt-mailgate.in
index 8781266..b0f94c3 100644
--- a/bin/rt-mailgate.in
+++ b/bin/rt-mailgate.in
@@ -298,7 +298,7 @@ sub slurp_message {
         $empty = 0 if $buf =~ /\S/;
         print $fh $buf;
     }
-    close $fh;
+    close $fh or die "Can't close $filename: $!";
 
     if ($empty) {
         print STDERR "$0: no message passed on STDIN\n";
diff --git a/bin/rt.in b/bin/rt.in
index 88d2c2a..6fcc3a2 100644
--- a/bin/rt.in
+++ b/bin/rt.in
@@ -1256,7 +1256,7 @@ sub submit {
                 }
             }
         }
-        close($handle);
+        close($handle) or return 0;
         chmod 0600, $file;
         return 1;
     }
@@ -1574,13 +1574,13 @@ sub vi {
 
     my $handle = File::Temp->new;
     print $handle $text;
-    close($handle);
+    close($handle) or die "Can't write to $handle: $!\n";
 
     system($editor, $handle->filename) && die "Couldn't run $editor.\n";
 
     open( $handle, '<', $handle->filename ) or die "$handle: $!\n";
     $text = <$handle>;
-    close($handle);
+    close($handle) or die "Can't read from $handle: $!\n";
 
     return $text;
 }
diff --git a/devel/tools/extract-message-catalog b/devel/tools/extract-message-catalog
index ba19dca..c328094 100755
--- a/devel/tools/extract-message-catalog
+++ b/devel/tools/extract-message-catalog
@@ -146,7 +146,10 @@ sub extract_strings_from_code {
     }
     local $/ = undef;
     $_ = <$fh>;
-    close $fh;
+    unless (close $fh) {
+        print "Cannot close $file ($!), skipping.\n";
+        return;
+    }
 
     my $errors = 0;
 
diff --git a/devel/tools/license_tag b/devel/tools/license_tag
index 43350ca..bac4483 100755
--- a/devel/tools/license_tag
+++ b/devel/tools/license_tag
@@ -119,9 +119,9 @@ sub tag_mason {
         my $pm = $_;
         return unless (-f $pm);
         return if $pm =~ /\.(?:png|jpe?g|gif)$/;
-        open( my $fh, '<', $pm ) or die "Failed to open $pm";
+        open( my $fh, '<', $pm ) or die "Failed to open $pm: $!";
         my $file = (join "", <$fh>);
-        close ($fh);
+        close ($fh) or die "Failed to close $pm: $!";
         print "$pm - ";
         return if another_license($pm => $file) && print "has different license\n";
 
@@ -143,18 +143,17 @@ sub tag_mason {
 
 
 
-        open( $fh, '>', $pm ) or die "couldn't write new file";
+        open( $fh, '>', $pm ) or die "Failed to write $pm: $!";
         print $fh $file;
-        close $fh;
-
+        close $fh or die "Failed to close $pm: $!";
 }
 
 
 sub tag_makefile {
         my $pm = shift;
-        open( my $fh, '<', $pm ) or die "Failed to open $pm";
+        open( my $fh, '<', $pm ) or die "Failed to open $pm: $!";
         my $file = (join "", <$fh>);
-        close ($fh);
+        close ($fh) or die "Failed to close $pm: $!";
         print "$pm - ";
         return if another_license($pm => $file) && print "has different license\n";
 
@@ -176,19 +175,18 @@ sub tag_makefile {
 
 
 
-        open( $fh, '>', $pm ) or die "couldn't write new file";
+        open( $fh, '>', $pm ) or die "Failed to write $pm: $!";
         print $fh $file;
-        close $fh;
-
+        close $fh or die "Failed to close $pm: $!";
 }
 
 
 sub tag_pm {
         my $pm = $_;
         return unless $pm =~ /\.pm/s;
-        open( my $fh, '<', $pm ) or die "Failed to open $pm";
+        open( my $fh, '<', $pm ) or die "Failed to open $pm: $!";
         my $file = (join "", <$fh>);
-        close ($fh);
+        close ($fh) or die "Failed to close $pm: $!";
         print "$pm - ";
         return if another_license($pm => $file) && print "has different license\n";
 
@@ -210,19 +208,18 @@ sub tag_pm {
 
 
 
-        open( $fh, '>', $pm ) or die "couldn't write new file $pm";
+        open( $fh, '>', $pm ) or die "Failed to write $pm: $!";
         print $fh $file;
-        close $fh;
-
+        close $fh or die "Failed to close $pm: $!";
 }
 
 
 sub tag_script {
         my $pm = $_;
         return unless (-f $pm);
-        open( my $fh, '<', $pm ) or die "Failed to open $pm";
+        open( my $fh, '<', $pm ) or die "Failed to open $pm: $!";
         my $file = (join "", <$fh>);
-        close ($fh);
+        close ($fh) or die "Failed to close $pm: $!";
         print "$pm - ";
         return if another_license($pm => $file) && print "has different license\n";
 
@@ -247,10 +244,9 @@ sub tag_script {
         print "\n";
 
 
-        open( $fh, '>', $pm ) or die "couldn't write new file";
+        open( $fh, '>', $pm ) or die "Failed to write $pm: $!";
         print $fh $file;
-        close $fh;
-
+        close $fh or die "Failed to close $pm: $!";
 }
 
 sub another_license {
diff --git a/lib/RT/EmailParser.pm b/lib/RT/EmailParser.pm
index edfd37f..12a01ac 100644
--- a/lib/RT/EmailParser.pm
+++ b/lib/RT/EmailParser.pm
@@ -119,7 +119,7 @@ sub SmartParseMIMEEntityFromScalar {
             binmode $fh;
             $fh->autoflush(1);
             print $fh $args{'Message'};
-            close($fh);
+            close($fh) or warn "Can't close tmpfile: $!";
             if ( -f $temp_file ) {
 
                 my $entity = $self->ParseMIMEEntityFromFile( $temp_file, $args{'Decode'}, $args{'Exact'} );
diff --git a/lib/RT/Handle.pm b/lib/RT/Handle.pm
index 1b747dc..b8c2de5 100644
--- a/lib/RT/Handle.pm
+++ b/lib/RT/Handle.pm
@@ -511,14 +511,18 @@ sub InsertSchema {
 
     my (@schema);
 
-    open( my $fh_schema, '<', $file ) or die $!;
+    open( my $fh_schema, '<', $file ) or die "Can't read $file: $!";
+    my @lines = (<$fh_schema>, ";;");
+    close($fh_schema) or die "Can't close $file: $!";
 
-    my $has_local = 0;
-    open( my $fh_schema_local, "<" . $self->GetVersionFile( $dbh, $RT::LocalEtcPath . "/schema." . $db_type ))
-        and $has_local = 1;
+    my $local_file = $self->GetVersionFile( $dbh, $RT::LocalEtcPath . "/schema." . $db_type );
+    if (open( my $fh_schema_local, "<", $local_file)) {
+        push @lines, <$fh_schema_local>;
+        close($fh_schema_local) or die "Can't close $local_file: $!";
+    }
 
     my $statement = "";
-    foreach my $line ( <$fh_schema>, ($_ = ';;'), $has_local? <$fh_schema_local>: () ) {
+    foreach my $line ( @lines ) {
         $line =~ s/\#.*//g;
         $line =~ s/--.*//g;
         $statement .= $line;
@@ -528,7 +532,6 @@ sub InsertSchema {
             $statement = "";
         }
     }
-    close $fh_schema; close $fh_schema_local;
 
     if ( $db_type eq 'Oracle' ) {
         my $db_user = RT->Config->Get('DatabaseUser');
diff --git a/lib/RT/Installer.pm b/lib/RT/Installer.pm
index 1632f6e..45a8ab5 100644
--- a/lib/RT/Installer.pm
+++ b/lib/RT/Installer.pm
@@ -288,7 +288,7 @@ sub SaveConfig {
         }
         $content .= "1;\n";
         print $fh $content;
-        close $fh;
+        close $fh or return(0, "Failed to write $file: $!");
 
         return ( 1, "Successfully saved configuration to $file." );
     }
diff --git a/lib/RT/Interface/Web.pm b/lib/RT/Interface/Web.pm
index 34fdfd3..2c7886c 100644
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -1136,7 +1136,7 @@ sub SendStaticFile {
         $HTML::Mason::Commands::m->out($_) while (<$fh>);
         $HTML::Mason::Commands::m->flush_buffer;
     }
-    close $fh;
+    close $fh or die "Couldn't close $file: $!";
 }
 
 
diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index 717019b..d3a8372 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -363,7 +363,7 @@ END
 
     print $config "\n1;\n";
     $ENV{'RT_SITE_CONFIG'} = $tmp{'config'}{'RT'};
-    close $config;
+    close $config or die "Failed to write $tmp{config}{RT}: $!";
 
     return $config;
 }
@@ -418,7 +418,7 @@ sub set_config_wrapper {
                 $lines[-1] .= $_;
             }
         }
-        close $fh;
+        close $fh or die "Failed to write $tmp{config}{RT}: $!";
 
         # Traim trailing newlines and "1;"
         $lines[-1] =~ s/(^1;\n|^\n)*\Z//m;
@@ -1177,10 +1177,10 @@ sub run_and_capture {
 
     $after_open->($child_in, $child_out) if $after_open;
 
-    close $child_in;
+    close $child_in or die "Failed to close child stdin pipe: $!";
 
     my $result = do { local $/ = undef; <$child_out> };
-    close $child_out;
+    close $child_out or die "Failed to close child stdout pipe: $!";
     waitpid $pid, 0;
     return ($?, $result);
 }
@@ -1709,7 +1709,7 @@ sub file_content {
             return ''
         };
     my $content = do { local $/ = undef; <$fh> };
-    close $fh;
+    close $fh or die "Failed to close $path: $!";
 
     unlink $path if $args{'unlink'};
 
diff --git a/share/html/Install/index.html b/share/html/Install/index.html
index f2b6091..5dd317a 100644
--- a/share/html/Install/index.html
+++ b/share/html/Install/index.html
@@ -96,8 +96,8 @@ my $file = RT::Installer->ConfigFile;
 
 if ( ! -e $file ) {
     # write a blank RT_SiteConfig.pm
-    open( my $fh, '>', $file ) or die $!;
-    close $fh;
+    open( my $fh, '>', $file ) or die "Failed to write $file: $!";
+    close $fh or die "Failed to write $file: $!";
 }
 elsif ( ! -w $file ) {
     $locked = 1;

commit 6715d637b24eb7327142c80c4769c51b5122f7e6
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Apr 9 16:01:35 2015 -0700

    Proper localization of $_ reveals wrong variable in use

diff --git a/t/web/charting.t b/t/web/charting.t
index 5131f9c..d313861 100644
--- a/t/web/charting.t
+++ b/t/web/charting.t
@@ -10,15 +10,15 @@ for my $n (1..7) {
     my $ticket = RT::Ticket->new( RT->SystemUser );
     my $req = 'root' . ($n % 2) . '@localhost';
     my ( $ret, $msg ) = $ticket->Create(
-        Subject   => "base ticket $_",
+        Subject   => "base ticket $n",
         Queue     => "General",
         Owner     => "root",
         Requestor => $req,
         MIMEObj   => MIME::Entity->build(
             From    => $req,
             To      => 'rt at localhost',
-            Subject => "base ticket $_",
-            Data    => "Content $_",
+            Subject => "base ticket $n",
+            Data    => "Content $n",
         ),
     );
     ok( $ret, "ticket $n created: $msg" );

commit 4a5b757c3945e4901e8b864518f5cb218ef5684b
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Apr 9 17:03:45 2015 -0700

    Remove a useless use of require "path/to/file.pm"

diff --git a/lib/RT.pm b/lib/RT.pm
index 067763e..3bf9a74 100644
--- a/lib/RT.pm
+++ b/lib/RT.pm
@@ -742,9 +742,8 @@ sub InstallMode {
 
 sub LoadGeneratedData {
     my $class = shift;
-    my $pm_path = ( File::Spec->splitpath( $INC{'RT.pm'} ) )[1];
 
-    require "$pm_path/RT/Generated.pm" || die "Couldn't load RT::Generated: $@";
+    require RT::Generated;
     $class->CanonicalizeGeneratedPaths();
 }
 

commit e492df6ee649cc57d73d95964b51f48ad31b6d68
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Apr 9 17:04:30 2015 -0700

    Move "use strict; use warnings;" to top

diff --git a/lib/RT/ACE.pm b/lib/RT/ACE.pm
index c27a82b..9bbe441 100644
--- a/lib/RT/ACE.pm
+++ b/lib/RT/ACE.pm
@@ -63,14 +63,12 @@
 
 
 package RT::ACE;
-use base 'RT::Record';
-
-sub Table {'ACL'}
-
-
 use strict;
 use warnings;
 
+use base 'RT::Record';
+sub Table {'ACL'}
+
 require RT::Principals;
 require RT::Queues;
 require RT::Groups;
diff --git a/lib/RT/ACL.pm b/lib/RT/ACL.pm
index 89ca69f..a9b434b 100644
--- a/lib/RT/ACL.pm
+++ b/lib/RT/ACL.pm
@@ -65,14 +65,14 @@ my $ACL = RT::ACL->new($CurrentUser);
 
 
 package RT::ACL;
+use strict;
+use warnings;
+
 use base 'RT::SearchBuilder';
+sub Table { 'ACL'}
 
 use RT::ACE;
 
-sub Table { 'ACL'}
-
-use strict;
-use warnings;
 
 
 
diff --git a/lib/RT/Attachment.pm b/lib/RT/Attachment.pm
index 81deb2e..0615229 100644
--- a/lib/RT/Attachment.pm
+++ b/lib/RT/Attachment.pm
@@ -64,16 +64,11 @@ similar objects.
 
 
 package RT::Attachment;
-use base 'RT::Record';
-
-sub Table {'Attachments'}
-
-
-
-
 use strict;
 use warnings;
 
+use base 'RT::Record';
+sub Table {'Attachments'}
 
 use RT::Transaction;
 use MIME::Base64;
diff --git a/t/ticket/sort_by_cf.t b/t/ticket/sort_by_cf.t
index 30f6ad8..ef32dfa 100644
--- a/t/ticket/sort_by_cf.t
+++ b/t/ticket/sort_by_cf.t
@@ -1,9 +1,9 @@
+use strict;
+use warnings;
 
 use RT::Test nodata => 1, tests => 21;
 RT::Init();
 
-use strict;
-use warnings;
 
 use RT::Tickets;
 use RT::Queue;

commit 58e31715949e177d055ff1196e90379d168594ee
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Apr 9 17:11:22 2015 -0700

    Switch from lax (":utf8") to strict (":encoding(UTF-8)") layers

diff --git a/sbin/rt-dump-metadata.in b/sbin/rt-dump-metadata.in
index 2b57476..75f97d7 100644
--- a/sbin/rt-dump-metadata.in
+++ b/sbin/rt-dump-metadata.in
@@ -51,7 +51,7 @@ use warnings;
 
 # As we specify that XML is UTF-8 and we output it to STDOUT, we must be sure
 # it is UTF-8 so further XMLin will not break
-binmode( STDOUT, ":utf8" );
+binmode( STDOUT, ":encoding(UTF-8)" );
 
 # fix lib paths, some may be relative
 BEGIN { # BEGIN RT CMD BOILERPLATE
diff --git a/sbin/rt-setup-fulltext-index.in b/sbin/rt-setup-fulltext-index.in
index bffd6dd..5dafccf 100644
--- a/sbin/rt-setup-fulltext-index.in
+++ b/sbin/rt-setup-fulltext-index.in
@@ -499,7 +499,7 @@ sub ora_create_stop_list {
             undef, $name, 'BASIC_STOPLIST'
         );
 
-        open( my $fh, '<:utf8', $file )
+        open( my $fh, '<:encoding(UTF-8)', $file )
             or die "couldn't open file '$file': $!";
         while ( my $word = <$fh> ) {
             chomp $word;
diff --git a/t/web/attachment_encoding.t b/t/web/attachment_encoding.t
index 3f7d6d1..5e567a4 100644
--- a/t/web/attachment_encoding.t
+++ b/t/web/attachment_encoding.t
@@ -46,8 +46,7 @@ diag 'test with attachemnts' if $ENV{TEST_VERBOSE};
 
     my $file =
       File::Spec->catfile( RT::Test->temp_directory, Encode::encode("UTF-8",$filename) );
-    open( my $fh, '>', $file ) or die $!;
-    binmode $fh, ':utf8';
+    open( my $fh, '>:encoding(UTF-8)', $file ) or die $!;
     print $fh $filename;
     close $fh;
 

commit 1638437a1285b2c396acfe531383b0cf1dcbb4fa
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Apr 9 17:11:33 2015 -0700

    Make the octal-ness of this constant explicit

diff --git a/t/99-policy.t b/t/99-policy.t
index f7f800f..e8fc814 100644
--- a/t/99-policy.t
+++ b/t/99-policy.t
@@ -81,7 +81,7 @@ sub check {
         }
     }
 
-    my $executable = ( stat $file )[2] & 0100;
+    my $executable = ( stat $file )[2] & oct(100);
     if ($check{exec} == 1) {
         if ( $file =~ /\.in$/ ) {
             ok( !$executable, "$file permission is u-x (.in will add +x)" );

commit 046ee5801296c41298916de107c7fb89b57bab2b
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Apr 9 17:12:26 2015 -0700

    Add "use strict" to test plugins as well

diff --git a/t/data/plugins/MakeClicky/lib/MakeClicky.pm b/t/data/plugins/MakeClicky/lib/MakeClicky.pm
index c09f55b..0cdc344 100644
--- a/t/data/plugins/MakeClicky/lib/MakeClicky.pm
+++ b/t/data/plugins/MakeClicky/lib/MakeClicky.pm
@@ -1,2 +1,5 @@
 package MakeClicky;
+use strict;
+use warnings;
+
 1;
diff --git a/t/data/plugins/Overlays/lib/Overlays.pm b/t/data/plugins/Overlays/lib/Overlays.pm
index f18b458..86b6b4a 100644
--- a/t/data/plugins/Overlays/lib/Overlays.pm
+++ b/t/data/plugins/Overlays/lib/Overlays.pm
@@ -1,2 +1,5 @@
 package Overlays;
+use strict;
+use warnings;
+
 1;
diff --git a/t/data/plugins/RT-Extension-PSGIWrap/lib/RT/Extension/PSGIWrap.pm b/t/data/plugins/RT-Extension-PSGIWrap/lib/RT/Extension/PSGIWrap.pm
index 1d0a55e..d18ec39 100644
--- a/t/data/plugins/RT-Extension-PSGIWrap/lib/RT/Extension/PSGIWrap.pm
+++ b/t/data/plugins/RT-Extension-PSGIWrap/lib/RT/Extension/PSGIWrap.pm
@@ -1,4 +1,6 @@
 package RT::Extension::PSGIWrap;
+use strict;
+use warnings;
 
 use base 'Plack::Middleware';
 

commit b6310843f68af632eaef3f0c29c5134acabd938b
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Thu Apr 9 17:22:00 2015 -0700

    Move standalone t/lifecycles/utils.pl to being an RT::Test

diff --git a/t/lifecycles/utils.pl b/lib/RT/Test/Lifecycle.pm
similarity index 53%
rename from t/lifecycles/utils.pl
rename to lib/RT/Test/Lifecycle.pm
index 4dbba23..e634fd8 100644
--- a/t/lifecycles/utils.pl
+++ b/lib/RT/Test/Lifecycle.pm
@@ -1,12 +1,62 @@
+# BEGIN BPS TAGGED BLOCK {{{
+#
+# COPYRIGHT:
+#
+# This software is Copyright (c) 1996-2015 Best Practical Solutions, LLC
+#                                          <sales at bestpractical.com>
+#
+# (Except where explicitly superseded by other copyright notices)
+#
+#
+# LICENSE:
+#
+# This work is made available to you under the terms of Version 2 of
+# the GNU General Public License. A copy of that license should have
+# been provided with this software, but in any event can be snarfed
+# from www.gnu.org.
+#
+# This work is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301 or visit their web page on the internet at
+# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+#
+#
+# CONTRIBUTION SUBMISSION POLICY:
+#
+# (The following paragraph is not intended to limit the rights granted
+# to you to modify and distribute this software under the terms of
+# the GNU General Public License and is only of importance to you if
+# you choose to contribute your changes and enhancements to the
+# community by submitting them to Best Practical Solutions, LLC.)
+#
+# By intentionally submitting any modifications, corrections or
+# derivatives to this work, or any other work intended for use with
+# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+# you are the copyright holder for those contributions and you grant
+# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
+# royalty-free, perpetual, license to use, copy, create derivative
+# works based on those contributions, and sublicense and distribute
+# those contributions and any derivatives thereof.
+#
+# END BPS TAGGED BLOCK }}}
 
 use strict;
 use warnings;
 
+package RT::Test::Lifecycle;
+use base 'RT::Test';
 
-my $config;
-BEGIN {
-$config = <<END;
-Set(\%Lifecycles,
+sub bootstrap_more_config {
+    my $self = shift;
+    my ($config, $args) = @_;
+    print $config <<'EOT';
+Set(%Lifecycles,
     default => {
         initial  => [qw(new)],
         active   => [qw(open stalled)],
@@ -69,9 +119,7 @@ Set(\%Lifecycles,
         inactive => ['first', 'second', 'third', 'no-place'],
     },
 );
-END
+EOT
 }
 
-use RT::Test config => $config, tests => undef;
-
 1;
diff --git a/t/lifecycles/basics.t b/t/lifecycles/basics.t
index e18bea3..15bf508 100644
--- a/t/lifecycles/basics.t
+++ b/t/lifecycles/basics.t
@@ -1,7 +1,7 @@
 use strict;
 use warnings;
 
-BEGIN {require  't/lifecycles/utils.pl'};
+use RT::Test::Lifecycle tests => undef;
 
 my $general = RT::Test->load_or_create_queue(
     Name => 'General',
diff --git a/t/lifecycles/dates.t b/t/lifecycles/dates.t
index 0c74a1b..b66a05f 100644
--- a/t/lifecycles/dates.t
+++ b/t/lifecycles/dates.t
@@ -1,7 +1,7 @@
 use strict;
 use warnings;
 
-BEGIN {require 't/lifecycles/utils.pl'};
+use RT::Test::Lifecycle tests => undef;
 
 my $general = RT::Test->load_or_create_queue(
     Name => 'General',
diff --git a/t/lifecycles/moving.t b/t/lifecycles/moving.t
index 8a03e3e..52310c2 100644
--- a/t/lifecycles/moving.t
+++ b/t/lifecycles/moving.t
@@ -1,7 +1,7 @@
 use strict;
 use warnings;
 
-BEGIN {require 't/lifecycles/utils.pl'};
+use RT::Test::Lifecycle tests => undef;
 
 my $general = RT::Test->load_or_create_queue(
     Name => 'General',
diff --git a/t/lifecycles/types.t b/t/lifecycles/types.t
index 79b0714..b39419e 100644
--- a/t/lifecycles/types.t
+++ b/t/lifecycles/types.t
@@ -1,7 +1,7 @@
 use strict;
 use warnings;
 
-BEGIN {require  't/lifecycles/utils.pl'};
+use RT::Test::Lifecycle tests => undef;
 
 is_deeply( [ RT::Lifecycle->ListAll ], [qw/ approvals default delivery /],
        "Get the list of all lifecycles (implicitly for for tickets)");
diff --git a/t/lifecycles/unresolved-deps.t b/t/lifecycles/unresolved-deps.t
index 5da4b8f..1e586ce 100644
--- a/t/lifecycles/unresolved-deps.t
+++ b/t/lifecycles/unresolved-deps.t
@@ -1,7 +1,7 @@
 use strict;
 use warnings;
 
-BEGIN {require  't/lifecycles/utils.pl'};
+use RT::Test::Lifecycle tests => undef;
 
 my $general = RT::Test->load_or_create_queue(
     Name => 'General',

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


More information about the rt-commit mailing list