X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=rt%2Flib%2FRT%2FShredder%2FPlugin.pm;h=ad9af6ac6d3df161272dc18f849da0d4169e3eda;hb=c24d6e2242ae0e026684b8f95decf156aba6e75e;hp=60b5b183582f969c10772693ea09a97f766212a4;hpb=0fb307c305e4bc2c9c27dc25a3308beae3a4d33c;p=freeside.git diff --git a/rt/lib/RT/Shredder/Plugin.pm b/rt/lib/RT/Shredder/Plugin.pm index 60b5b1835..ad9af6ac6 100644 --- a/rt/lib/RT/Shredder/Plugin.pm +++ b/rt/lib/RT/Shredder/Plugin.pm @@ -2,7 +2,7 @@ # # COPYRIGHT: # -# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC # # # (Except where explicitly superseded by other copyright notices) @@ -64,7 +64,7 @@ RT::Shredder::Plugin - interface to access shredder plugins my %plugins = RT::Shredder::Plugin->List; # load plugin by name - my $plugin = new RT::Shredder::Plugin; + my $plugin = RT::Shredder::Plugin->new; my( $status, $msg ) = $plugin->LoadByName( 'Tickets' ); unless( $status ) { print STDERR "Couldn't load plugin 'Tickets': $msg\n"; @@ -72,7 +72,7 @@ RT::Shredder::Plugin - interface to access shredder plugins } # load plugin by preformatted string - my $plugin = new RT::Shredder::Plugin; + my $plugin = RT::Shredder::Plugin->new; my( $status, $msg ) = $plugin->LoadByString( 'Tickets=status,deleted' ); unless( $status ) { print STDERR "Couldn't load plugin: $msg\n"; @@ -127,7 +127,10 @@ sub List push @files, glob $mask; } - my %res = map { $_ =~ m/([^\\\/]+)\.pm$/; $1 => $_ } reverse @files; + my %res; + for my $f (reverse @files) { + $res{$1} = $f if $f =~ /([^\\\/]+)\.pm$/; + } return %res unless $type; @@ -164,6 +167,7 @@ sub LoadByName { my $self = shift; my $name = shift or return (0, "Name not specified"); + $name =~ /^\w+(::\w+)*$/ or return (0, "Invalid plugin name"); local $@; my $plugin = "RT::Shredder::Plugin::$name";