develooper Front page | perl.perl5.porters | Postings from January 2008

RE: [perl #50386] GIMME_V broken with 5.10.0/GCC and XS?

Thread Previous | Thread Next
From:
Jan Dubois
Date:
January 30, 2008 11:50
Subject:
RE: [perl #50386] GIMME_V broken with 5.10.0/GCC and XS?
Message ID:
072c01c86379$510d06e0$f32714a0$@com
On Wed, 30 Jan 2008, Robert May wrote:
> On 31/01/2008, Jan Dubois <jand@activestate.com> wrote:
> That's it exactly - I'm on the verge of making a 5.10 compatible
> release, and don't want it to fail immediately.
> 
> >     if (defined &Win32::BuildNumber) {
> >     }
> 
> But won't Strawberry Perl have this too? Are you saying that
> Win32::BuildNumber() is an ActivePerl only thing? If so, then I think
> this is sufficient for me.

It is an ActivePerl addition, reporting the ActivePerl build number.
The name is historical; if you only care about 5.10, then you could
also check for "defined &ActivePerl::BUILD", which has been added
sometime in the 8xx timeframe and is also available on non-Win32
platforms.

Strawberry Perl is build from the original P5P sources, so it won't have
these symbols. Only Perl built from ActivePerl sources will have them
(they can be downloaded from http://downloads.activestate.com/ActivePerl/src/).

I doubt many people do this though.
 
> >     use Config qw(%Config);
> >     my $cc = $Config{cc};
> >     $cc = "cl" if defined %ActivePerl::Config::;
> 
> But that won't catch someone who built Perl from the official sources
> with an MSVC compiler.

Yes, but this is only an issue if after building Perl they suddenly
switch compilers, which again should be rare. If you already have VC++,
why would you switch to GCC, which doesn't run any faster and doesn't
produce any faster code either (well, at least didn't used to in the
past; haven't checked lately).
 
> > Maybe the most general solution would be:
> >
> >     my $cc;
> >     for my $file (qw(Config_heavy.pl Config.pm)) {
> >         my $fullname = "$Config{privlib}/$file";
> >         open(my $fh, "<", $fullname) or die "Can't read $fullname: $!\n";

As your example below points out, it shouldn't die, but just skip the
file because 5.6 won't have Config_heavy.pl.

> >         while (<$fh>) {
> >             $cc = $1, last if /^cc='(.*)'/;
> >         }
> >         last if defined $cc;
> >     }

Cheers,
-Jan



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