Skip Menu |
 

This queue is for tickets about the Parse-RecDescent CPAN distribution.

Report information
The Basics
Id: 120922
Status: resolved
Worked: 2 min
Priority: 0/
Queue: Parse-RecDescent

People
Owner: Nobody in particular
Requestors: KENTNL [...] cpan.org
Cc:
AdminCc:

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



Subject: "require" used as expression in Build.PL/Makefile.PL generating bad META.*

This construct doesn't do what you think it does:

 

+    meta_merge          => {
+        "meta-spec" => { version => 2 },
+        require './MYMETA.pl'

 

   "x_HASH(0x8875e08)" : null,


As demonstrated by this test code:


#!perl
use strict;
use warnings;

use Data::Dumper qw( Dumper );

print Dumper({ require "./MYMETA.pl" });


Which simply emits:

 

$VAR1 = {
          'HASH(0x244e158)' => undef
};

This is because META.pl contains data in *list* form, and require() only returns scalars.

Perhaps what you want to do is wrap MYMETA.pl in a  { }, and then use:

        %{ require './MYMETA.pl' },

Instead.

#!perl
use strict;
use warnings;

use Data::Dumper qw( Dumper );

my $struct = {
    "meta-spec" => { version => 2 },
    %{  require "./MYMETA.pl"  },
};

print Dumper($struct);

$VAR1 = {
          'resources' => {
                           'repository' => {
                                             'url' => 'git://github.com/jtbraun/Parse-RecDescent',
                                             'type' => 'git',
                                             'web' => 'https://github.com/jtbraun/Parse-RecDescent'
                                           },
                           'bugtracker' => {
                                             'web' => 'https://rt.cpan.org/Dist/Display.html?Status=Active&Queue=Parse-RecDescent'
                                           }
                         },
          'meta-spec' => {
                           'version' => 2
                         }
        };

Personally I think relying on the return value of require is asking for trouble, but the above seems to work.

-- 
- CPAN kentnl@cpan.org
- Gentoo Perl Maintainer kentnl@gentoo.org ( perl@gentoo.org )
 

Download (untitled) / with headers
text/plain 975b
Kent, thank you for the timely report. I had used 'do "MYMETA.pl"' previously, which worked, and decided to use require so that it would die if MYMETA.pl couldn't be found. Clearly I made the change and neglected to check the result prior to release. Per your recommendation, I've forgone depending on require's return value, and have just pasted in the metadata into both Makefile.PL and Build.PL: https://github.com/jtbraun/Parse-RecDescent/releases/tag/v1.967015 I've uploaded the new package to CPAN, and will delete 1.967014 once 1.967015 indexes. Thank you, Jeremy On Tue Apr 04 07:15:31 2017, KENTNL wrote: Show quoted text
> This construct doesn't do what you think it does: > > + meta_merge => {+ "meta-spec" => { version => 2 },+ require > './MYMETA.pl'+ } > > Personally I think relying on the return value of require is asking > for > trouble, but the above seems to work. > > -- > - CPAN kentnl@cpan.org > - Gentoo Perl Maintainer kentnl@gentoo.org ( perl@gentoo.org )


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.