Subject: | Problems implementing SPLICE |
While trying to implement native (working) SPLICE that users can use,
got problems with first argument of "threads::shared::tie::SPLICE".
For some reason "$_[0]" is not the same as first argument to "splice".
Is there any way around? or may-be it need modifications to XS module of
"threads::shared" ?
Sample Code Included. (Need "Devel::Peek" package to demonstrate
difference).
Subject: | test.pl |
#!/usr/bin/env perl
# splicing shared array test
package main;
use strict;
use threads;
use threads::shared;
use Devel::Peek;
use Splicer;
my @test :shared;
@test = qw(one two three);
Dump(\@test);
splice @test, 1, 0;
1;
Subject: | Splicer.pm |
package Splicer;
use strict;
use warnings;
use Devel::Peek;
no warnings 'redefine';
no strict 'refs';
*{"threads::shared::tie::SPLICE"} = sub {
Dump(\$_[0]);
};
1;