Hi Mark,

Thank you for that solution. It works fine.

Yes, probably the problem is the replace of UNIVERSAL::VERSION, because if I 
redefined that subroutine, the program also works:

sub UNIVERSAL::VERSION {}

Thanks.

Octavian

----- Original Message ----- 
From: "mdootson" <[email protected]>
To: "Octavian Rasnita" <[email protected]>
Cc: <[email protected]>; <[email protected]>
Sent: Sunday, December 05, 2010 5:19 PM
Subject: Re: Error when LWP, WxPerl and version.pm are used together


> Hi Octavian,
> 
> I think you can 'fix' this by an explicit 'use' for IO::Socket.
> 
> e.g.
> 
> use IO::Socket 1.31;
> 
> should prevent the problem.
> 
> For info, this only seems to be a problem with Perl 5.10 - it does not 
> happen in Perl 5.12
> 
> I don't know why the problem exists - probably something to do with 
> version.pm replacing UNIVERSAL::VERSION.
> 
> Hope the fix helps anyway
> 
> Regards
> 
> Mark
> 
> 
> 
> On 05/12/2010 09:36, Octavian Rasnita wrote:
>> Hi,
>>
>> Here below I added a sample program that gives an error if WxPerl, LWP and 
>> version.pm are used together.
>>
>> The program works fine if either
>> - With Wx::Locale I use the language id 56 (for English) instead of 155 (for 
>> Romanian) or
>> - instead of "use version;" I use "use version();".
>>
>> The first problem is that I need to localize a WxPerl app and I also need to 
>> be able to use the Romanian language and the second problem is that I use 
>> REST::Google::Translate which uses "use version;" (without quotes.
>>
>> The program gives the error "501 Attempt to reload IO/Socket.pm aborted." on 
>> the line:
>> die $response->status_line unless $response->is_success;
>>
>> After version.pm is loaded by REST::Google::Translate I have tried to use a 
>> "no version;" and I have also tried to redefine all the subroutines it 
>> exports for not polluting too bad the current namespace, but without results.
>>
>> LWP is somehow affected by the combination of version.pm and the use of the 
>> language id for Romanian in Wx::Locale, but I don't know what's the problem.
>> All the 3 modules use XS code so it might be complicated...
>>
>> Please tell me if there is a solution for this problem, or at least a 
>> workaround which is more clean than modifying REST/Google/Translate.pm.
>>
>> I am using LWP::UserAgent 5.835, WxPerl 0.98, version 0.86 with ActivePerl 
>> 5.10.1 build 1007 under Windows XP Pro.
>>
>> Thank you very much.
>>
>> Here is the test program:
>>
>> use strict;
>> use Wx ':everything';
>> use Wx::Locale gettext =>  '_t';
>> use LWP::UserAgent;
>> use version;
>>
>> my $locale = Wx::Locale->new(155); #gives errors
>> #my $locale = Wx::Locale->new(56); #works fine with this line
>>
>> my $ua = LWP::UserAgent->new;
>>
>> my $request = HTTP::Request->new( GET =>  'http://www.google.com/');
>>
>> my $response = $ua->request( $request );
>>
>> die $response->status_line unless $response->is_success;
>>
>> print $response->content;
>>
>>
>> Octavian
>>
>

Reply via email to