Re: [PATCH] XML::Compile::SOAP on Perl 5.6.1

2008-09-11 Thread Toby Corkindale
On Thu, Sep 11, 2008 at 11:39:58AM +0200, Mark Overmeer wrote:
> [is this really something to get London.pm involved in?  Let's
>  continue solely on the XML::Compile mailing list after this]
> 
> * Toby Corkindale ([EMAIL PROTECTED]) [080911 01:38]:
> > The attached patches to Log::Report and XML::Compile::SOAP are enough
> > to get it functional on Perl 5.6, despite the normal requirements for
> > Perl 5.8.
> 
> I think both patches will make it main stream, with a little rewrite.
> What about:
> 
>   if ($] >= 5.008002)
>   {   require Encode;
>   Encode->import;
>   }
>   else
>   {   *encode = sub { $_[1] };
>   }
> 
> What do you think?  Or should it use utf8::downgrade for some subset of
> older versions?

I agree, the *encode method is much neater. I confirm it works on 5.6.1.

I'm not familiar with utf8::downgrade - are you suggesting it is available on
Perl 5.6.x? (It doesn't look like it to me)

thanks,
Toby

-- 
Turning and turning in the widening gyre/The falcon cannot hear the falconer;
Things fall apart, the centre cannot hold/Mere anarchy is loosed upon the world
(gpg --recv-key B1CCF88E)


[PATCH] XML::Compile::SOAP on Perl 5.6.1

2008-09-10 Thread Toby Corkindale
Hi,
The attached patches to Log::Report and XML::Compile::SOAP are enough to get it
functional on Perl 5.6, despite the normal requirements for Perl 5.8.

It's horrible so I'm not sure you'd *want* to include this in the main distro,
but I thought I'd send it along in case it ever becomes useful for someone else
who has to backport an application to a godforsaken ancient non-Linux, non-5.8
production system.  :)

BTW, aside from the locale and Encode bits, I noticed that
HTTP::Response->decoded_content() returns undef (rather than an error, or
content) on Perl 5.6 for no apparent reason. I'm sure that can't be right?
I don't have a lot of motivation to look into it right now though.. and the
versions of modules I'm hitting are all far enough away from current versions
so it's probably not worth it.

Cheers,
Toby

-- 
Turning and turning in the widening gyre/The falcon cannot hear the falconer;
Things fall apart, the centre cannot hold/Mere anarchy is loosed upon the world
(gpg --recv-key B1CCF88E)
Index: XML/Compile/Transport/SOAPHTTP.pm
===
RCS file: /web/src/rsearch/vendor/soap/XML/Compile/Transport/Attic/SOAPHTTP.pm,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -r1.1.2.1 -r1.1.2.2
23c23,37
< use Encode;
---
> # Commenting out use of Encode, since it doesn't exist on Perl 5.6.1 on prod!
> # use Encode;
> if ($] >= 5.008) {
> require Encode;
> Encode->import;
> }
> # This function works around the lack of Encode on Perl 5.6 by.. not encoding
> # anything. Luckily, StreetAdvisor only sends us ASCII data anyway...
> sub questionableEncode {
> my ($encoding, $string) = @_;
> if ($] >= 5.008) {
> return encode($encoding, $string);
> }
> return $string;
> }
123c137
< my $u = encode($charset, $_[0]);
---
> my $u = questionableEncode($charset, $_[0]);
146c160
< my $u = encode($charset, $_[0]);
---
> my $u = questionableEncode($charset, $_[0]);
157,159c171,177
<   $response->content_type =~ m![/+]xml$!i
< ? $response->decoded_content
< : undef;
---
> if ($response->content_type =~ m![/+]xml$!i) {
> if ($] >= 5.008) {
> return $response->decoded_content;
> }
> return $response->content;
> }
> return undef;
Index: Log/Report/Translator/POT.pm
===
RCS file: /web/src/rsearch/vendor/soap/Log/Report/Translator/Attic/POT.pm,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -r1.1.2.1 -r1.1.2.2
33c33
< my $locale = setlocale(LC_MESSAGES)
---
> my $locale = setlocale(&POSIX::LC_MESSAGES)