[Rt-commit] rt branch, 3.8/perlcritic, created. rt-3.8.10-19-g2e75855

Alex Vandiver alexmv at bestpractical.com
Wed Jun 29 12:29:06 EDT 2011


The branch, 3.8/perlcritic has been created
        at  2e75855bc6a97c09ea61fcb55e9a56ad440f8704 (commit)

- Log -----------------------------------------------------------------
commit a30e20a9719123c86c3d0984f5082b97f30c1c8a
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Jun 28 13:08:26 2011 -0400

    Remove server-side FCKEditor scripts
    
    While these could never be executed, remove them anyway.

diff --git a/share/html/NoAuth/RichText/FCKeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.cfm b/share/html/NoAuth/RichText/FCKeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.cfm
deleted file mode 100644
index 27e368e..0000000
--- a/share/html/NoAuth/RichText/FCKeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.cfm
+++ /dev/null
@@ -1,148 +0,0 @@
-<cfsetting enablecfoutputonly="true">
-<!---
-This code uses a CF User Defined Function and should work in CF version 5.0
-and up without alteration.
-
-Also if you are hosting your site at an ISP, you will have to check with them
-to see if the use of <CFEXECUTE> is allowed. In most cases ISP will not allow
-the use of that tag for security reasons. Clients would be able to access each
-others files in certain cases.
---->
-
-<!--- The following variables values must reflect your installation. --->
-<cfset aspell_dir	  = "C:\Program Files\Aspell\bin">
-<cfset lang         = "en_US">
-<cfset aspell_opts  = "-a --lang=#lang# --encoding=utf-8 -H --rem-sgml-check=alt">
-<cfset tempfile_in  = GetTempFile(GetTempDirectory(), "spell_")>
-<cfset tempfile_out = GetTempFile(GetTempDirectory(), "spell_")>
-<cfset spellercss   = "../spellerStyle.css">
-<cfset word_win_src = "../wordWindow.js">
-
-<cfset form.checktext = form["textinputs[]"]>
-
-<!--- make no difference between URL and FORM scopes --->
-<cfparam name="url.checktext"  default="">
-<cfparam name="form.checktext" default="#url.checktext#">
-
-<!--- Takes care of those pesky smart quotes from MS apps, replaces them with regular quotes --->
-<cfset submitted_text = ReplaceList(form.checktext,"%u201C,%u201D","%22,%22")>
-
-<!--- submitted_text now is ready for processing --->
-
-<!--- use carat on each line to escape possible aspell commands --->
-<cfset text = "">
-<cfset CRLF = Chr(13) & Chr(10)>
-
-<cfloop list="#submitted_text#" index="field" delimiters=",">
-	<cfset text = text & "%"  & CRLF
-                      & "^A" & CRLF
-                      & "!"  & CRLF>
-	<!--- Strip all tags for the text. (by FredCK - #339 / #681) --->
-	<cfset field = REReplace(URLDecode(field), "<[^>]+>", " ", "all")>
-	<cfloop list="#field#" index="line" delimiters="#CRLF#">
-		<cfset text = ListAppend(text, "^" & Trim(JSStringFormat(line)), CRLF)>
-	</cfloop>
-</cfloop>
-
-<!--- create temp file from the submitted text, this will be passed to aspell to be check for misspelled words --->
-<cffile action="write" file="#tempfile_in#" output="#text#" charset="utf-8">
-
-<!--- execute aspell in an UTF-8 console and redirect output to a file. UTF-8 encoding is lost if done differently --->
-<cfexecute name="cmd.exe" arguments='/c type "#tempfile_in#" | "#aspell_dir#\aspell.exe" #aspell_opts# > "#tempfile_out#"' timeout="100"/>
-
-<!--- read output file for further processing --->
-<cffile action="read" file="#tempfile_out#" variable="food" charset="utf-8">
-
-<!--- remove temp files --->
-<cffile action="delete" file="#tempfile_in#">
-<cffile action="delete" file="#tempfile_out#">
-
-<cfset texts = StructNew()>
-<cfset texts.textinputs = "">
-<cfset texts.words      = "">
-<cfset texts.abort      = "">
-
-<!--- Generate Text Inputs --->
-<cfset i = 0>
-<cfloop list="#submitted_text#" index="textinput">
-  <cfset texts.textinputs = ListAppend(texts.textinputs, 'textinputs[#i#] = decodeURIComponent("#textinput#");', CRLF)>
-  <cfset i = i + 1>
-</cfloop>
-
-<!--- Generate Words Lists --->
-<cfset word_cnt  = 0>
-<cfset input_cnt = -1>
-<cfloop list="#food#" index="aspell_line" delimiters="#CRLF#">
-    <cfset leftChar = Left(aspell_line, 1)>
-	<cfif leftChar eq "*">
-			<cfset input_cnt   = input_cnt + 1>
-			<cfset word_cnt    = 0>
-			<cfset texts.words = ListAppend(texts.words, "words[#input_cnt#] = [];", CRLF)>
-			<cfset texts.words = ListAppend(texts.words, "suggs[#input_cnt#] = [];", CRLF)>
-    <cfelse>
-        <cfif leftChar eq "&" or leftChar eq "##">
-			<!--- word that misspelled --->
-			<cfset bad_word    = Trim(ListGetAt(aspell_line, 2, " "))>
-			<cfset bad_word    = Replace(bad_word, "'", "\'", "ALL")>
-			<!--- sugestions --->
-			<cfset sug_list    = Trim(ListRest(aspell_line, ":"))>
-			<cfset sug_list    = ListQualify(Replace(sug_list, "'", "\'", "ALL"), "'")>
-			<!--- javascript --->
-			<cfset texts.words = ListAppend(texts.words, "words[#input_cnt#][#word_cnt#] = '#bad_word#';", CRLF)>
-			<cfset texts.words = ListAppend(texts.words, "suggs[#input_cnt#][#word_cnt#] = [#sug_list#];", CRLF)>
-			<cfset word_cnt    = word_cnt + 1>
-		</cfif>
-     </cfif>
-</cfloop>
-
-<cfif texts.words eq "">
-  <cfset texts.abort = "alert('Spell check complete.\n\nNo misspellings found.'); top.window.close();">
-</cfif>
-
-<cfcontent type="text/html; charset=utf-8">
-
-<cfoutput><html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-<link rel="stylesheet" type="text/css" href="#spellercss#" />
-<script language="javascript" src="#word_win_src#"></script>
-<script language="javascript">
-var suggs      = new Array();
-var words      = new Array();
-var textinputs = new Array();
-var error;
-
-#texts.textinputs##CRLF#
-#texts.words#
-#texts.abort#
-
-var wordWindowObj = new wordWindow();
-wordWindowObj.originalSpellings = words;
-wordWindowObj.suggestions = suggs;
-wordWindowObj.textInputs = textinputs;
-
-function init_spell() {
-	// check if any error occured during server-side processing
-	if( error ) {
-		alert( error );
-	} else {
-		// call the init_spell() function in the parent frameset
-		if (parent.frames.length) {
-			parent.init_spell( wordWindowObj );
-		} else {
-			alert('This page was loaded outside of a frameset. It might not display properly');
-		}
-	}
-}
-</script>
-
-</head>
-<body onLoad="init_spell();">
-
-<script type="text/javascript">
-wordWindowObj.writeBody();
-</script>
-
-</body>
-</html></cfoutput>
-<cfsetting enablecfoutputonly="false">
diff --git a/share/html/NoAuth/RichText/FCKeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.php b/share/html/NoAuth/RichText/FCKeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.php
deleted file mode 100644
index 9c747c9..0000000
--- a/share/html/NoAuth/RichText/FCKeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.php
+++ /dev/null
@@ -1,199 +0,0 @@
-<?php
-header('Content-type: text/html; charset=utf-8');
-
-// The following variables values must reflect your installation needs.
-
-$aspell_prog	= '"C:\Program Files\Aspell\bin\aspell.exe"';	// by FredCK (for Windows)
-//$aspell_prog	= 'aspell';										// by FredCK (for Linux)
-
-$lang			= 'en_US';
-$aspell_opts	= "-a --lang=$lang --encoding=utf-8 -H --rem-sgml-check=alt";		// by FredCK
-
-$tempfiledir	= "./";
-
-$spellercss		= '../spellerStyle.css';						// by FredCK
-$word_win_src	= '../wordWindow.js';							// by FredCK
-
-$textinputs		= $_POST['textinputs']; # array
-$input_separator = "A";
-
-# set the JavaScript variable to the submitted text.
-# textinputs is an array, each element corresponding to the (url-encoded)
-# value of the text control submitted for spell-checking
-function print_textinputs_var() {
-	global $textinputs;
-	foreach( $textinputs as $key=>$val ) {
-		# $val = str_replace( "'", "%27", $val );
-		echo "textinputs[$key] = decodeURIComponent(\"" . $val . "\");\n";
-	}
-}
-
-# make declarations for the text input index
-function print_textindex_decl( $text_input_idx ) {
-	echo "words[$text_input_idx] = [];\n";
-	echo "suggs[$text_input_idx] = [];\n";
-}
-
-# set an element of the JavaScript 'words' array to a misspelled word
-function print_words_elem( $word, $index, $text_input_idx ) {
-	echo "words[$text_input_idx][$index] = '" . escape_quote( $word ) . "';\n";
-}
-
-
-# set an element of the JavaScript 'suggs' array to a list of suggestions
-function print_suggs_elem( $suggs, $index, $text_input_idx ) {
-	echo "suggs[$text_input_idx][$index] = [";
-	foreach( $suggs as $key=>$val ) {
-		if( $val ) {
-			echo "'" . escape_quote( $val ) . "'";
-			if ( $key+1 < count( $suggs )) {
-				echo ", ";
-			}
-		}
-	}
-	echo "];\n";
-}
-
-# escape single quote
-function escape_quote( $str ) {
-	return preg_replace ( "/'/", "\\'", $str );
-}
-
-
-# handle a server-side error.
-function error_handler( $err ) {
-	echo "error = '" . preg_replace( "/['\\\\]/", "\\\\$0", $err ) . "';\n";
-}
-
-## get the list of misspelled words. Put the results in the javascript words array
-## for each misspelled word, get suggestions and put in the javascript suggs array
-function print_checker_results() {
-
-	global $aspell_prog;
-	global $aspell_opts;
-	global $tempfiledir;
-	global $textinputs;
-	global $input_separator;
-	$aspell_err = "";
-	# create temp file
-	$tempfile = tempnam( $tempfiledir, 'aspell_data_' );
-
-	# open temp file, add the submitted text.
-	if( $fh = fopen( $tempfile, 'w' )) {
-		for( $i = 0; $i < count( $textinputs ); $i++ ) {
-			$text = urldecode( $textinputs[$i] );
-
-			// Strip all tags for the text. (by FredCK - #339 / #681)
-			$text = preg_replace( "/<[^>]+>/", " ", $text ) ;
-
-			$lines = explode( "\n", $text );
-			fwrite ( $fh, "%\n" ); # exit terse mode
-			fwrite ( $fh, "^$input_separator\n" );
-			fwrite ( $fh, "!\n" ); # enter terse mode
-			foreach( $lines as $key=>$value ) {
-				# use carat on each line to escape possible aspell commands
-				fwrite( $fh, "^$value\n" );
-			}
-		}
-		fclose( $fh );
-
-		# exec aspell command - redirect STDERR to STDOUT
-		$cmd = "$aspell_prog $aspell_opts < $tempfile 2>&1";
-		if( $aspellret = shell_exec( $cmd )) {
-			$linesout = explode( "\n", $aspellret );
-			$index = 0;
-			$text_input_index = -1;
-			# parse each line of aspell return
-			foreach( $linesout as $key=>$val ) {
-				$chardesc = substr( $val, 0, 1 );
-				# if '&', then not in dictionary but has suggestions
-				# if '#', then not in dictionary and no suggestions
-				# if '*', then it is a delimiter between text inputs
-				# if '@' then version info
-				if( $chardesc == '&' || $chardesc == '#' ) {
-					$line = explode( " ", $val, 5 );
-					print_words_elem( $line[1], $index, $text_input_index );
-					if( isset( $line[4] )) {
-						$suggs = explode( ", ", $line[4] );
-					} else {
-						$suggs = array();
-					}
-					print_suggs_elem( $suggs, $index, $text_input_index );
-					$index++;
-				} elseif( $chardesc == '*' ) {
-					$text_input_index++;
-					print_textindex_decl( $text_input_index );
-					$index = 0;
-				} elseif( $chardesc != '@' && $chardesc != "" ) {
-					# assume this is error output
-					$aspell_err .= $val;
-				}
-			}
-			if( $aspell_err ) {
-				$aspell_err = "Error executing `$cmd`\\n$aspell_err";
-				error_handler( $aspell_err );
-			}
-		} else {
-			error_handler( "System error: Aspell program execution failed (`$cmd`)" );
-		}
-	} else {
-		error_handler( "System error: Could not open file '$tempfile' for writing" );
-	}
-
-	# close temp file, delete file
-	unlink( $tempfile );
-}
-
-
-?>
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-<link rel="stylesheet" type="text/css" href="<?php echo $spellercss ?>" />
-<script language="javascript" src="<?php echo $word_win_src ?>"></script>
-<script language="javascript">
-var suggs = new Array();
-var words = new Array();
-var textinputs = new Array();
-var error;
-<?php
-
-print_textinputs_var();
-
-print_checker_results();
-
-?>
-
-var wordWindowObj = new wordWindow();
-wordWindowObj.originalSpellings = words;
-wordWindowObj.suggestions = suggs;
-wordWindowObj.textInputs = textinputs;
-
-function init_spell() {
-	// check if any error occured during server-side processing
-	if( error ) {
-		alert( error );
-	} else {
-		// call the init_spell() function in the parent frameset
-		if (parent.frames.length) {
-			parent.init_spell( wordWindowObj );
-		} else {
-			alert('This page was loaded outside of a frameset. It might not display properly');
-		}
-	}
-}
-
-
-
-</script>
-
-</head>
-<!-- <body onLoad="init_spell();">		by FredCK -->
-<body onLoad="init_spell();" bgcolor="#ffffff">
-
-<script type="text/javascript">
-wordWindowObj.writeBody();
-</script>
-
-</body>
-</html>
diff --git a/share/html/NoAuth/RichText/FCKeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.pl b/share/html/NoAuth/RichText/FCKeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.pl
deleted file mode 100644
index fae010d..0000000
--- a/share/html/NoAuth/RichText/FCKeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.pl
+++ /dev/null
@@ -1,181 +0,0 @@
-#!/usr/bin/perl
-
-use CGI qw/ :standard /;
-use File::Temp qw/ tempfile tempdir /;
-
-# my $spellercss = '/speller/spellerStyle.css';					# by FredCK
-my $spellercss = '../spellerStyle.css';							# by FredCK
-# my $wordWindowSrc = '/speller/wordWindow.js';					# by FredCK
-my $wordWindowSrc = '../wordWindow.js';							# by FredCK
-my @textinputs = param( 'textinputs[]' ); # array
-# my $aspell_cmd = 'aspell';									# by FredCK (for Linux)
-my $aspell_cmd = '"C:\Program Files\Aspell\bin\aspell.exe"';	# by FredCK (for Windows)
-my $lang = 'en_US';
-# my $aspell_opts = "-a --lang=$lang --encoding=utf-8";			# by FredCK
-my $aspell_opts = "-a --lang=$lang --encoding=utf-8 -H --rem-sgml-check=alt";		# by FredCK
-my $input_separator = "A";
-
-# set the 'wordtext' JavaScript variable to the submitted text.
-sub printTextVar {
-	for( my $i = 0; $i <= $#textinputs; $i++ ) {
-	        print "textinputs[$i] = decodeURIComponent('" . escapeQuote( $textinputs[$i] ) . "')\n";
-	}
-}
-
-sub printTextIdxDecl {
-	my $idx = shift;
-	print "words[$idx] = [];\n";
-	print "suggs[$idx] = [];\n";
-}
-
-sub printWordsElem {
-	my( $textIdx, $wordIdx, $word ) = @_;
-	print "words[$textIdx][$wordIdx] = '" . escapeQuote( $word ) . "';\n";
-}
-
-sub printSuggsElem {
-	my( $textIdx, $wordIdx, @suggs ) = @_;
-	print "suggs[$textIdx][$wordIdx] = [";
-	for my $i ( 0..$#suggs ) {
-		print "'" . escapeQuote( $suggs[$i] ) . "'";
-		if( $i < $#suggs ) {
-			print ", ";
-		}
-	}
-	print "];\n";
-}
-
-sub printCheckerResults {
-	my $textInputIdx = -1;
-	my $wordIdx = 0;
-	my $unhandledText;
-	# create temp file
-	my $dir = tempdir( CLEANUP => 1 );
-	my( $fh, $tmpfilename ) = tempfile( DIR => $dir );
-
-	# temp file was created properly?
-
-	# open temp file, add the submitted text.
-	for( my $i = 0; $i <= $#textinputs; $i++ ) {
-		$text = url_decode( $textinputs[$i] );
-		# Strip all tags for the text. (by FredCK - #339 / #681)
-		$text =~ s/<[^>]+>/ /g;
-		@lines = split( /\n/, $text );
-		print $fh "\%\n"; # exit terse mode
-		print $fh "^$input_separator\n";
-		print $fh "!\n";  # enter terse mode
-		for my $line ( @lines ) {
-			# use carat on each line to escape possible aspell commands
-			print $fh "^$line\n";
-		}
-
-	}
-	# exec aspell command
-	my $cmd = "$aspell_cmd $aspell_opts < $tmpfilename 2>&1";
-	open ASPELL, "$cmd |" or handleError( "Could not execute `$cmd`\\n$!" ) and return;
-	# parse each line of aspell return
-	for my $ret ( <ASPELL> ) {
-		chomp( $ret );
-		# if '&', then not in dictionary but has suggestions
-		# if '#', then not in dictionary and no suggestions
-		# if '*', then it is a delimiter between text inputs
-		if( $ret =~ /^\*/ ) {
-			$textInputIdx++;
-			printTextIdxDecl( $textInputIdx );
-			$wordIdx = 0;
-
-		} elsif( $ret =~ /^(&|#)/ ) {
-			my @tokens = split( " ", $ret, 5 );
-			printWordsElem( $textInputIdx, $wordIdx, $tokens[1] );
-			my @suggs = ();
-			if( $tokens[4] ) {
-				@suggs = split( ", ", $tokens[4] );
-			}
-			printSuggsElem( $textInputIdx, $wordIdx, @suggs );
-			$wordIdx++;
-		} else {
-			$unhandledText .= $ret;
-		}
-	}
-	close ASPELL or handleError( "Error executing `$cmd`\\n$unhandledText" ) and return;
-}
-
-sub escapeQuote {
-	my $str = shift;
-	$str =~ s/'/\\'/g;
-	return $str;
-}
-
-sub handleError {
-	my $err = shift;
-	print "error = '" . escapeQuote( $err ) . "';\n";
-}
-
-sub url_decode {
-	local $_ = @_ ? shift : $_;
-	defined or return;
-	# change + signs to spaces
-	tr/+/ /;
-	# change hex escapes to the proper characters
-	s/%([a-fA-F0-9]{2})/pack "H2", $1/eg;
-	return $_;
-}
-
-# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
-# Display HTML
-# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
-
-print <<EOF;
-Content-type: text/html; charset=utf-8
-
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-<link rel="stylesheet" type="text/css" href="$spellercss"/>
-<script src="$wordWindowSrc"></script>
-<script type="text/javascript">
-var suggs = new Array();
-var words = new Array();
-var textinputs = new Array();
-var error;
-EOF
-
-printTextVar();
-
-printCheckerResults();
-
-print <<EOF;
-var wordWindowObj = new wordWindow();
-wordWindowObj.originalSpellings = words;
-wordWindowObj.suggestions = suggs;
-wordWindowObj.textInputs = textinputs;
-
-
-function init_spell() {
-	// check if any error occured during server-side processing
-	if( error ) {
-		alert( error );
-	} else {
-		// call the init_spell() function in the parent frameset
-		if (parent.frames.length) {
-			parent.init_spell( wordWindowObj );
-		} else {
-			error = "This page was loaded outside of a frameset. ";
-			error += "It might not display properly";
-			alert( error );
-		}
-	}
-}
-
-</script>
-
-</head>
-<body onLoad="init_spell();">
-
-<script type="text/javascript">
-wordWindowObj.writeBody();
-</script>
-
-</body>
-</html>
-EOF

commit 53a8be6dd1d1699055f3ca75aefb303bbdfd88d1
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/ACL_Overlay.pm b/lib/RT/ACL_Overlay.pm
index feef257..cc41596 100755
--- a/lib/RT/ACL_Overlay.pm
+++ b/lib/RT/ACL_Overlay.pm
@@ -88,9 +88,8 @@ Limit the ACL to rights for the object $object. It needs to be an RT::Record cla
 sub LimitToObject {
     my $self = shift;
     my $obj  = shift;
-    unless ( defined($obj)
-        && ref($obj)
-        && UNIVERSAL::can( $obj, 'id' )
+    unless ( Scalar::Util::blessed($obj)
+        && $obj->can('id')
         && $obj->id )
     {
         return undef;
@@ -125,9 +124,8 @@ an RT::Record class.
 sub LimitNotObject {
     my $self = shift;
     my $obj  = shift;
-    unless ( defined($obj)
-        && ref($obj)
-        && UNIVERSAL::can( $obj, 'id' )
+    unless ( Scalar::Util::blessed($obj)
+        && $obj->can('id')
         && $obj->id )
     {
         return undef;
diff --git a/lib/RT/Attribute_Overlay.pm b/lib/RT/Attribute_Overlay.pm
index 58b5eb8..f88e365 100644
--- a/lib/RT/Attribute_Overlay.pm
+++ b/lib/RT/Attribute_Overlay.pm
@@ -142,7 +142,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} = ref($args{Object});
 	    $args{ObjectId} = $args{Object}->Id;
     } else {
diff --git a/lib/RT/Attributes_Overlay.pm b/lib/RT/Attributes_Overlay.pm
index 3043d25..8b98a49 100644
--- a/lib/RT/Attributes_Overlay.pm
+++ b/lib/RT/Attributes_Overlay.pm
@@ -201,9 +201,8 @@ Limit the Attributes to rights for the object $object. It needs to be an RT::Rec
 sub LimitToObject {
     my $self = shift;
     my $obj = shift;
-    unless (defined($obj) && ref($obj) && UNIVERSAL::can($obj, 'id') && $obj->id) {
-    return undef;
-    }
+    return undef unless Scalar::Util::blessed($obj)
+        && $obj->can('id') && $obj->id;
     $self->Limit(FIELD => 'ObjectType', OPERATOR=> '=', VALUE => ref($obj), ENTRYAGGREGATOR => 'OR');
     $self->Limit(FIELD => 'ObjectId', OPERATOR=> '=', VALUE => $obj->id, ENTRYAGGREGATOR => 'OR', QUOTEVALUE => 0);
 
diff --git a/lib/RT/CurrentUser.pm b/lib/RT/CurrentUser.pm
index 85b95f8..a9a2c8e 100755
--- a/lib/RT/CurrentUser.pm
+++ b/lib/RT/CurrentUser.pm
@@ -213,7 +213,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_Overlay.pm b/lib/RT/CustomField_Overlay.pm
index 5db11db..a35c3c1 100755
--- a/lib/RT/CustomField_Overlay.pm
+++ b/lib/RT/CustomField_Overlay.pm
@@ -909,11 +909,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 6062585..3184c84 100755
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -1003,7 +1003,7 @@ through
 sub loc {
 
     if ( $session{'CurrentUser'}
-        && UNIVERSAL::can( $session{'CurrentUser'}, 'loc' ) )
+        && $session{'CurrentUser'}->can( 'loc' ) )
     {
         return ( $session{'CurrentUser'}->loc(@_) );
     } elsif (
@@ -1038,7 +1038,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 4bb6484..0d39208 100644
--- a/lib/RT/Interface/Web/Handler.pm
+++ b/lib/RT/Interface/Web/Handler.pm
@@ -245,8 +245,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_Overlay.pm b/lib/RT/Link_Overlay.pm
index 7528000..ae159ec 100755
--- a/lib/RT/Link_Overlay.pm
+++ b/lib/RT/Link_Overlay.pm
@@ -130,7 +130,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'}));
         
         }
@@ -138,7 +138,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/Principal_Overlay.pm b/lib/RT/Principal_Overlay.pm
index 88e721e..1ab6627 100755
--- a/lib/RT/Principal_Overlay.pm
+++ b/lib/RT/Principal_Overlay.pm
@@ -316,9 +316,7 @@ sub HasRight {
         return (undef);
     }
 
-    if (   defined( $args{'Object'} )
-        && UNIVERSAL::can( $args{'Object'}, 'id' )
-        && $args{'Object'}->id ) {
+    if ( eval { $args{'Object'}->id } ) {
 
         push @{ $args{'EquivObjects'} }, $args{'Object'};
     }
@@ -426,7 +424,7 @@ sub _HasGroupRight
         my $type = ref( $obj ) || $obj;
         my $clause = "ACL.ObjectType = '$type'";
 
-        if ( ref($obj) && UNIVERSAL::can($obj, 'id') && $obj->id ) {
+        if ( Scalar::Util::blessed($obj) && $obj->can('id') && $obj->id ) {
             $clause .= " AND ACL.ObjectId = ". $obj->id;
         }
 
@@ -484,7 +482,7 @@ sub _HasRoleRight
     foreach my $obj ( @{ $args{'EquivObjects'} } ) {
         my $type = ref($obj)? ref($obj): $obj;
         my $id;
-        $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;
 
         my $clause = "Groups.Domain = '$type-Role'";
         # XXX: Groups.Instance is VARCHAR in DB, we should quote value
@@ -548,7 +546,7 @@ sub RolesWithRight {
     foreach my $obj ( @{ $args{'EquivObjects'} } ) {
         my $type = ref($obj)? ref($obj): $obj;
         my $id;
-        $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;
 
         my $object_clause = "ObjectType = '$type'";
         $object_clause   .= " AND ObjectId = $id" if $id;
@@ -633,7 +631,8 @@ sub _ReferenceId {
     my $scalar = shift;
 
     # just return the value for non-objects
-    return $scalar unless UNIVERSAL::can($scalar, 'id');
+    return $scalar unless Scalar::Util::blessed($scalar);
+    return $scalar unless $scalar->can("id");
 
     return ref($scalar) unless $scalar->id;
 
diff --git a/lib/RT/Record.pm b/lib/RT/Record.pm
index 3c85753..0db13af 100755
--- a/lib/RT/Record.pm
+++ b/lib/RT/Record.pm
@@ -661,9 +661,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();
 
     }
@@ -674,7 +674,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 (%$attributes) {
@@ -900,7 +900,7 @@ sub Update {
 
         # 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 024a50b..63dcee5 100644
--- a/lib/RT/Shredder.pm
+++ b/lib/RT/Shredder.pm
@@ -442,7 +442,7 @@ sub _ParseRefStrArgs
         Carp::croak( "both String and Object args passed" );
     }
     return $args{'String'} if $args{'String'};
-    return $args{'Object'}->_AsString if UNIVERSAL::can($args{'Object'}, '_AsString' );
+    return $args{'Object'}->_AsString if Scalar::Util::blessed($args{'Object'}) and $args{'Object'}->can('_AsString');
     return '';
 }
 
diff --git a/lib/RT/Transaction_Overlay.pm b/lib/RT/Transaction_Overlay.pm
index b8ea938..5058fb4 100755
--- a/lib/RT/Transaction_Overlay.pm
+++ b/lib/RT/Transaction_Overlay.pm
@@ -1191,7 +1191,7 @@ sub CustomFieldValues {
     my $self  = shift;
     my $field = shift;
 
-    if ( UNIVERSAL::can( $self->Object, 'QueueObj' ) ) {
+    if ( Scalar::Util::blessed($self->Object) and $self->Object->can( 'QueueObj' ) ) {
 
         # XXX: $field could be undef when we want fetch values for all CFs
         #      do we want to cover this situation somehow here?
diff --git a/lib/RT/Users_Overlay.pm b/lib/RT/Users_Overlay.pm
index 9640925..e5c9321 100755
--- a/lib/RT/Users_Overlay.pm
+++ b/lib/RT/Users_Overlay.pm
@@ -444,7 +444,7 @@ sub _RoleClauses {
     foreach my $obj ( @objects ) {
         my $type = ref($obj)? ref($obj): $obj;
         my $id;
-        $id = $obj->id if ref($obj) && UNIVERSAL::can($obj, 'id') && $obj->id;
+        $id = $obj->id if Scalar::Util::blessed($obj) and $obj->can('id') && $obj->id;
 
         my $role_clause = "$groups.Domain = '$type-Role'";
         # XXX: Groups.Instance is VARCHAR in DB, we should quote value
@@ -495,7 +495,7 @@ sub WhoHaveGroupRight
         foreach my $obj ( @objects ) {
             my $type = ref($obj)? ref($obj): $obj;
             my $id;
-            $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;
 
             my $object_clause = "$acl.ObjectType = '$type'";
             $object_clause   .= " AND $acl.ObjectId   = $id" if $id;
diff --git a/share/html/Admin/Elements/SelectRights b/share/html/Admin/Elements/SelectRights
index 7ec8d1b..0b2890d 100755
--- a/share/html/Admin/Elements/SelectRights
+++ b/share/html/Admin/Elements/SelectRights
@@ -103,7 +103,7 @@ while ( my $ace = $ACLObj->Next ) {
     $ACLObj->LimitToPrincipal( Id => $PrincipalId);
     $ACLObj->OrderBy(FIELD=>'RightName'); 
 
-    if (ref($Object) && UNIVERSAL::can($Object, 'AvailableRights')) { 
+    if (Scalar::Util::blessed($Object) && $Object->can('AvailableRights')) {
         %Rights = %{$Object->AvailableRights};
     } 
 
diff --git a/share/html/Elements/ShowLink b/share/html/Elements/ShowLink
index 0bd0019..023b4af 100644
--- a/share/html/Elements/ShowLink
+++ b/share/html/Elements/ShowLink
@@ -48,14 +48,14 @@
 <a href="<%$URI->Resolver->HREF%>">
 % if ($URI->IsLocal) {
 % my $member = $URI->Object;
-% if (UNIVERSAL::isa($member, "RT::Ticket")) {
+% if ($member->isa("RT::Ticket")) {
 % my $inactive = $member->QueueObj->IsInactiveStatus($member->Status);
 
 <span class="<% $inactive ? 'ticket-inactive' : '' %>">
 <%$member->Id%>: (<& /Elements/ShowUser, User => $member->OwnerObj &>) <%$member->Subject%> [<% loc($member->Status) %>]
 </span>
 
-% } elsif ( UNIVERSAL::can($member, 'Name')) {
+% } elsif ( Scalar::Util::blessed( $member ) and $member->can('Name') ) {
 <%$URI->Resolver->AsString%>: <%$member->Name%>
 % } else {
 <%$URI->Resolver->AsString%>
diff --git a/t/api/i18n.t b/t/api/i18n.t
index 17d71b7..5fb8a5f 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 f886e091e4f6ced17b4dd3bd2f4ec5625e3be8f9
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/Interface/Email.pm b/lib/RT/Interface/Email.pm
index 401e970..4ae58d8 100755
--- a/lib/RT/Interface/Email.pm
+++ b/lib/RT/Interface/Email.pm
@@ -400,7 +400,7 @@ sub SendEmail {
     }
 
     # 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 3184c84..5c2e95c 100755
--- a/lib/RT/Interface/Web.pm
+++ b/lib/RT/Interface/Web.pm
@@ -1557,7 +1557,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};
@@ -2254,12 +2254,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;
         }
     }
diff --git a/lib/RT/Shredder.pm b/lib/RT/Shredder.pm
index 63dcee5..bdf8755 100644
--- a/lib/RT/Shredder.pm
+++ b/lib/RT/Shredder.pm
@@ -342,11 +342,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, $id) = split /-/, $targets;
         $class = 'RT::'. $class unless $class =~ /^RTx?::/i;
@@ -472,7 +472,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 3438068..0fa3a70 100644
--- a/lib/RT/Shredder/Plugin.pm
+++ b/lib/RT/Shredder/Plugin.pm
@@ -216,7 +216,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 963b3d5..f4b5685 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_Overlay.pm b/lib/RT/Ticket_Overlay.pm
index dc789a0..938b928 100755
--- a/lib/RT/Ticket_Overlay.pm
+++ b/lib/RT/Ticket_Overlay.pm
@@ -567,13 +567,13 @@ sub Create {
         my $cfid = $1;
 
         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_Overlay.pm b/lib/RT/Transaction_Overlay.pm
index 5058fb4..6c329b1 100755
--- a/lib/RT/Transaction_Overlay.pm
+++ b/lib/RT/Transaction_Overlay.pm
@@ -1165,7 +1165,7 @@ sub UpdateCustomFields {
         my $cfid   = $1;
         my $values = $args->{$arg};
         foreach
-          my $value ( UNIVERSAL::isa( $values, 'ARRAY' ) ? @$values : $values )
+          my $value ( (ref($values) eq 'ARRAY' ) ? @$values : $values )
         {
             next unless length($value);
             $self->_AddCustomFieldValue(
diff --git a/share/html/Elements/QueryString b/share/html/Elements/QueryString
index a19b54e..38d9ac1 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' ),
                 @$value;
diff --git a/share/html/Search/Elements/ConditionRow b/share/html/Search/Elements/ConditionRow
index fe21f4d..e7dd954 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 3aecc0598a58340dd417b9edf2180be482370284
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 90c3ddb..bbb8ebc 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 d62e580..5461623 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");

commit 5dc9e0d1b948cc49b438f3899c8f31bf5bd2fd90
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 0db13af..e2ae273 100755
--- a/lib/RT/Record.pm
+++ b/lib/RT/Record.pm
@@ -313,7 +313,7 @@ sub Create {
 
    }
 
-    if  (UNIVERSAL::isa('errno',$id)) {
+    if (Scalar::Util::blessed($id) and $id->isa('errno')) {
         return(undef);
     }
 

commit 44ab40d0a9a4fb01e33bb10fec8f7a97e68e7dc2
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 8cea3e4..d6a436a 100644
--- a/share/html/Admin/Tools/Shredder/index.html
+++ b/share/html/Admin/Tools/Shredder/index.html
@@ -80,16 +80,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 62d339d726c372836976cffaf19d7e9302499de6
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/Attribute_Overlay.pm b/lib/RT/Attribute_Overlay.pm
index f88e365..279ee25 100644
--- a/lib/RT/Attribute_Overlay.pm
+++ b/lib/RT/Attribute_Overlay.pm
@@ -359,7 +359,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_Overlay.pm b/lib/RT/CachedGroupMember_Overlay.pm
index bc21619..89efeb6 100755
--- a/lib/RT/CachedGroupMember_Overlay.pm
+++ b/lib/RT/CachedGroupMember_Overlay.pm
@@ -99,19 +99,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 a9a2c8e..d8ebaff 100755
--- 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 2b6a3e3..2b9f2a2 100755
--- a/lib/RT/Date.pm
+++ b/lib/RT/Date.pm
@@ -288,7 +288,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/GroupMember_Overlay.pm b/lib/RT/GroupMember_Overlay.pm
index 48d55d9..7c2a702 100755
--- a/lib/RT/GroupMember_Overlay.pm
+++ b/lib/RT/GroupMember_Overlay.pm
@@ -98,8 +98,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");
@@ -111,8 +112,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/Group_Overlay.pm b/lib/RT/Group_Overlay.pm
index 09f3082..128939a 100755
--- a/lib/RT/Group_Overlay.pm
+++ b/lib/RT/Group_Overlay.pm
@@ -1039,7 +1039,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;
@@ -1083,7 +1083,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/Link_Overlay.pm b/lib/RT/Link_Overlay.pm
index ae159ec..4761010 100755
--- a/lib/RT/Link_Overlay.pm
+++ b/lib/RT/Link_Overlay.pm
@@ -134,7 +134,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;
@@ -142,7 +142,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_Overlay.pm b/lib/RT/Links_Overlay.pm
index d1f7009..5ee785c 100755
--- a/lib/RT/Links_Overlay.pm
+++ b/lib/RT/Links_Overlay.pm
@@ -148,10 +148,10 @@ sub Next {
         return $self->Next;
     }
     # Skip links to local objects thast are deleted
-    if ( $Link->TargetURI->IsLocal and UNIVERSAL::isa($Link->TargetObj,"RT::Ticket")
+    if ( $Link->TargetURI->IsLocal and $Link->TargetObj->isa("RT::Ticket")
              and $Link->TargetObj->__Value('status') eq "deleted") {
         return $self->Next;
-    } elsif ($Link->BaseURI->IsLocal   and UNIVERSAL::isa($Link->BaseObj,"RT::Ticket")
+    } elsif ($Link->BaseURI->IsLocal   and $Link->BaseObj->isa("RT::Ticket")
              and $Link->BaseObj->__Value('status') eq "deleted") {
         return $self->Next;
     } else {
diff --git a/lib/RT/Record.pm b/lib/RT/Record.pm
index e2ae273..0151f7c 100755
--- a/lib/RT/Record.pm
+++ b/lib/RT/Record.pm
@@ -287,7 +287,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,
@@ -1899,7 +1899,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 bdf8755..c94c70e 100644
--- a/lib/RT/Shredder.pm
+++ b/lib/RT/Shredder.pm
@@ -335,12 +335,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 ) {
@@ -409,7 +409,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 e1990d0..ce49635 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -703,7 +703,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;
diff --git a/lib/RT/Ticket_Overlay.pm b/lib/RT/Ticket_Overlay.pm
index 938b928..d1a3df0 100755
--- a/lib/RT/Ticket_Overlay.pm
+++ b/lib/RT/Ticket_Overlay.pm
@@ -2411,7 +2411,7 @@ sub __GetTicketFromURI {
         return( 0, $msg );
     }
     my $obj = $uri_obj->Resolver->Object;
-    unless ( UNIVERSAL::isa($obj, 'RT::Ticket') && $obj->id ) {
+    unless ( Scalar::Util::blessed($obj) and $obj->isa('RT::Ticket') and $obj->id ) {
         return (1, 'Found not a ticket', undef);
     }
     return (1, 'Found ticket', $obj);
diff --git a/lib/RT/User_Overlay.pm b/lib/RT/User_Overlay.pm
index b86a924..ebc35ad 100755
--- a/lib/RT/User_Overlay.pm
+++ b/lib/RT/User_Overlay.pm
@@ -434,7 +434,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 {
@@ -479,7 +479,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_Overlay.pm b/lib/RT/Users_Overlay.pm
index e5c9321..6817a4a 100755
--- a/lib/RT/Users_Overlay.pm
+++ b/lib/RT/Users_Overlay.pm
@@ -334,7 +334,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/EditLinks b/share/html/Elements/EditLinks
index 469b84a..9138991 100755
--- 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 ($link->BaseObj->isa('RT::Ticket')  && $link->BaseObj->Type eq 'reminder');
       <input type="checkbox" class="checkbox" name="DeleteLink-<%$link->Base%>-<%$link->Type%>-" value="1" />
         <& ShowLink, URI => $link->BaseURI &><br />
 % }
diff --git a/share/html/Elements/ShowLinks b/share/html/Elements/ShowLinks
index d674fea..d4e64bc 100755
--- a/share/html/Elements/ShowLinks
+++ b/share/html/Elements/ShowLinks
@@ -109,7 +109,7 @@ for my $link ( @{ $Ticket->DependsOn->ItemsArrayRef } ) {
     <td class="value">
     <ul>
 % while (my $Link = $Ticket->ReferredToBy->Next) {
-% next if (UNIVERSAL::isa($Link->BaseObj, 'RT::Ticket')  && $Link->BaseObj->Type eq 'reminder');
+% next if ($Link->BaseObj->isa( 'RT::Ticket')  && $Link->BaseObj->Type eq 'reminder');
 <li><& ShowLink, URI => $Link->BaseURI &></li>
 % }
 </ul>
diff --git a/share/html/Ticket/Elements/BulkLinks b/share/html/Ticket/Elements/BulkLinks
index b97270e..9a52108 100755
--- a/share/html/Ticket/Elements/BulkLinks
+++ b/share/html/Ticket/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 ($link->BaseObj->isa('RT::Ticket')  && $link->BaseObj->Type eq 'reminder');
       <input type="checkbox" class="checkbox" name="DeleteLink-<%$link->Base%>-<%$link->Type%>-" value="1" />
         <& /Elements/ShowLink, URI => $link->BaseURI &><br />
 % } }

commit 2e75855bc6a97c09ea61fcb55e9a56ad440f8704
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 aa0b4e0..4308e1e 100755
--- 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);
 

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


More information about the Rt-commit mailing list