[Rt-commit] rt branch, 3.8/perlcritic, updated. rt-3.8.10-32-g0fc0ed0
Alex Vandiver
alexmv at bestpractical.com
Thu Jun 30 16:11:44 EDT 2011
The branch, 3.8/perlcritic has been updated
via 0fc0ed001b07e3fef8f744f88def9037e65e3afd (commit)
via 9254d592ae409f83548ca96670c95d202d6345a6 (commit)
via fb7b9dbb1c1d2b14ff9444b49c592bd4299075f5 (commit)
from d1535d179a7f9eaa56dc142ed6a5e08a31b21135 (commit)
Summary of changes:
lib/RT/Interface/Email.pm | 16 ++++------------
lib/RT/Interface/Web/Request.pm | 30 ------------------------------
sbin/rt-message-catalog | 39 +++++++++++++++++++++++++++++++++++----
sbin/rt-setup-database.in | 3 +--
sbin/rt-test-dependencies.in | 3 +--
5 files changed, 41 insertions(+), 50 deletions(-)
- Log -----------------------------------------------------------------
commit fb7b9dbb1c1d2b14ff9444b49c592bd4299075f5
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Thu Jun 30 14:23:15 2011 -0400
Replace many uses of stash plundering with $package->can($method)
diff --git a/lib/RT/Interface/Email.pm b/lib/RT/Interface/Email.pm
index 4ae58d8..df38419 100755
--- a/lib/RT/Interface/Email.pm
+++ b/lib/RT/Interface/Email.pm
@@ -1252,8 +1252,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;
}
@@ -1318,10 +1317,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,
@@ -1330,10 +1326,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'},
@@ -1574,8 +1567,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-message-catalog b/sbin/rt-message-catalog
index dfb8ce3..bb93b27 100755
--- a/sbin/rt-message-catalog
+++ b/sbin/rt-message-catalog
@@ -75,7 +75,7 @@ if ( $opt && keys %$opt ) {
GetOptions( \%opt, keys %$opt );
}
-{ no strict 'refs'; &$command( \%opt, @ARGV ); }
+main->can($command)->( \%opt, @ARGV );
exit;
diff --git a/sbin/rt-setup-database.in b/sbin/rt-setup-database.in
index 2817ba3..ad1f7a5 100755
--- a/sbin/rt-setup-database.in
+++ b/sbin/rt-setup-database.in
@@ -162,8 +162,7 @@ print "Working with:\n"
."User:\t$db_user\nDBA:\t$dba_user\n";
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 9254d592ae409f83548ca96670c95d202d6345a6
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Thu Jun 30 14:24:35 2011 -0400
Bump HTML::Mason dependency, and remove workaround for the old version
This also removes the duplicate HTML::Mason dependency in
bin/rt-test-dependencies, originally imposed because mod_perl required a
newer version of HTML::Mason.
diff --git a/lib/RT/Interface/Web/Request.pm b/lib/RT/Interface/Web/Request.pm
index 84dd28dd..cbf852a 100644
--- a/lib/RT/Interface/Web/Request.pm
+++ b/lib/RT/Interface/Web/Request.pm
@@ -68,36 +68,6 @@ sub new {
return $class->SUPER::new(@_);
}
-# XXX TODO: This alter_superclass replaces teh funcitonality in Mason 1.39
-# with code which doesn't trigger a bug in Perl 5.10.
-# (Perl 5.10.0 does NOT take kindly to having its @INC entries changed)
-# http://rt.perl.org/rt3/Public/Bug/Display.html?id=54566
-#
-# This routine can be removed when either:
-# * RT depends on a version of mason which contains this fix
-# * Perl 5.10.0 is not supported for running RT
-sub alter_superclass {
- my $class = shift;
- my $new_super = shift;
- my $isa_ref;
- { no strict 'refs'; my @entries = @{$class."::ISA"}; $isa_ref = \@entries; }
-
- # handles multiple inheritance properly and preserve
- # inheritance order
- for ( my $x = 0; $x <= $#{$isa_ref} ; $x++ ) {
- if ( $isa_ref->[$x]->isa('HTML::Mason::Request') ) {
- my $old_super = $isa_ref->[$x];
- $isa_ref->[$x] = $new_super
- if ( $old_super ne $new_super );
- last;
- }
- }
-
- { no strict 'refs'; @{$class."::ISA"} = @$isa_ref; }
- $class->valid_params( %{ $class->valid_params } );
-}
-
-
=head2 callback
Method replaces deprecated component C<Element/Callback>.
diff --git a/sbin/rt-test-dependencies.in b/sbin/rt-test-dependencies.in
index 1ce118f..703d2d9 100755
--- a/sbin/rt-test-dependencies.in
+++ b/sbin/rt-test-dependencies.in
@@ -244,7 +244,7 @@ Devel::StackTrace 1.19
.
$deps{'MASON'} = [ text_to_hash( << '.') ];
-HTML::Mason 1.36
+HTML::Mason 1.40
Errno
Digest::MD5 2.27
CGI::Cookie 1.20
@@ -332,7 +332,6 @@ Apache::DBI 0.92
$deps{'MODPERL2'} = [ text_to_hash( << '.') ];
CGI 3.38
Apache::DBI
-HTML::Mason 1.36
.
$deps{'MYSQL'} = [ text_to_hash( << '.') ];
commit 0fc0ed001b07e3fef8f744f88def9037e65e3afd
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Thu Jun 30 16:06:13 2011 -0400
Actually provide the usage() sub which we call
diff --git a/sbin/rt-message-catalog b/sbin/rt-message-catalog
index bb93b27..5dcf9a1 100755
--- a/sbin/rt-message-catalog
+++ b/sbin/rt-message-catalog
@@ -61,9 +61,7 @@ my %commands = (
);
my $command = shift;
-usage() unless $command;
-usage("Unknown command '$command'")
- unless $commands{ $command };
+usage() unless $command and $commands{ $command };
my $opt = $commands{ $command };
my %opt = ();
@@ -267,3 +265,36 @@ sub extract {
system($^X, 'sbin/extract-message-catalog', @_);
}
+sub usage {
+ print STDERR <<END;
+Usage:
+ rt-message-catalog stats
+ Show po file string translation coverage.
+
+ rt-message-catalog shrink [--update] [--keep=not-translated]
+ [--keep=not-referenced]
+ [--keep=equal]
+ Removes unreferenced, untranslated, or no-op translations from po
+ files. Without --update, simply prints the results for each
+ class and PO file; --update causes it to write out the updates to
+ the files. The three --keep options, which can be combined,
+ state classes of translations to keep.
+
+ rt-message-catalog clean [--update]
+ A short form for `shrink --keep=equal --keep=not-translated`
+
+ rt-message-catalog rosetta [--boundry=x] http://some.host/path/to/file.tgz
+ rt-message-catalog rosetta [--boundry=x] path/to/directory/
+ Import updated translations from rosetta, either from a web path
+ to a tarball, or a directory of .po files. If --boundry is
+ supplied, files with translations less complete than that
+ percentage are removed.
+
+ rt-message-catalog extract
+ Simply runs `extract-message-catalog` with whater arguments were
+ provided.
+
+END
+
+ exit 1;
+}
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list