Skip Menu |

This queue is for tickets about the ExtUtils-MakeMaker CPAN distribution.

Report information
The Basics
Id: 26075
Status: resolved
Priority: 0/
Queue: ExtUtils-MakeMaker

People
Owner: Nobody in particular
Requestors: jpeacock [...] rowman.com
Cc:
AdminCc:

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



CC: bug-ExtUtils-MakeMaker [...] rt.cpan.org
Subject: [PATCH] Re: Version object support
Date: Tue, 03 Apr 2007 15:05:20 -0400
To: Michael G Schwern <schwern [...] pobox.com>
From: John Peacock <jpeacock [...] rowman.com>
Michael G Schwern wrote: Show quoted text
> The code looks ok to me. Stick it on RT as a patch so I won't forget it.
Complete patch (plus tests) for version objects as initializer to VERSION parameter. I'm still going to try and get a patch prepared to include a cutdown version object inside EU::MM itself, and I'll take a look at closing several of the other $VERSION-related bug reports in RT at the same time... John
On Tue Apr 03 15:08:09 2007, jpeacock@rowman.com wrote: Show quoted text
> Michael G Schwern wrote:
> > The code looks ok to me. Stick it on RT as a patch so I won't
> forget it. > > Complete patch (plus tests) for version objects as initializer to > VERSION > parameter.
Dude, where's my patch?
Subject: Re: [rt.cpan.org #26075] [PATCH] Re: Version object support
Date: Fri, 29 Jun 2007 11:00:19 -0400
To: bug-ExtUtils-MakeMaker [...] rt.cpan.org
From: John Peacock <jpeacock [...] rowman.com>
Michael G Schwern via RT wrote: Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=26075 > > > On Tue Apr 03 15:08:09 2007, jpeacock@rowman.com wrote:
>> Michael G Schwern wrote:
>>> The code looks ok to me. Stick it on RT as a patch so I won't
>> forget it. >> >> Complete patch (plus tests) for version objects as initializer to >> VERSION >> parameter.
> > Dude, where's my patch? >
I don't know why it didn't get attached the first time. Once more with feeling... John -- John Peacock Director of Information Research and Technology Rowman & Littlefield Publishing Group 4501 Forbes Boulevard Suite H Lanham, MD 20706 301-459-3366 x.5010 fax 301-429-5748
Index: t/writemakefile_args.t =================================================================== --- t/writemakefile_args.t (revision 3955) +++ t/writemakefile_args.t (working copy) @@ -14,7 +14,7 @@ } use strict; -use Test::More tests => 16; +use Test::More tests => 21; use TieOut; use MakeMaker::Test::Utils; @@ -53,7 +53,7 @@ }; is( $warnings, <<VERIFY ); -WARNING: MAN3PODS takes a hash reference not a string/number. +WARNING: MAN3PODS takes a HASH reference not a string/number. Please inform the author. VERIFY @@ -67,7 +67,7 @@ }; is( $warnings, <<VERIFY ); -WARNING: AUTHOR takes a string/number not a code reference. +WARNING: AUTHOR takes a string/number not a CODE reference. Please inform the author. VERIFY @@ -105,7 +105,7 @@ }; # We'll get warnings about the bogus libs, that's ok. - like( $warnings, qr{^WARNING: LIBS takes a array reference or string/number not a hash reference}m ); + like( $warnings, qr{^WARNING: LIBS takes a ARRAY reference or string/number not a HASH reference}m ); $warnings = ''; @@ -120,4 +120,54 @@ is( $mm->{WIBBLE}, 'something' ); is_deeply( $mm->{wump}, { foo => 42 } ); + + # tests of version objects if possible +SKIP: { + $warnings = ''; + eval { + $mm = WriteMakefile( + NAME => 'Big::Dummy', + VERSION => [1,2,3], + ); + }; + like( $warnings, qr{^WARNING: VERSION takes a version reference or string/number} ); + $warnings = ''; + eval { + $mm = WriteMakefile( + NAME => 'Big::Dummy', + VERSION => 1.002_003, + ); + }; + unlike( $warnings, qr{^WARNING: VERSION takes a version reference or string/number} ); + $warnings = ''; + eval { + $mm = WriteMakefile( + NAME => 'Big::Dummy', + VERSION => '1.002_003', + ); + }; + unlike( $warnings, qr{^WARNING: VERSION takes a version reference or string/number} ); + eval "require version;" ; + skip("Can't test version objects",2) if $@ =~ /Can't locate version/; + + my $VERSION = version->new("1.2.3"); + $warnings = ''; + eval { + $mm = WriteMakefile( + NAME => 'Big::Dummy', + VERSION => $VERSION, + ); + }; + unlike( $warnings, qr{^WARNING: VERSION takes a version reference or string/number} ); + $warnings = ''; + eval { + $mm = WriteMakefile( + NAME => 'Big::Dummy', + VERSION => qv("1.2.3"), + ); + }; + unlike( $warnings, qr{^WARNING: VERSION takes a version reference or string/number} ); + + } + } Index: lib/ExtUtils/MakeMaker.pm =================================================================== --- lib/ExtUtils/MakeMaker.pm (revision 3955) +++ lib/ExtUtils/MakeMaker.pm (working copy) @@ -68,41 +68,42 @@ # scalar. my %Att_Sigs; my %Special_Sigs = ( - C => 'array', - CONFIG => 'array', - CONFIGURE => 'code', - DIR => 'array', - DL_FUNCS => 'hash', - DL_VARS => 'array', - EXCLUDE_EXT => 'array', - EXE_FILES => 'array', - FUNCLIST => 'array', - H => 'array', - IMPORTS => 'hash', - INCLUDE_EXT => 'array', - LIBS => ['array',''], - MAN1PODS => 'hash', - MAN3PODS => 'hash', - PL_FILES => 'hash', - PM => 'hash', - PMLIBDIRS => 'array', - PMLIBPARENTDIRS => 'array', - PREREQ_PM => 'hash', - SKIP => 'array', - TYPEMAPS => 'array', - XS => 'hash', + C => 'ARRAY', + CONFIG => 'ARRAY', + CONFIGURE => 'CODE', + DIR => 'ARRAY', + DL_FUNCS => 'HASH', + DL_VARS => 'ARRAY', + EXCLUDE_EXT => 'ARRAY', + EXE_FILES => 'ARRAY', + FUNCLIST => 'ARRAY', + H => 'ARRAY', + IMPORTS => 'HASH', + INCLUDE_EXT => 'ARRAY', + LIBS => ['ARRAY',''], + MAN1PODS => 'HASH', + MAN3PODS => 'HASH', + PL_FILES => 'HASH', + PM => 'HASH', + PMLIBDIRS => 'ARRAY', + PMLIBPARENTDIRS => 'ARRAY', + PREREQ_PM => 'HASH', + SKIP => 'ARRAY', + TYPEMAPS => 'ARRAY', + XS => 'HASH', + VERSION => ['version',''], _KEEP_AFTER_FLUSH => '', - clean => 'hash', - depend => 'hash', - dist => 'hash', - dynamic_lib=> 'hash', - linkext => 'hash', - macro => 'hash', - postamble => 'hash', - realclean => 'hash', - test => 'hash', - tool_autosplit => 'hash', + clean => 'HASH', + depend => 'HASH', + dist => 'HASH', + dynamic_lib=> 'HASH', + linkext => 'HASH', + macro => 'HASH', + postamble => 'HASH', + realclean => 'HASH', + test => 'HASH', + tool_autosplit => 'HASH', ); @Att_Sigs{keys %Recognized_Att_Keys} = ('') x keys %Recognized_Att_Keys; @@ -120,8 +121,8 @@ } my @sigs = ref $sig ? @$sig : $sig; - my $given = lc ref $val; - unless( grep $given eq $_, @sigs ) { + my $given = ref $val; + unless( grep { $given eq $_ || ($_ && eval{$val->isa($_)}) } @sigs ) { my $takes = join " or ", map { $_ ne '' ? "$_ reference" : "string/number" } @sigs;
Ok, this will be in 6.33.