develooper Front page | perl.perl5.porters | Postings from March 2012

Re: [perl #55550] 'once' warnings from xs modules in perl 5.10.0

Thread Previous | Thread Next
From:
Sisyphus
Date:
March 30, 2012 23:36
Subject:
Re: [perl #55550] 'once' warnings from xs modules in perl 5.10.0
Message ID:
B1D1DB2C8270411CA10EEBB3B2FF1334@desktop2

----- Original Message ----- 
From: "James E Keenan via RT" <perlbug-followup@perl.org>
To: "OtherRecipients of perl Ticket #55550 :"
Cc: <perl5-porters@perl.org>
Sent: Saturday, March 31, 2012 10:45 AM
Subject: [perl #55550] 'once' warnings from xs modules in perl 5.10.0


> On Mon Jun 09 21:51:23 2008, clkao@bestpractical.com wrote:
>> This is a bug report for perl from clkao@bestpractical.com,
>> generated with the help of perlbug 1.39 running under perl 5.10.0.
>>
>>
>> -----------------------------------------------------------------
>> [Please describe your issue here]
>>
>> I noticed that in perl 5.10 i get an 'once' warning if i load an xs
>> module who does a get_sv in boot.
>> Specifically this is the Subversion perl bindings generated by swig.
>>
>
> Does this problem still exist in, say, Perl 5.14?
>
> If so, could we get a code sample that we could reproduce with just core
> Perl?

Is this what the bug report is about :

############################
use warnings;

BEGIN {
  $foo = 1234;
};

use Inline C => <<'EOC';

void bar() {
  SV * t =  get_sv("foo", 1);
  printf("bar: %d\n", SvUV(t));
}

EOC

bar();
############################

It outputs:

Name "main::foo" used only once: possible typo at try.pl line 4.
bar: 1234

Yet, obviously the value contained in $foo has been referenced from the 
bar() XSub. Therefore one could argue that it has been used *more* than 
once.

Note that the above example has nothing to do with anything that happens 
(specifically) at the boot stage.

I tried the script on 5.10.0, 5.12.0, 5.14.0 and 5.15.9 - and the output was 
always as above.

Cheers,
Rob


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About