Skip Menu |

This queue is for tickets about the threads-shared CPAN distribution.

Report information
The Basics
Id: 43229
Status: open
Priority: 0/
Queue: threads-shared

People
Owner: Nobody in particular
Requestors: k.LabMouse [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 1.27
Fixed in: (no value)



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;
Subject: Re: [rt.cpan.org #43229] Problems implementing SPLICE
Date: Wed, 18 Feb 2009 10:29:50 -0500
To: bug-threads-shared [...] rt.cpan.org
From: "Jerry D. Hedden" <jdhedden [...] cpan.org>
Show quoted text
> 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".
That's because you're accessing the proxy object created by threads::shared.