[rt-users] Perl error with Shredder on users (RT 3.8.7)

Andy Harrison aharrison at gmail.com
Mon Jul 2 11:24:58 EDT 2012


On Tue, Apr 3, 2012 at 11:00 AM, Ruslan Zakirov <ruz at bestpractical.com> wrote:
> On Tue, Apr 3, 2012 at 18:52, Guillaume Hilt <ghilt at shadowprojects.org> wrote:
>>    Hello,
>>
>> I'm using RT 3.8.7 on Ubuntu 10.04 AMD64.
>>
>> When i'm trying to use the Shredder script (from RT web interface) on
>> enabled users, i'm getting this trange error :
>> Couldn't wipeout object: Bizarre copy of ARRAY in aassign at
>> /usr/share/perl5/Devel/StackTrace.pm line 49.
>>
>> Any idea ?
>
> This is in most cases is a perl bug.
>
>> Regards,
>>
>> --
>>  Guillaume Hilt
>>
>
>
>
> --
> Best regards, Ruslan.



In case anyone else stumbles onto this perl bug like I just did,
here's some working code:

(Likely you'll want to use a better method of selecting your user
objects than my lazy insert of id numbers into __DATA__)

#!/usr/bin/perl

use strict;
use warnings;

#use Data::Dumper;

use RT::Shredder ();
use RT::Shredder::Plugin ();

RT::Shredder::Init( force => 1 );

my $shredder = RT::Shredder->new();


my $plugin = RT::Shredder::Plugin->new;
my ( $plugin_status, $plugin_message ) = $plugin->LoadByString( 'Users' );


# resolver code cribbed from RT::Shredder's t/02users.t test file
#
my $resolver = sub {
    my %args = (@_);
    my $t =     $args{'TargetObject'};
    my $resolver_uid = RT->SystemUser->id;
    foreach my $method ( qw(Creator LastUpdatedBy) ) {
        next unless $t->_Accessible( $method => 'read' );
        $t->__Set( Field => $method, Value => $resolver_uid );
    }
};


print "Iterating id list...\n";

my $user = new RT::User(RT::SystemUser);

for ( <DATA> ) {

    chomp;

    print "\nCurrent id: $_\n";

    $user->Load($_);
    next unless $user->id;

    print "id $_ loaded...\n";

    $shredder->PutResolver( BaseClass => 'RT::User', Code => $resolver );

    print "Wiping...\n";
    $shredder->Wipeout( Object => $user );

}

print "Program complete...\n";


__DATA__
1757
1759
1761
1763
1765
1767




--
Andy Harrison
public key: 0x67518262



More information about the rt-users mailing list